fix: deconstructing terrain into t_null
creates roofs or open air automatically, don't spawn deconstruction results in midair
#6164
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose of change (The Why)
This is an alternative put together to fix behavior wherein deconstructing stairs creates patches of nothingness. Now with a fix for it dumping the wood down into the hole.
Closes #6141
Fixes #5991
Describe the solution (The How)
construct::done_deconstruct
to bother checking whether deconstruct placedt_null
and if so, it looks for a potential roof assigned to the terrain on the z-level below it to use instead viaget_roof
, which in the case of stairs should create open air if there is a matching bottom stair below it.construct::done_deconstruct
checks whether the tile it would normally dump deconstruction items into would be valid (i.e. can hold items and isn't empty space), and if it isn't valid it'll pick a random valid space next to it in the same way construction byproducts are placed. Idea here is this stops it from spawning the deconstruct results directly over the hole that removing the stairs creates, which would promptly fall through and impact the bottom.get_roof
from private to public because it wouldn't let meuse the hidden gloryhole"access private member" in a different file without making it public.Describe alternatives you've considered
t_null
to automatically convert itself to the underlying roof anytime some flavor of fuckery causes it to accidentally spawn.Testing
Additional context
Checklist
Mandatory
closes #1234
in Summary of the PR so it can be closed automatically.main
so it won't cause conflict when updatingmain
branch later.