Events/del player

The del_player event is called whenever a player dies, after any death triggers happen for that player (this means that for chained deaths, the event is effectively called in reverse order where the start of the chain is called last). This is a rather complicated event and has multiple parameters that are subtly different from each other. Commonly used parameters are passed in the function whereas less-commonly-used ones are passed in event.params.

Event callback

 * prevent_default has no effect for this event
 * : The event object
 * : The IRC connection
 * : Reference to the src.settings module
 * : The nick that died
 * : What role nick had
 * : List of templates nick had
 * : True if death triggers were fired for nick (e.g. they did not idle out and it is during game)

Extra parameters
The following are available as attributes on event.params
 * : True if nick died due to being lynched, False otherwise
 * : True if this death can cause a game end (this is set to False for chained deaths and also during transition_day when performing all night deaths)
 * : Role of the person that killed nick (or "villager" if nick was lynched or died to a gun exploding)
 * : List of all players that have died thus far in the current group (this may encompass multiple chains, notably for nighttime deaths where everyone that died at night is put into deadlist). Use this to determine whether or not a player is going to be dying right now but the code just hasn't gotten around to them yet. This list should not be mutated; if it needs to be modified to pass into a chained del_player, make a copy and pass in that mutated copy instead.
 * : The nick of the person that died originally, this is different than nick if this is a chained death. Even if they are the same, it may still be a chained death, so it is probably best to not rely on this to determine chain death/not chain death (see ismain below for that)
 * : If True, this is the original death. If False, this is a chain death
 * : If your event kills anyone, call this function to accomplish that.
 * : If your event kills anyone, you must set event.data["pl"] to the output of this function. Otherwise, chained deaths may result in errors if they contain loops.

None of the parameters should be modified.

Event data
The only event data is the player list, which is different than list_players as it excludes people known to be dying but aren't actually dead yet. If the event callback kills anyone, use the following code to accomplish that (replace and with appropriate values):