FAForever / fa

Lua code for FAF
221 stars 228 forks source link

Add IsAlly check to MobileUnit OnStartBuild #6215

Closed clyfordv closed 3 weeks ago

clyfordv commented 1 month ago

fixes #2725

Description of the proposed changes

Prevent mobile units (engineers) from building enemy buildings. This typically happens when two engineers of the same faction are given a build order to the same resource spot.

Testing done on the proposed changes

Spawn two engineers of a given faction, give them an order to build a mex/hydro on the same spot. Previously whichever engineer arrived second would assist with constructing the enemy structure; now they clear their command queue instead.

Garanas commented 1 month ago

This usually doesn't that often, but if it does - would it be natural to cancel the current command queue? It means your engineer would effectively be idling.

I think this is great as a first version to fixing the problem. But what if we'd extend the copy orders feature to allow you to skip the first N orders? That way you can copy the orders of the engineer but skip the current order and the queue remains functional. This extension would not be available through the sim callback

MrRowey commented 1 month ago

if your extending this like jip sudjest that fine when its ready for merge please add the snipit

clyfordv commented 1 month ago

Extension is in the works

Garanas commented 3 weeks ago

@clyfordv is it fine if I merge this in? You can make the improved version in a different branch, if you haven't already 😃

clyfordv commented 3 weeks ago

We're good to go, I'll add the improvements later.

MrRowey commented 3 weeks ago

We're good to go, I'll add the improvements later.

Add Changes Snipit and ill merge in