Ticket #724 (closed defect: fixed)
[PATCH] Units should not move out of enemy construction zones
| Reported by: | k776 | Owned by: | Stork |
|---|---|---|---|
| Priority: | Must Have | Milestone: | Alpha 6 |
| Component: | Core engine | Keywords: | review |
| Cc: | Stork |
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
Change History
comment:1 Changed 2 years ago by k776
- Summary changed from Units should be polite in moving out of construction zones that belong to an enemy to Units should not move out of enemy construction zones
Changed 2 years ago by Stork
- Attachment diffContstruction.patch added
fixes some issues with diplomacy; units do not move out of the way for their enemies' constructions
comment:4 Changed 2 years ago by historic_bruno
- Summary changed from Units should not move out of enemy construction zones to [PATCH] Units should not move out of enemy construction zones
comment:6 in reply to: ↑ 3 ; follow-up: ↓ 7 Changed 2 years ago by historic_bruno
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).
comment:7 in reply to: ↑ 6 Changed 2 years ago by Stork
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 Changed 2 years ago by Philip
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:11 Changed 2 years ago by Badmadblacksad
- Status changed from new to closed
- Resolution set to fixed
