JKGDevs / JediKnightGalaxies

Jedi Knight Galaxies (JKG) is a multiplayer shooter with role playing elements, played out in the Star Wars universe. The project is a full conversion game modification for Jedi Knight: Jedi Academy.
https://www.jkgalaxies.net/
GNU General Public License v2.0
34 stars 12 forks source link

Armor doesn't get removed after map_restart #335

Open DarthFutuza opened 2 years ago

DarthFutuza commented 2 years ago

If a player equips armor during a match, when the timelimit is reached and the match restarts on the same map (no map cycle), the armor will visually remain (though it isn't quite right either). Instead of clearing out. This does not happen if the map is changed or SV_MapRestart_f() ends up calling SV_SpawnServer() (ie: the gametype or maxclients are modified).

To reproduce do the following:

  1. devmap jkg_ctf_bespin
  2. timelimit 1
  3. give item helmet_stormtrooper
  4. Open inventory (i) and equip the helmet
  5. Wait 1 minute for the match to end, then ready up and witness bug upon respawning. (Check inventory to verify no armor).

image Example Video: https://www.youtube.com/watch?v=pJSNGy78dl8

DarthFutuza commented 2 years ago

My initial thought with fixing this is, we could probably do something similar to CG_LoadClientInfo() and force it reload a default model so that the whole skin is refreshed. You'll notice you can 'fix' the issue, by changing your model to a different one (due to the warzone stuff you'll have to select one allowed by the team eg: red ugnaught instead of regular ugnaught). It appears that only the visuals for armor are not getting turned off, but they do if the model is changed.

DarthFutuza commented 2 years ago

Strangely doing map_restart is not affected by this, (unless the ghost armor has previously been generated by an earlier timelimit triggered restart). This only happens if timelimit is hit. I don't really see much of a difference between the way the two restart methods behave, they call nearly all the same functions and should be basically identical. (Obviously there's something I'm missing).

I tried to investigate what happens if you try to iterate through each entities inventory from within G_ShutdownGame(), and unequip all items as well as clear out the inventory. This doesn't seem to have any effect at all though. The ghost armor will remain behind regardless.

Missing something obvious, I don't really understand ghoul2 and that's probably where the problem is.

DarthFutuza commented 1 year ago

Partially addressed by 02cad80 this is a silly workaround but fixes the problem.