Cataclysm-DDA icon indicating copy to clipboard operation
Cataclysm-DDA copied to clipboard

ATMs spawned en masse

Open JohnHenryEton opened this issue 1 year ago • 12 comments

Describe the bug

After downloading a newer version from the experimental branch, ATMs are appearing in unexpected places. Possibly only in previously explored areas. Going through walls, other unoccupied areas, etc. At first I noticed it in a newer area I was looting, but as I was returning home I found a spot where I was sure there weren't loads of ATMs before. I'm guessing it's a bug.

Attach save file

test-trimmed.tar.gz

Steps to reproduce

Drive around to previously explored places that spawn ATMs. or teleport to one like gas stations? Get invaded by the ATM hoard?

Expected behavior

Not being invaded by the ATMtide

Screenshots

Screenshot 2024-09-04 151048

Versions and configuration

  • OS: Windows
    • OS Version: 10.0.22631.4112 (23H2)
  • Game Version: 9633d7f [64-bit]
  • Graphics Version: Tiles
  • Game Language: System language []
  • 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], Magiclysm [magiclysm], <color_cyan>Arcana and Magic Items [Arcana], <color_light_blue>BL9-100%-monster-resilience-version [BL9_100monres], Bionic Professions [package_bionic_professions], Magiclysm Revamp and Additions [magicrevamp], Mind Over Matter [mindovermatter], DinoMod [DinoMod], <color_cyan>Arcana/DinoMod Patchmod [Arcana_Dinomod_Patch], <color_cyan>Arcana/Magiclysm Patchmod [Arcana_Magiclysm_Patch], Mythical Martial Arts [MMA], <color_yellow>Mythical Martial Arts - Mods Extension [MMA_Mods_Extension], Crazy Cataclysm [crazy_cataclysm], Vampiric Stuff [vamp_stuff], Vampiric Stuff + Arcana Mod Extension [vamp_stuff+arcana], Miscellaneous Magiclysm Expansions [demon_spider_a], Bombastic Perks [bombastic_perks], Xedra Evolved [xedra_evolved], Stats Through Kills [stats_through_kills], SpeedyDex [speedydex], No Bionic Slots [no_cbm_slots], <color_light_blue>Hamm's teaks for things [HammTweaks] ]

Additional context

No response

JohnHenryEton avatar Sep 04 '24 20:09 JohnHenryEton

Can't reproduce on the most recent experimental i suspect the issue is in some of out of repo mod, please confirm it happens in vanilla

  • OS: Windows
    • OS Version: 10.0.19045.4780 (22H2)
  • Game Version: 0.G-11844-g 33970f51ee [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] ] image

GuardianDll avatar Sep 04 '24 20:09 GuardianDll

I couldn't get it to happen on a new save at all. Either with my current modlist or otherwise. Only happened with an ongoing save, and I don't have another ongoing save.

JohnHenryEton avatar Sep 04 '24 20:09 JohnHenryEton

  • OS: Linux
    • OS Version: LSB Version: n/a; Distributor ID: Arch; Description: Arch Linux; Release: rolling; Codename: n/a;
  • Game Version: 705ea526-dirty [64-bit]
  • Graphics Version: Tiles
  • Game Language: System language []
  • 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] ] 2024-09-04-233804_1920x1080_scrot created save in cdda-linux-tiles-x64-2024-08-14-0103 , explored the gas station loaded save and teleported in cdda-linux-tiles-x64-2024-09-03-0707 - was not bugged yet loaded save and teleported in cdda-linux-tiles-x64-2024-09-04-0626 - it was like on screenshot

HadeanLake avatar Sep 04 '24 20:09 HadeanLake

something fishy going on is it ter_furn_migration from #76051 causes some issues on game load?

GuardianDll avatar Sep 04 '24 20:09 GuardianDll

I was about to comment that I had just replicated the issue by downgrading to a build from the 2nd, finding an atm, upgrading again with a repo only list.

JohnHenryEton avatar Sep 04 '24 20:09 JohnHenryEton

is it ter_furn_migration from https://github.com/CleverRaven/Cataclysm-DDA/pull/76051 causes some issues on game load?

Yes. "to_ter" is missing in ter_furn_migration JSON (causes terrain to be nothing under first one), and code processing it does not reset furniture after placing it once

