Cataclysm-DDA
Cataclysm-DDA copied to clipboard
Items which can be unfolded into vehicles cause a crash with ``class JsonError`` if they were mounted on a tool station prior to updating to a version where the item has unfold syntax
Describe the bug
You understoof the title? Me neither.
TLDR, in #67047 I gave concrete mixers a use action to unfold them into a vehicle. This works fine for all newly spawned concrete mixers but if a concrete mixer was attached to a tool/kitchen station prior to updating to a version of the game in which concrete mixers can be unfolded, it'll cause a crash upon anyone attempting to activate it.
Attach save file
Steps to reproduce
- Copy the changes from #67047
- Open the attached savefile
- On your right you'll have a kitchen station. Detach the concrete mixer from it
- Attempt to activate the concrete mixer
- Watch the game crash
Expected behavior
No crashing. Crashing evil.
Screenshots
Versions and configuration
- OS: Windows
- OS Version: 10.0.22621.3007 (22H2)
- Game Version: 05525e5 [64-bit]
- Graphics Version: Tiles
- Game Language: English [en]
- Mods loaded: [ Dark Days Ahead [dda], Disable NPC Needs [no_npc_food], Portal Storms Ignore NPCs [personal_portal_storms], Slowdown Fungal Growth [no_fungal_growth] ]
Additional context
This may be caused by the fact that the linked PR removes concrete mixers from being able to be attached back onto the tool stations, but I am not certain.
/confirm Merged from linked PR branch to current experimental and followed instructions with the save, crashes as described.
The general cause of this crash is that items don't automatically get all the data from their json definition, if the definition is changed after the item is created. A mixer from prior save doesn't have the foldable vehicle data, and game crashes when trying to access it.
The way to resolve this is to migrate the item using "reset_item_vars": true, this will apply the missing data.
Is this a good enough solution to close this issue? We should probably write this down in migration docs somewhere at least.