HomeWildfire Games

Fix mirages (and any other entity that blocks something but not…
AuditedrP21624

Description

Fix mirages (and any other entity that blocks something but not BlockConstruction) blocking foundation construction following rP21597 / D21.
Clean the code by removing the animal hardcoding in the Foundation component and adding a flag DeleteUponConstruction to the Obstruction component.

Have locked gates and upgraded entities equally delete entities when transforming.
Add a workaround for trees inside walls on random maps.

Reviewed by: temple
Differential Revision: https://code.wildfiregames.com/D1415
Refs #4268

Event Timeline

mimo raised a concern with this commit.Apr 29 2018, 10:57 PM
mimo added a subscriber: mimo.

Same problem still happen for dock foundations when placed above fishes.

This commit now has outstanding concerns.Apr 29 2018, 10:57 PM

Thanks for finding out the context of the bug.

The fish could either be removed upon placement or block foundation placement. In alpha 22 it is deleted.
It's indeed this commit and not the D21 one, since we incorrectly translated the line // If obstructing fauna is gaia or our own but doesn't have UnitAI, just destroy it into corpses.
(template_unit.xml states that BlockFoundation = false and BlockConstruction = true, so the template could be considered wrong before and the code was wrong before too and the bugs cancelled each other out.)

To mimic a22, we can set DeleteFoundationUponConstruction true for fish.
Do we have any other unit obstruction that doesnt have unitAI?

Index: binaries/data/mods/public/simulation/templates/template_unit_fauna_fish.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/template_unit_fauna_fish.xml	(revision 21808)
+++ binaries/data/mods/public/simulation/templates/template_unit_fauna_fish.xml	(working copy)
@@ -13,6 +13,7 @@
   <Obstruction>
     <BlockMovement>false</BlockMovement>
     <BlockPathfinding>false</BlockPathfinding>
+    <DeleteUponConstruction>true</DeleteUponConstruction>
   </Obstruction>
   <Position>
     <Altitude>-2.0</Altitude>
mimo added a comment.Apr 30 2018, 12:09 AM

Yep, i've just tested the patch and it works as expected. I don't have in mind any other template which could have that problems.
By the way, i've seen that problem (and used also for checking the patch) on wild lake random map. There are so much fishes on that map that it's ideal for testing that patch, but i don't think that is what was wanted. Maybe something to fix in that map for a24?

elexis requested verification of this commit.Apr 30 2018, 6:33 PM

Gladly caught in time! rP21810

Less fish, possibly. Code reads like it would even place fish on every single tile that meets height and elevation criteria. (There's also fish on land on archipelago, if the randombiome is savanna on rmgen2 maps (ambush) then there are often too many elephants, and the shoreline on hellas and elephantine is sometimes annoying. I should do something to not forget these things.)

This commit now requires verification by auditors.Apr 30 2018, 6:33 PM
mimo accepted this commit.EditedApr 30 2018, 10:09 PM

tested rP21810 and works as expected

All concerns with this commit have now been addressed.Apr 30 2018, 10:09 PM