Opened 13 years ago

Closed 13 years ago

Last modified 8 years ago

#724 closed defect (fixed)

[PATCH] Units should not move out of enemy construction zones

Reported by: Kieran P Owned by: Andrew
Priority: Must Have Milestone: Alpha 6
Component: Core engine Keywords:
Cc: Andrew Patch:

Description

When you place a building, enemy units will politely move out of the way so you can build it.

Only ally units and animals should move away.

Attachments (1)

diffContstruction.patch (2.6 KB ) - added by Andrew 13 years ago.
fixes some issues with diplomacy; units do not move out of the way for their enemies' constructions

Download all attachments as: .zip

Change History (13)

comment:1 by Kieran P, 13 years ago

Summary: Units should be polite in moving out of construction zones that belong to an enemyUnits should not move out of enemy construction zones

comment:2 by Kieran P, 13 years ago

Milestone: Alpha 4Alpha 5

by Andrew, 13 years ago

Attachment: diffContstruction.patch added

fixes some issues with diplomacy; units do not move out of the way for their enemies' constructions

comment:3 by Andrew, 13 years ago

Keywords: review added

comment:4 by historic_bruno, 13 years ago

Summary: Units should not move out of enemy construction zones[PATCH] Units should not move out of enemy construction zones

comment:5 by Kieran P, 13 years ago

Priority: Nice to HaveMust Have

in reply to:  3 ; comment:6 by historic_bruno, 13 years ago

Replying to Stork:

About your comment in the patch, in UnitAI.js line 1859. Are you referring to animal corpses? If so, maybe a check for gaia owned units would be enough. I think the order should not even be added to the queue if it's invalid (i.e. non-gaia players who are not friendly to the requesting player).

in reply to:  6 comment:7 by Andrew, 13 years ago

Replying to historic_bruno:

I was referring to any corpses. The bodies of invaders should not prevent me from trying to build a wall to keep them out. I wasn't sure how to check for states outside of the state machine to see if it was in a corpse state, and didn't think that it was the proper way of using states anyway.

comment:8 by Philip Taylor, 13 years ago

Normal unit corpses have their Obstruction component inactivated, so they should never block the foundation (GetConstructionCollisions won't return them) and they don't need to be explicitly ignored. Only animal corpses remain as real obstructions (so you can still gather food from them) and need the special deletion behaviour.

In the current UnitAI, the validity check needs to be done in IDLE and REPAIR states, so it should probably be extracted into a separate method and called from both of them, instead of putting it directly in the IDLE one.

Rather than using the diplomacy array data directly, I think we really need some helper functions to abstract it out. Probably could go in helpers/Player.js with a function like IsOwnedByAlly(this.entity, msg.data.target).

(Instead of using sendingFoundation.entity you can just use msg.data.target directly since that's already the entity ID of the foundation entity.)

The "TODO: we should verify this is a friendly foundation" comment should be removed since it's being verified now. (I think it makes sense to do the check in the FSM like in this patch, not where that comment is, since animal FSM states don't want the check.)

comment:9 by Kieran P, 13 years ago

Cc: Andrew added
Owner: set to Andrew

comment:10 by Kieran P, 13 years ago

Milestone: Alpha 5Alpha 6

comment:11 by Badmadblacksad, 13 years ago

Resolution: fixed
Status: newclosed

(In [9532]) check that enemy units don't leave foundations. based on patch from Stork. fixes #724

comment:12 by sanderd17, 8 years ago

Keywords: review removed
Note: See TracTickets for help on using tickets.