Opened 12 years ago

Closed 12 years ago

#1511 closed defect (fixed)

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: Patch:

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 (1)

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

Download all attachments as: .zip

Change History (7)

comment:1 by historic_bruno, 12 years ago

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 by picobyte, 12 years ago

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 years ago by picobyte (previous) (diff)

comment:3 by wraitii, 12 years ago

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 by picobyte, 12 years ago

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

by picobyte, 12 years ago

Attachment: harvest_on_cmd.patch added

Harvest only when unit initiated the building

comment:5 by Deiz, 12 years ago

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 by Deiz, 12 years ago

Owner: set to Deiz
Resolution: fixed
Status: newclosed

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.