Unciv icon indicating copy to clipboard operation
Unciv copied to clipboard

Add Pillaging Roads and Repair Action

Open itanasi opened this issue 3 years ago • 7 comments
trafficstars

Rework Improvements to match Civ5 and support tiles having a pillaged state Add support for Improvements and Roads to be Pillaged and Repaired Tiles turn Brown when Pillaged. Workers can Repair and functionality (resources and city connections) is restored immediately (matching Civ5 behavior). Worker Automation will look for Repairable Tiles. Will also try to avoid Enemy Units more. Pillaged Resources are updated in yield and resources provided. NOT REVERSE COMPATIBLE since adding new variables

image

Translations working image

Applying color filter to tile (brown) and improvements (red) image

Save to experiment: Autosave-Korea-76.txt

itanasi avatar Sep 16 '22 05:09 itanasi

NOT REVERSE COMPATIBLE

If this is the case, please update the CURRENT_COMPATABILITY_NUMBER variable in the companion object of GameInfo (GameInfo.kt:71) to enforce this :)

xlenstra avatar Sep 17 '22 10:09 xlenstra

NOT REVERSE COMPATIBLE

If this is the case, please update the CURRENT_COMPATABILITY_NUMBER variable in the companion object of GameInfo (GameInfo.kt:71) to enforce this :)

This is for marking if a save will break if opened in an earlier version?

itanasi avatar Sep 17 '22 14:09 itanasi

NOT REVERSE COMPATIBLE

If this is the case, please update the CURRENT_COMPATABILITY_NUMBER variable in the companion object of GameInfo (GameInfo.kt:71) to enforce this :)

This is for marking if a save will break if opened in an earlier version?

As far as I understand it, yes

xlenstra avatar Sep 17 '22 22:09 xlenstra

There's a lot to like here, but having the Repair action be part of the jsons means that modders can decide to not include it, so your code should always be able to handle the case where the repair action does not exist.

yairm210 avatar Sep 19 '22 05:09 yairm210

There's a lot to like here, but having the Repair action be part of the jsons means that modders can decide to not include it, so your code should always be able to handle the case where the repair action does not exist.

OK, created a backup TileImprovement for Repair in TileInfo. I feel like it should get added in Game Ruleset instead? But that feels very hacky and hard to find

itanasi avatar Sep 20 '22 04:09 itanasi

There's a lot to like here, but having the Repair action be part of the jsons means that modders can decide to not include it, so your code should always be able to handle the case where the repair action does not exist.

OK, created a backup TileImprovement for Repair in TileInfo. I feel like it should get added in Game Ruleset instead? But that feels very hacky and hard to find

I'd think that the right way to solve this would not be to include a backup version of the unit action, but rather make it so that if no 'repair' action is in the ruleset, either repairing is just impossible, or pillaged improvements are destroyed immediately. In both cases, making sure nothing weird happens when it isn't included is the main concern. Automatically adding it in the ruleset if it isn't present to me feels like forcing modders to use it, even if they don't want it, and will probably lead to hacky ways in which modders try to disable it (setting the building time to 9999 and then be confused why AI still try to repair, for example).

xlenstra avatar Sep 22 '22 09:09 xlenstra

K, made so if Repair doesn't exist, Pillage go straight to destruction. I couldn't get a save to update the tile though. gameInfo.setTransients is only run on new games? And the TileInfo.normalizeToRuleset() is only Map Editor?

itanasi avatar Sep 23 '22 01:09 itanasi

This pull request has conflicts, please resolve those before we can evaluate the pull request.

github-actions[bot] avatar Nov 15 '22 16:11 github-actions[bot]

Conflicts have been resolved.

github-actions[bot] avatar Nov 16 '22 04:11 github-actions[bot]