Restored the original behavior of dead spectators losing inventory; added new cvar make them keep it.

#204 Declined
Repository
zalewa
Branch
default
Repository
Torr_Samaho
Branch
default
Author
  1. Zalewa
Reviewers
Description

sv_deadplayerscankeepinventory set to 1 will make dead spectators preserve inventory between lives refreshes in "casual survival" (sv_survival_nomapresetondeath 1) and between maps in normal survival if other players complete the map.

Comments (10)

  1. Zalewa author

    With https://bitbucket.org/zalewa/zandronum/commits/d9fb7cb4a8e940e5bbf77734aa278abb370595cc?at=default

    Duel:
    
    - players who lose the game, lose inventory regardless of the 'sv_deadplayerscankeepinventory'.
      That's probably because players who lose the game are turned into true spectators
    
    - sv_survival_nomapresetondeath doesn't affect the game
    
    ----
    
    LMS:
    
    - sv_deadplayerscankeepinventory 1 allows dead spectators to keep the inventory,
      although this is irrelevant because when the game ends, the countdown resets
      all players to the default state - player spawns with new inventory
      immediately when countdown begins
    
    - sv_deadplayerscankeepinventory 0 restores old behavior, dead spectator HUD
      properly shows empty inventory
    
    - sv_survival_nomapresetondeath doesn't affect the game
    
    ----
    
    Survival Invasion:
    
    - `sv_survival_nomapresetondeath 1`
    -- the flag is ignored, map resets when last player dies; this is incorrect, but out of scope for this PR.
    
    
    - `sv_survival_nomapresetondeath 0`, `sv_deadplayerscankeepinventory 0`, last player to die
    -- map is properly reset, inventory is properly reset
    
    
    - `sv_survival_nomapresetondeath 0`, `sv_deadplayerscankeepinventory 0`, **not** last player to die
    -- dead spectator HUD properly shows empty inventory
    -- map is properly reset, inventory is properly reset
    
    - `sv_survival_nomapresetondeath 0`, `sv_deadplayerscankeepinventory 1`, last player to die
    -- map is properly reset, inventory is properly reset - player spawns with new
       inventory immediately when countdown begins
    
    - `sv_survival_nomapresetondeath 0`, `sv_deadplayerscankeepinventory 1`, **not** last player to die
    -- map is properly reset, inventory is properly reset - player spawns with new
       inventory immediately when countdown begins
    -- HUD for dead spectator keeps showing inventory that they had just before their death
    
    
    - `sv_survival_nomapresetondeath 0`, `sv_deadplayerscankeepinventory 1`, **not** last player to die, other players complete the map
    -- next map properly starts with fresh inventory
    
    ----
    
    Survival:
    
    - `sv_survival_nomapresetondeath 0`, `sv_deadplayerscankeepinventory 0`, last player to die
    -- map is properly reset, inventory is properly reset, inventory is already
       reset during countdown
    
    - `sv_survival_nomapresetondeath 0`, `sv_deadplayerscankeepinventory 0`, **not** last player to die
    -- dead spectator HUD properly shows empty inventory
    -- map is properly reset, inventory is properly reset, inventory is already
       reset during countdown
    -- keys are properly cleared, even if `sv_sharekeys 1`
    
    - `sv_survival_nomapresetondeath 0`, `sv_deadplayerscankeepinventory 0`, **not** last player to die, other players complete the map
    -- dead players properly start with fresh inventory
    -- keys are properly cleared, even if `sv_sharekeys 1`
    
    - `sv_survival_nomapresetondeath 0`, `sv_deadplayerscankeepinventory 1`, last player to die
    -- map is properly reset, inventory is properly reset, inventory is already
       reset during countdown
    -- keys are properly cleared, even if `sv_sharekeys 1`
    
    - `sv_survival_nomapresetondeath 0`, `sv_deadplayerscankeepinventory 1`, **not** last player to die
    -- map is properly reset, inventory is properly reset - player spawns with new
       inventory immediately when countdown begins
    -- HUD for dead spectator keeps showing inventory that they had just before their death
    -- keys are properly cleared, even if `sv_sharekeys 1`
    
    - `sv_survival_nomapresetondeath 0`, `sv_deadplayerscankeepinventory 1`, **not** last player to die, other players complete the map
    -- dead players properly carry over inventory between maps
    -- keys are properly cleared, even if `sv_sharekeys 1`
    
    - `sv_survival_nomapresetondeath 1`, `sv_deadplayerscankeepinventory 0`, last player to die
    -- map is properly **not** reset
    -- inventory is properly reset
    -- keys are cleared if `sv_sharekeys 0`, but keys are kept and new keys are
       received upon respawn if `sv_sharekeys 1`
    
    - `sv_survival_nomapresetondeath 1`, `sv_deadplayerscankeepinventory 0`, **not** last player to die
    -- map is properly **not** reset
    -- inventory is properly reset
    -- dead spectator HUD properly shows empty inventory
    -- keys are cleared if `sv_sharekeys 0`, but keys are kept and new keys are
       received upon respawn if `sv_sharekeys 1`, dead HUD shows no keys even if
       `sv_sharekeys 1`
    
    - `sv_survival_nomapresetondeath 1`, `sv_deadplayerscankeepinventory 1`, last player to die
    -- map is properly **not** reset
    -- inventory is properly **not** reset
    -- keys are always kept between respawns
    
    - `sv_survival_nomapresetondeath 1`, `sv_deadplayerscankeepinventory 1`, **not** last player to die
    -- map is properly **not** reset
    -- inventory is properly **not** reset
    -- HUD for dead spectator keeps showing inventory that they had just before their death
    -- if `sv_sharekeys 1` then respawning players properly receive all found keys,
       even if they didn't have them when they died. Moreover, if `give keys` cheat
       is used then those keys are kept between respawns, even considering that
       `sv_sharekeys 1` doesn't track such keys
    
    - `sv_survival_nomapresetondeath 1`, `sv_deadplayerscankeepinventory 1`, **not** last player to die, other players complete the map
    -- inventory is properly **not** reset and carried over between maps
    -- keys are properly cleared
    
  2. Zalewa author

    Known issues:

    • sv_coop_halveammo 1 and sv_deadplayerscankeepinventory 1 will halve ammo twice for dead spectators upon life restoration or map travel. First time the ammo is halved when player goes into dead spectator state. Second time when player is respawned into alive state. If player dies as the last player to die then the ammo is correctly halved only once as this player doesn't go into dead spectator state.
    • sv_sharekeys 1, sv_coop_losekeys 1 will make you lose the keys on death (unsurprisingly?). However, if combined with sv_survival_nomapresetondeath 1 and sv_deadplayerscankeepinventory irrelevant the players get the keys back when they all die and lives are restored.
    • Correct behavior: When sv_survival_nomapresetondeath 1 and sv_deadplayerscankeepinventory 1, then player dies and goes into dead spectator state, then server changes sv_deadplayerscankeepinventory 0, then all players die and respawn then the player who died while it was still sv_deadplayerscankeepinventory 1 correctly respawns only with pistol and 50 bullets.
    • However: When sv_survival_nomapresetondeath 1 but this time sv_deadplayerscankeepinventory 0, then player dies and goes into dead spectator state, then server changes sv_deadplayerscankeepinventory 1, then all players die and respawn then the player who died while it was still sv_deadplayerscankeepinventory 0 will respawn with no inventory at all - no pistol, no bullets, no fist.

    These 3 should be fixed but as none of this is lynching material due to not breaking the old behavior then maybe not in this PR? I mean - this depends on how quickly you want to have the fix for the old behavior break.

      1. Zalewa author

        They all affect new behavior, the old behavior (from before my original patch) is preserved. One of those is directly related to the sv_deadplayerscankeepinventory flag that this patch introduces so at least this one is a thing introduced here that is knowingly broken in one use case. Server admin can, however, avoid it by not changing the flags in the middle of the game.