Ticket #1511 (closed defect: fixed)

Opened 12 months ago

Last modified 10 months ago

Workers will start building field foundations when the building they worked on is built

Reported by: wraitii Owned by: Deiz
Priority: Should Have Milestone: Alpha 11
Component: UI & Simulation Keywords: unitAI field farm building
Cc:

Description

Builders, when they become idle, will switch to any nearby foundation and start building it. While this is the intended behavior, it has the unfortunate side-effect of also working with farms: a builder may see an unbuilt farm and go build it... Turning him into a farmer when the farm is finished.

I find it inconvenient: one usually wants to return the builders to their original task/something else and one may "lose" units from sight.

I suggest changing the UnitAI behavior to only work with all nearby non-field foundations.

Attachments

harvest_on_cmd.patch (3.1 KB) - added by picobyte 12 months ago.
Harvest only when unit initiated the building

Change History

comment:1 Changed 12 months ago by historic_bruno

Dropsites are the same way, when a builder finishes a dropsite, they will start gathering the nearest supported resource, unless the order was a queued build order. I can see this being unintended behavior in the same sense.

The cases to think about are: queued vs. non-queued orders, dropsite/field vs. other building, player order vs. auto order, and initial vs. final target. It would be easy to fix one and break another.

comment:2 Changed 12 months ago by picobyte

I thought, maybe in ResourceGatherer.prototype.GetTargetGatherRate

binaries/data/mods/public/simulation/components/ResourceGatherer.js 325

we could do something like this:

	var rates = this.GetGatherRates();
+	if (type.generic == "food" && type.specific == "grain" && rates.length) // only one can farm
+		return 0;

but this doesn't seem to change the farming behavior yet. without the rates.length it does stop all of them

Last edited 12 months ago by picobyte (previous) (diff)

comment:3 Changed 12 months ago by wraitii

Well, I think the case here is "auto-order at a dropsite". In that case, the unit can help build the building, but should not start gathering. If it's player order, start gathering (unless, like right now, there are other orders after that).

comment:4 Changed 12 months ago by picobyte

This appears to work, I haven't run tested it thoroughly though.

Changed 12 months ago by picobyte

Harvest only when unit initiated the building

comment:5 Changed 10 months ago by Deiz

Did a bit of testing, the patch seems to behave as expected. This issue has annoyed me at times, so thanks for the patch.

comment:6 Changed 10 months ago by Deiz

  • Owner set to Deiz
  • Status changed from new to closed
  • Resolution set to fixed

In 12554:

Only have builders auto-gather if they received a forced order. Patch by picobyte, fixes #1511.

Note: See TracTickets for help on using tickets.