Jump to content

Player logout event/hook name?


Recommended Posts

Well, I haven't found any API docs for DST, so I'm not sure which event is fired before/after player logs out.

 

I found events:

- onremove

- playerdeactivated

 

Are they correlated to player logout? Or is there other event like player_despawn?

 

PS:

Are there any API docs for DST? The trend now is to document every feature when exposing some library to programmers. It would make mod programmers/scripters work easier, for example, I wouldn't ask my question here, I would find it in API docs. I understand it's beta, but I'm curious if something will be better when DST goes stable.

Link to comment
Share on other sites

	inst:ListenForEvent("ms_playerjoined", function(src, player) OnPlayerJoined(inst, player) end, TheWorld)	inst:ListenForEvent("ms_playerleft", function(src, player) OnPlayerLeft(inst, player) end, TheWorld)

Found in Bearger's file to update the list of players he gets pissed off when they steal a food target.

 

onremove gets pushed on an entity that is removed.

 

playeractivated, deactivated gets pushed whenever a player entity is generated and spawned.

This means that on the server, playeractivated gets pushed once when the player joins.

On the client, playeractivated gets pushed every time a player loads in the client "chunk".

 

Regarding why there is no event list to check:

If you search for :PushEvent(, you will get 703 lines. 703 lines that need to be looked at and have their context tracked.

And not only you have events, but you have functions like onattack for the weapon component and oneaten for the eater component.

(Some of these functions get called alongside an event getting pushed.)

 

I'm not in a hurry to document them. As I learned more about the code, finding events came to be more natural.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...