Configurable mine resource behavior#1942
Conversation
Flamefire
left a comment
There was a problem hiding this comment.
Thanks for taking care of that.
Please remove duplications and check back with what was discussed before. This includes:
- There is no need for multiple addons for a single mine type:
GRANITEMINES_WORK_EVERYWHEREis superflous and all the existing "inexhaustible*" addons should be integrated into this ones and use the same IDs: The OFF setting should be "Default" and ON (the new) "inexhaustible" FindPointWithResourceQuietduplicates code already present -> Reuse existing one, can be done by simply adding a default bool parameternotifyINEXHAUSTIBLE_MINESaddon should be removed: When detected during loading it should set the new addons accordingly, keep ID for that with a TODO for gamedata version increasing- Explain
CalcAverageDisplayProductivityplease, why the extra methods? - Isn't there already a method to convert AIResource to Resource so
GetMineBuildingTypedoesn't need to be (fully) implemented twice? CanCreateWorkEverywhereResourcelooks odd: "Work everywhere" should be just that: Ignore any resource in the ground, not add resources to the world, doesn't it? So just skip the searchIsMineResourceDepletableshouldn't useGetConfiguredMineResourceBehavior, in fact it seems only a single function is required, i.e. both Get... combined.
Maybe more.
Please give a quick summary of how "s4 like behavior" is supposed to work, so @Spikeone can verify it is what he intended in #1501 and we can verify it is implemented according to that spec.
Thanks, that direction makes sense. My understanding of the requested cleanup is:
My current S4-like behavior implementation is intended to work like this:
I’ll rework the implementation toward the existing-ID/list-setting approach and remove the duplicated/intermediate pieces instead of stacking this on top of the old addon set. |
@Spikeone Looks correct to me. Can you confirm? "possible resource capacity" isn't fully clear to me. There are 7 points considered and currently each resource gives 5% chance. I.e. when all have at least 3 resources we will have 100%. IIRC the max amount of resources per node is 7 (we should have a constant for that if we don't already have one) |
Good point. The current implementation intentionally models the existing S4-like “full productivity around ~20 remaining resources” behavior rather than deriving 100% from the absolute theoretical map capacity. The current
I agree the current formulation makes the I will rework this to express the behavior through named constants / derived calculation so the intended reference point becomes explicit instead of looking like a magic number. |
Yes, its 100% at (exactly) 20 resources, but why 20 and not 10, 30 or 40 when 49 is the theoretical maximum? Or even as low as 7 which would be 1 node with full resources. |
Summary
This PR builds on #1920 and implements a cleaned-up replacement path for the broader configurable mine-resource behavior direction from #1501.
It adds configurable per-mine resource behavior settings for coal, iron, gold, and granite mines, including default behavior, S4-like exhaustion, inexhaustible resources, and work-everywhere behavior.
It also preserves the split granite mine behavior from #1920 so inexhaustible granite mines and granite work-everywhere remain separate options.
Details
Preservation of #1920 behavior
INEXHAUSTIBLE_GRANITEMINESprevents granite resource depletion onlyGRANITEMINES_WORK_EVERYWHEREenables granite mine work-everywhere behaviorRelation to #1501
This is not a direct continuation of the old #1501 branch. It implements the same broader direction in a new cleaned-up form, including the previously missing AI handling, alternative no-output production cycle, and productivity display adjustment.
Validation
clang-format version 10.0.0Test_integrationTest_UITest_integration --run_test=ProductionTest_integration --run_test=AIgit diff --check upstream/master...HEADpassed