Skip to content

Keep foresters off potential farm fields#1937

Open
DevOpsOfChaos wants to merge 3 commits intoReturn-To-The-Roots:masterfrom
DevOpsOfChaos:sidequest/foresters-avoid-farm-fields
Open

Keep foresters off potential farm fields#1937
DevOpsOfChaos wants to merge 3 commits intoReturn-To-The-Roots:masterfrom
DevOpsOfChaos:sidequest/foresters-avoid-farm-fields

Conversation

@DevOpsOfChaos
Copy link
Copy Markdown

@DevOpsOfChaos DevOpsOfChaos commented May 1, 2026

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:

  • it only affects forester planting target selection when the addon is enabled
  • it only protects potential new grain field spots for the same player
  • it mirrors the existing farmer field-placement constraints
  • it does not reserve farm land globally
  • it does not change how farmers place fields
  • it does not change how foresters plant outside potential farm field spots
  • it does not affect enemy farms or cross-player land usage

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:

  • AddonForesterFarmFieldAvoidance
  • AddonId::FORESTER_FARM_FIELD_AVOIDANCE = 0x01100000
  • addon namespace entry: 011 DevOpsOfChaos
  • default status: disabled

The new check in nofForester::GetPointQuality() is gated behind:

world->GetGGS().isEnabled(AddonId::FORESTER_FARM_FIELD_AVOIDANCE)

@stefson
Copy link
Copy Markdown
Contributor

stefson commented May 2, 2026

can you still use the forester to spam a big forest to block your enemy at bottlenecks?

@DevOpsOfChaos
Copy link
Copy Markdown
Author

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.

@DevOpsOfChaos DevOpsOfChaos force-pushed the sidequest/foresters-avoid-farm-fields branch from 04f18dd to 3f214f7 Compare May 2, 2026 12:53
@Spikeone
Copy link
Copy Markdown
Member

Spikeone commented May 2, 2026

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.

@DevOpsOfChaos
Copy link
Copy Markdown
Author

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.

Comment thread libs/s25main/figures/nofForester.cpp Outdated
@DevOpsOfChaos DevOpsOfChaos requested a review from Flow86 May 3, 2026 07:23
Comment thread libs/s25main/figures/nofForester.cpp
@DevOpsOfChaos DevOpsOfChaos requested a review from Flamefire May 3, 2026 09:57
BOOST_TEST_REQUIRE(foresterBuilding);

nofForester foresterWorker(world.GetNeighbour(foresterPt, Direction::SouthEast), 0, foresterBuilding);
const nofFarmhand* forester = &foresterWorker;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I only cleaned up the test pointer.

@DevOpsOfChaos DevOpsOfChaos force-pushed the sidequest/foresters-avoid-farm-fields branch from 088e669 to 13c1d17 Compare May 3, 2026 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants