Fix dirty gasoline spawned in lumber mills #46499
Merged
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.
Summary
SUMMARY: Bugfixes "Fix dirty gasoline obtained from gas pumps in lumber mills"
Purpose of change
Fix #46483. Gasoline spawned in gas pumps in lumber mills contain
DIRTY
flag and cannot be used to refill vehicles.Describe the solution
In current implementation
place_liquids
is applied before setting terrain. Althought_gas_pump
hasLIQUIDCONT
flag, whengasoline
is placed, the terrain is not set yet, thusitem::on_drop
marksgasoline
spilledDIRTY
.The solution used in this PR is to use
gaspumps
instead ofplace_liquids
in mapgen JSON.Describe alternatives you've considered
An alternative solution is to adjust the order of applying mapgen JSON fields in C++ code. But I am not sure if there will be any side effect.
Testing
Before applying this PR, gasoline spawned in lumber mills carry
DIRTY
flag. After applying this PR, spawn a new lumber mill, and observe that gasoline spawned is no longerDIRTY
. Gasoline spawned here can also be used to refill vehicles without error.