Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save/load cycle turns open air into the floor/ roof #72758

Closed
SSpook opened this issue Apr 1, 2024 · 1 comment · Fixed by #72927
Closed

Save/load cycle turns open air into the floor/ roof #72758

SSpook opened this issue Apr 1, 2024 · 1 comment · Fixed by #72927
Labels
(S2 - Confirmed) Bug that's been confirmed to exist

Comments

@SSpook
Copy link

SSpook commented Apr 1, 2024

Describe the bug

Saving and loading a game after finishing a "Dig out pit completely and remove anything remaining" results in the newly produced open air to turn into walkable terrain if the open air is in the reality bubble.

Attach save file

Plattsmouth-trimmed.tar.gz
Walk to shelter, wait 30 min, save+load.
Or wait 30 min, walk to shelter, save+load.

Steps to reproduce

  1. Get a shovel.
  2. Dig until you produce open air.
  3. Save and load.
  4. Examine where you digged.

Expected behavior

Expected to produce a hole.
Expected the hole to not disappear.

Screenshots

No response

Versions and configuration

Game version 22c8112

Additional context

Using the debug menu to change terrain into t_open_air seems to produce the same results.

@SSpook SSpook added the (S1 - Need confirmation) Report waiting on confirmation of reproducibility label Apr 1, 2024
@PatrikLundell
Copy link
Contributor

PatrikLundell commented Apr 1, 2024

/confirmed

Loaded save, followed instructions (had to look at the map to figure out that "the shelter" was to the NW).

It's presumably the same weird logic that closes up holes at the collapsed office tower and other places where cave-ins occur. Wouldn't be shocked if the map::add_roofs operation (buried beneath map::load) is involved, but my guess is that the cave-in (and digging) logic fails to transform the terrain affected below from one containing a roof (which then is "repaired") to one that doesn't have a ceiling and thus doesn't have a roof. Furthermore, it may well be that the ceiling less terrain corresponding to the one with the ceiling doesn't exist in many cases.

Note that tinymap can't affect the terrain of the Z level below since it only support a single Z level.

Edit: This particular case is produced by construction.cpp operation complete_construction. There code exists for adding roofs onto newly constructed terrain, but not anything to strip terrain below a newly constructed hole of its ceiling (which is then "repaired" when the terrain is loaded).
Unfortunately, fixing this is not trivial, because it requires the construction of JSON infrastructure to provide information on what a ceiling supporting terrain tile should transform into when the ceiling is destroyed. Once such data infrastructure exists (including the data for all terrain transformations) it should be straightforward to use the data to transform the terrain below appropriately.
I've hacked a "proof of concept" code that transforms any ceiling supporting terrain below into t_dirt, and that works with this save. Obviously, transforming everything into dirt is not an acceptable solution: we need the info on what to transform the terrain into for each and every ceiling supporting terrain, including ones in mods.

It can be noted that this particular operation uses map, not tinymap, so the concerns above do not apply to this case.

Note, however, that the corresponding treatment ought to be applied to other cases where ceilings are destroyed, such as cave-ins due to fire, (nuclear) explosions, and monster bashing activities (in the latter case the transformation should be to the bashed terrain that opened a hole above), as well as scheduled map generation destruction such as the collapsed office tower.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
(S2 - Confirmed) Bug that's been confirmed to exist
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants