Skip to content

Commit

Permalink
Should fix the loadout-box-killing runtime (#3164)
Browse files Browse the repository at this point in the history
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request

invalid items in loadout = runtime = no box
This should remove any loadout items that don't exist before they can
try to exist (they won't)

## Why It's Good For The Game

uhm box

## Changelog

:cl:
fix: loadout boxes will no longer sometimes not spawn
/:cl:

<!-- Both :cl:'s are required for the changelog to work! You can put
your name to the right of the first :cl: if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->

Signed-off-by: Theos <[email protected]>
  • Loading branch information
SomeguyManperson authored Jul 8, 2024
1 parent 8c992e7 commit 1a1f636
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions code/modules/client/preferences_savefile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -448,9 +448,15 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
READ_FILE(S["equipped_gear"], equipped_gear)
if(config) //This should *probably* always be there, but just in case.
if(length(equipped_gear) > CONFIG_GET(number/max_loadout_items))
to_chat(parent, "<span class='userdanger'>Loadout maximum items exceeded in loaded slot, Your loadout has been cleared! You had [length(equipped_gear)]/[CONFIG_GET(number/max_loadout_items)] equipped items!</span>")
to_chat(parent, span_userdanger("Loadout maximum items exceeded in loaded slot, Your loadout has been cleared! You had [length(equipped_gear)]/[CONFIG_GET(number/max_loadout_items)] equipped items!"))
equipped_gear = list()
WRITE_FILE(S["equipped_gear"] , equipped_gear)
WRITE_FILE(S["equipped_gear"], equipped_gear)

for(var/gear in equipped_gear)
if(!(gear in GLOB.gear_datums))
to_chat(parent, span_warning("Removing nonvalid loadout item [gear] from loadout"))
equipped_gear -= gear //be GONE
WRITE_FILE(S["equipped_gear"], equipped_gear)

READ_FILE(S["feature_human_tail"], features["tail_human"])
READ_FILE(S["feature_human_ears"], features["ears"])
Expand Down

0 comments on commit 1a1f636

Please sign in to comment.