Opened 9 years ago
Last modified 3 years ago
#3412 new enhancement
[PATCH] Fix templates of non-garrisonable units
Reported by: | elexis | Owned by: | |
---|---|---|---|
Priority: | Nice to Have | Milestone: | Backlog |
Component: | Simulation | Keywords: | patch |
Cc: | Patch: |
Description (last modified by )
The original idea of this ticket was to hide the garrison-button for non-garrisonable units. But since that doesn't seem nicely achievable, we might want to fix those two related bugs identified in the course of this ticket:
Some units can't be garrissoned anywhere and have incoherent garrisson usage:
- Sheep
Currently
UnitAI
can't deal with garrisoning animals. Hence it has a hardcoded disabling of animals. The GUI still draws the garrison cursor for sheep, which should not happen.
- The worker elephant can be garrisoned in temples, towers, outposts and other buildings that don't make sense (see #3611). It should be coherent with war-elephants, i.e. garrisonable only in buildings that make sense (#3135) or nowhere (#4030).
Due to these circumstances it seems appropriate to add a new boolean property
IsGarrisonable
to the templates which is true for all units except for those mentioned above.
Attachments (2)
Change History (13)
by , 8 years ago
Attachment: | ships.diff added |
---|
comment:1 by , 8 years ago
comment:2 by , 8 years ago
Keywords: | review patch added |
---|---|
Milestone: | Backlog → Alpha 20 |
Summary: | Hide garrisson button for ships → [PATCH] Hide garrisson button for ships |
comment:3 by , 8 years ago
Description: | modified (diff) |
---|---|
Keywords: | simple review removed |
Milestone: | Alpha 20 → Backlog |
Summary: | [PATCH] Hide garrisson button for ships → [PATCH] Hide garrisson button for ungarrisonable units |
Hi, thanks for your participation and looking at that big UnitAI maze!
After looking at your patch I added some more points to the ticket description on how this should be fixed.
With regards to your patch:
- Don't change
UnitAI.canGarrison
to work with and without argument. It would be more clear to add a new functionIsGarrisonable
instead that takes no argument. This should be implemented in the templates. Maybe UnitAI can be left untouched.
- Minor detail: it'd be more coherent if you use
var cmpIdentity =
... and then checkif (cmpIdentity.hasClass("Ship"))
comment:4 by , 8 years ago
Okay no worries I'll look into making those changes and moving the behaviour into the templates.
by , 8 years ago
Attachment: | ship-template.diff added |
---|
comment:5 by , 8 years ago
Added an updated diff that adds the CanGarrison
template tag. I have added it to the applicable templates and testing seems to run okay. I disabled it for all fauna and decorative fauna for now. I'm not sure about the workings of the elephant situation but it should be easy enough to add the correct tags to the templates in question.
follow-up: 7 comment:6 by , 8 years ago
Keywords: | review added |
---|
(not sure if I am supposed to add review back for the new patch, apologies if this isn't the right step, instructions didn't say)
comment:7 by , 8 years ago
Description: | modified (diff) |
---|---|
Keywords: | review removed |
Summary: | [PATCH] Hide garrisson button for ungarrisonable units → [PATCH] Fix templates of non-garrisonable units |
Replying to smitec:
(not sure if I am supposed to add review back for the new patch, apologies if this isn't the right step, instructions didn't say)
Adding review is fine if you upload an updated patch.
Review:
We discussed the patch and decided that adding a canGarrison
flag to the templates is not ideal, since every unit might be garrisonable at some point and it also means having "canGarrison" logic in two complex components (UnitAI
and GarrisonHolder
).
It is probably not nicely achievable to find out whether a given unit (ship, animal) is garrisonable in any of all buildings that can appear on a map. Hiding the button is likely not achievable. Sorry for changing the mind.
Todo: Updating the templates in those two places should still be done:
- Since animals can't be garrisoned due to UnitAI, the
GarrisonHolder
entry should be removed as well (I'll do that now).
- The worker elephant shouldn't be garrisonable in places that don't fit.
comment:9 by , 5 years ago
Component: | UI & Simulation → Simulation |
---|
Move tickets to Simulation
as UI & Simulation
got some sub components.
comment:10 by , 4 years ago
Description: | modified (diff) |
---|
Following r23409, the UnitAI restriction to not allow animals to be garrisoned was lifted.
comment:11 by , 3 years ago
Description: | modified (diff) |
---|
So I have removed the garrison button from ships by checking if units have the class Ship but I feel this may be better handled in a way similar to guarding where
<CanGarrison>
becomes a tag in the templates.