Cataclysm-DDA icon indicating copy to clipboard operation
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

Open Karol1223 opened this issue 1 year ago • 2 comments

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

Edgartown-trimmed.tar.gz

Steps to reproduce

  1. Copy the changes from #67047
  2. Open the attached savefile
  3. On your right you'll have a kitchen station. Detach the concrete mixer from it
  4. Attempt to activate the concrete mixer
  5. Watch the game crash

Expected behavior

No crashing. Crashing evil.

Screenshots

image

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.

Karol1223 avatar Jan 20 '24 10:01 Karol1223

/confirm Merged from linked PR branch to current experimental and followed instructions with the save, crashes as described.

harakka avatar Feb 14 '24 17:02 harakka

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.

harakka avatar Mar 24 '24 12:03 harakka