- changed status to open
Add is_dead flag to player struct
Issue #26
resolved
It would be convenient for modules to have quick access to a player's dead/not-dead status.
A simple method is to set is_dead whenever a player dies, along with a time stamp for their expected revival. If any position packets that aren't located at -1,-1 are received after their revival (with some configurable fudge factor), then the player is marked as not dead. Ship resets and flag victories will have to be taken into consideration as well.
Suggested by JoWie here: http://forums.minegoboom.com/viewtopic.php?p=80453#80453 though in a slightly different form.
Comments (5)
-
-
-
assigned issue to
-
assigned issue to
-
Implemented in commit 996: d4f622d4de81
Tested briefly, will hopefully get a real implementation besides debug messages going before I mark this as resolved.
-
-
- removed version
- Log in to comment
A proposed solution is to create the is_dead flag on a player, and two fields: ticks_t last_death, and ticks_t next_respawn. game.c will use these fields to determine if an incoming position packet not at -1,-1 should constitute them having respawned (lag/out of order packets could screw up detection otherwise.)
Additionally, this flag will be used to power a CB_SPAWN callback, which will be called whenever the player has entered a new life, either by respawning after dying, getting a shipreset/flag victory (which can also nullify death), a shipchange, or when they enter the arena not in spec. The circumstances will be passed as a bitfield so that you can control what types of spawns you actually care about. This will make it easier to implement functionality that needs to happen when the player is in a fresh new ship (like automatically prizing bounce, prox, shrapnel, multifire, or warping the player to a specific location.)