Here is rough and only briefly tested draft patch to fix this:

--- a/data/json/obsoletion_and_migration_0.I/obsolete_furniture.json
+++ b/data/json/obsoletion_and_migration_0.I/obsolete_furniture.json
@@ -91,6 +91,7 @@
   {
     "type": "ter_furn_migration",
     "from_ter": "t_atm",
+    "to_ter": "t_thconc_floor",
     "to_furn": "f_atm_off"
   }
 ]  

--- a/src/savegame_json.cpp
+++ b/src/savegame_json.cpp
@@ -4925,6 +4925,9 @@ void submap::load( const JsonValue &jv, const std::string &member_name, int vers
                                     iid_furn = it->second.second.id();
                                 }
                             }
+                            else {
+                                iid_furn = furn_str_id::NULL_ID().id();
+                            }
                             if( terstr.is_valid() ) {
                                 iid_ter = terstr.id();
                             } else {

there is probably a better way to reset iid_furn

HadeanLake avatar Sep 04 '24 21:09 HadeanLake

Is there a good way to remove these ATMs from a save when this gets fixed?

JohnHenryEton avatar Sep 04 '24 23:09 JohnHenryEton

to remove furniture:

  1. debug menu
  2. map
  3. map editor (disables achievements)
  4. scroll overtop your ATM
  5. 'r' furniture
  6. '/' filter for 'null' (optional to make it easier to get to the 'nothing' furniture)
  7. select "nothing" furniture.
  8. repeat for all other ATM's

Alternatively, you can just regenerate the whole overmap chunk.

  1. debug menu
  2. map
  3. map editor
  4. 'o' overmap/mapgen
  5. '/' filter for "s_gas_1_north" (im pretty sure this is the exact gas station in your picture)
  6. '3' Apply

CoroNaut avatar Sep 05 '24 02:09 CoroNaut

there is probably a better way to reset iid_furn

To me it looks like both iid_ter and iid_furn should only be declared inside the loops, so they reset automatically.

mqrause avatar Sep 05 '24 06:09 mqrause

should only be declared inside the loops,

Their value is used outside of the iteration it was assigned. Game checks if next tiles are same, writes amount of same tiles into remaining var and uses it to skip some logic

checking !remaining again before iteration ends and resetting iid_furn there (where we had run out of same tiles to assign it to) fixes it, but the whole thing probably needs a rewrite

--- a/src/savegame_json.cpp
+++ b/src/savegame_json.cpp
@@ -4951,6 +4951,9 @@ void submap::load( const JsonValue &jv, const std::string &member_name, int vers
                     if( iid_furn ) {
                         m->frn[i][j] = iid_furn;
+                        if ( !remaining ) {
+                            iid_furn = furn_str_id::NULL_ID().id();
+                        }
                     }
                 }
             }
             if( remaining ) {

When testing fix for this, it is important to have multiple ATM's in a row and one on the next line. I tested using this save: 2024-09-05-124101_1920x1080_scrot ATM corruption-trimmed.tar.gz

HadeanLake avatar Sep 05 '24 09:09 HadeanLake

Their value is used outside of the iteration it was assigned. Game checks if next tiles are same, writes amount of same tiles into remaining var and uses it to skip some logic

Oh, right, I was misreading things. So instead of resetting iid_furn, I'd suggest simply always setting it, and not just if it's not the NULL_ID. (And maybe also add a check if the furniture id is actually valid.)

mqrause avatar Sep 05 '24 10:09 mqrause

to remove furniture:

1. debug menu

2. map

3. map editor (disables achievements)

4. scroll overtop your ATM

5. 'r' furniture

6. '/' filter for 'null' (optional to make it easier to get to the 'nothing' furniture)

7. select "nothing" furniture.

8. repeat for all other ATM's

Alternatively, you can just regenerate the whole overmap chunk.

1. debug menu

2. map

3. map editor

4. 'o' overmap/mapgen

5. '/' filter for "s_gas_1_north" (im pretty sure this is the exact gas station in your picture)

6. '3' Apply

The latter is probably better given the number of spawned ATMs, thanks.

JohnHenryEton avatar Sep 05 '24 14:09 JohnHenryEton