maxWaterDepth and buildings

Currently our buildings seem to lack maxWaterDepth tag. That was good until I tried to implement build site checking in the morph gadget, and it allowed trucks to morph underwater (since deployed guns have no water depth restriction and can in theory be built at any depth). Of course the truck cannot get into such places on its own so that is no problem for the guns, but it may show up sometimes again (like supply piles being buildable underwater where they cannot be attacked).
Pic by Tobi:

I used some awk and shell scripting skills to add maxwaterdepth=0 to the following units (note that LUA unitdefs would have been cooler, cause then we could have set mod wide default different from engine default :slight_smile:)

This are the affected units:

M      RUSSupplyDepot.fbi
M      rusmaxim_sandbag.fbi
M      GBRTankYard1.fbi
M      GBRBofors_Stationary.fbi
M      GBR17Pdr_Stationary.fbi
M      USVehicleYard.fbi
M      GBRTruckSupplies.fbi
M      GBRSpitfireMkIX.fbi
M      USCP.fbi
M      USStorage.fbi
M      USTankYard.fbi
M      USTruckSupplies.fbi
M      GERFlaK38_Stationary.fbi
M      GBRTankYard.fbi
M      gbrvickers_sandbag.fbi
M      GERStorage.fbi
M      RUSResource.fbi
M      RUSBarracks.fbi
M      RUSSPYard.fbi
M      GBRSPYard.fbi
M      USM5Gun_Stationary.fbi
M      USResource.fbi
M      GBRSpitfireMkXIV.fbi
M      RUSLa5FN.fbi
M      USBarracks.fbi
M      GERSPYard.fbi
M      GBRLZ.fbi
M      GBRResource.fbi
M      GBRSupplyDepot.fbi
M      GBRBarracks.fbi
M      GERSupplyDepot.fbi
M      USP51DMustangGA.fbi
M      RUSVehicleYard.fbi
M      RUSZiS3_Stationary.fbi
M      GERGrW34.fbi
M      GBRCommando.fbi
M      RUSZiS2_Stationary.fbi
M      RUSYak3.fbi
M      GBR3InMortar.fbi
M      GERTruckSupplies.fbi
M      GBRHeavyGunYard.fbi
M      RUS61K_Stationary.fbi
M      USP51DMustang.fbi
M      GBRTyphoon.fbi
M      GERJu87G.fbi
M      USSPYard.fbi
M      GERTankYard.fbi
M      GERBf109.fbi
M      germg42_sandbag.fbi
M      GBRSTEN.fbi
M      GERFw190.fbi
M      RUSM30_Stationary.fbi
M      RUSTruckSupplies.fbi
M      TankObstacle.fbi
M      RUSIL2.fbi
M      usdukw.fbi
M      GBRVehicleYard.fbi
M      GERTankYard1.fbi
M      GERVehicleYard.fbi
M      RUSGunyard.fbi
M      RUSPShack.fbi
M      GBRGunYard.fbi
M      RUSMortar.fbi
M      USSupplyDepot.fbi
M      GERleFH18_Stationary.fbi
M      USM1Bofors_Stationary.fbi
M      GERResource.fbi
M      GERBarracks.fbi
M      GERPaK40_Stationary.fbi
M      GBRHQ.fbi
M      USTankYard1.fbi
M      GERNebelwerfer_Stationary.fbi
M      GERFw190G.fbi
M      RUSTankYard1.fbi
M      GBRCommandoC.fbi
M      RUSStorage.fbi
M      USM1Mortar.fbi
M      GERHQBunker.fbi
M      USM2Gun_Stationary.fbi
M      USHQ.fbi
M      USGunyard.fbi
M      GERTankYard2.fbi
M      GBRStorage.fbi
M      usgimg_sandbag.fbi
M      USP47Thunderbolt.fbi
M      RUSPResource.fbi
M      GBR25Pdr_Stationary.fbi
M      RUSTankYard.fbi
M      GERGunyard.fb

Nothing of it tested, it’s just maxwaterdepth=0 added whenever no maxwaterdepth tag was present.

Should I commit this or use different value or remove some units from the list or let someone do it manually?

[size=85]Note to self: for f in *.fbi; do if ! grep -q maxwaterdepth $f; then echo $f; awk -f maxwaterdepth.awk $f > tmp; mv tmp $f; fi done ; svn revert platoon;[/size]

Go ahead and commit tobi, thanks for saving me a load of text monkeying.

Tested it a bit myself and committed it afterwards; removed planes and usdukw from list and increased maxwaterdepth for the Tank Obstacle and the 3 or 4 soldiers in the list.

[code]* Added maxwaterdepth=0 to buildings which didn’t have maxwaterdepth yet,
except TankObstacle, which I gave maxwaterdepth=50 (same as mine signs),
because most tanks seem to have a maxwaterdepth slightly higher then 0.

This fixes minor exploit that buildings could be hidden underwater.

  • Added maxwaterdepth=10 to infantry which didn’t have maxwaterdepth yet.
    (same as rifle infantry of all factions)

    Note this doesn’t affect movement, only affects morphs or situations in which
    the infantry would be buildable directly by a builder (instead of factory.)[/code]