Fix house id matching in hardcoded missions #37473
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 house id matching in hardcoded missions"
Purpose of change
After we removed the procedurally generated houses which were tied to the
house
overmap terrain, we've subsequently created a large set of distinct houses and thehouse
overmap terrain only exists now for any mods that haven't yet migrated to specificcity_building
entries for them.However, we have several hardcoded missions which target houses in the city (e.g. dog, zombie mom, software), and all of those were targeting the
house
overmap terrain. This means that they'd probably end up targeting an empty field (which is howhouse
currently renders if there are no mods providing a terrain), or falling back to the city center (aka the crossroads in the center of the city).We also have one of the scavenging missions for the tacoma ranch that also attempts to loot houses.
Describe the solution
This changes the code that finds the house to instead do a "prefix" match on
house
, which means it will find all of the house variants that follow the pattern.Describe alternatives you've considered
Longer term, I think we want to get away from matching on the name that must follow a convention and instead match on flags or things like the land use codes, but for the purposes of having this work properly for 0.E, I think this is sufficient.
Testing
Spawned in the evac center, edited the NPC to have the missions in question, started them, and verified that they targeted houses in the nearby city that were actual houses and not just the empty field
house
version.Ran through the tacoma ranch missions up to the point where the scavenger boss is available, debugged him to have the "level 1" missions trait, spawned an NPC, made him my companion, sent him on a scavenging raid, waited for it to complete, try a couple times because he died on the raid, and then on a successful one confirmed via the debugger that the scavenging raid return targeted a valid house for looting. (also, this scavenging raid is broken-ish and tries to set the targeted terrain to
looted_building
but that's actually invalid because the terrain is rotatable and so it needs to be a rotated id, but that's a whole other issue).