Keep foresters off potential farm fields#1937
Keep foresters off potential farm fields#1937DevOpsOfChaos wants to merge 3 commits intoReturn-To-The-Roots:masterfrom
Conversation
|
can you still use the forester to spam a big forest to block your enemy at bottlenecks? |
|
Yes, this PR intentionally does not change that. Foresters can still plant normal forests as before, including in places that may be tactically annoying or blocking. This change is only about one narrow case: a forester should not choose a point that a completed own farm could currently use as a new grain field. So this is not an anti-forest-spam or anti-bottleneck-blocking change. It does not add global land reservation, enemy-distance checks, chokepoint logic, or any broader restriction on forester planting. The only newly rejected planting spots are spots that match the existing farmer field-placement rules for the same player. |
04f18dd to
3f214f7
Compare
|
I think this should be an addon since it does change the default behavior of the game. Part of the original feeling and gameplay is foresters blocking stuff you hate him doing. |
|
Fair point. I agree that this changes default gameplay behavior, even if the change is intentionally narrow. I’ll put this on my TODO list and look into converting it into an addon instead of changing the default behavior directly. |
| BOOST_TEST_REQUIRE(foresterBuilding); | ||
|
|
||
| nofForester foresterWorker(world.GetNeighbour(foresterPt, Direction::SouthEast), 0, foresterBuilding); | ||
| const nofFarmhand* forester = &foresterWorker; |
There was a problem hiding this comment.
@Flow86 Similar to the Fisher issue: I'd make GetPointQuality public in all descendants of nofFarmhand for consistency. This avoids "hacks" like this.
@DevOpsOfChaos This shouldn't be a pointer. And if the "cast/decay" is required it could be done in the parameter type of isPointAvailable instead to avoid an extra, potentially confusing variable.
But that depends on the resolution of the above.
There was a problem hiding this comment.
Done. I only cleaned up the test pointer.
088e669 to
13c1d17
Compare
Summary
This adds an optional gameplay addon for farm/forester interaction.
When the addon is enabled, foresters no longer plant trees on spots that a completed own farm could currently use as a new grain field.
The default gameplay behavior is unchanged because the addon is disabled by default.
The change is intentionally narrow:
Motivation
Foresters can currently plant trees on otherwise valid farm field spots before the farmer gets to them.
This can be annoying in normal play because a forester may occupy land that a nearby farm could otherwise use productively. However, this is also part of the original gameplay feel for some players, since foresters blocking useful spots is expected behavior in classic play.
For that reason, this PR no longer changes the default behavior directly. Instead, the behavior is now optional through a new addon.
Implementation details
This PR adds a new addon:
AddonForesterFarmFieldAvoidanceAddonId::FORESTER_FARM_FIELD_AVOIDANCE = 0x01100000011 DevOpsOfChaosThe new check in
nofForester::GetPointQuality()is gated behind:world->GetGGS().isEnabled(AddonId::FORESTER_FARM_FIELD_AVOIDANCE)