Page 1 of 1

Feature request: Unrefuelable units

Posted: Sun Oct 15, 2023 2:30 pm
by danau
I'm working on a ruleset where I would like to implement missiles as a combination of two different types of units:
- "transported missile"
- "launched missile"

The transported type is the default unit, and it gets converted into the launched type when the missile gets launched.
Nearly all functionality seems to exist to implement this, but the "launched missile" should only exist for 1 or 2 turns.
Fuel seems the natural way to limit the lifespan of this launched missile unit, except that the launched missile should not refuel in cities, but I didn't find any options to prevent a specific unit from refuelling in cities.
I checked existing rulesets (v3.0.6) looked at action_enablers, and checked the forum (http://forum.freeciv.org/f/viewtopic.php?p=103572 and http://forum.freeciv.org/f/viewtopic.php?p=102839 seemed somewhat related).

Re: Feature request: Unrefuelable units

Posted: Sun Oct 15, 2023 3:14 pm
by cazfi
Not sure if you could implement this by the Retire unit effect (the mechanism that makes barbarian leaders to disappear)

Re: Feature request: Unrefuelable units

Posted: Sun Oct 15, 2023 3:57 pm
by cazfi
cazfi wrote: Sun Oct 15, 2023 3:14 pm Not sure if you could implement this by the Retire unit effect (the mechanism that makes barbarian leaders to disappear)
Likely not, as there's no sensible requirement type to check how long it's since unit converted. Opened tickets to implement such requirement: osdn #48848 and its dependency osdn #48847

Re: Feature request: Unrefuelable units

Posted: Sun Oct 15, 2023 6:51 pm
by Ignatus
cazfi wrote: Sun Oct 15, 2023 3:14 pm Not sure if you could implement this by the Retire unit effect (the mechanism that makes barbarian leaders to disappear)
You can't since retirement does not work within 3 tiles from enemy units or cities. The "use it or lose it" design for launched missiles is a long problem still without a perfect solution, I would suggest tracking launch and subsequent removal by scripting.

Re: Feature request: Unrefuelable units

Posted: Sun Oct 15, 2023 8:04 pm
by danau
Thanks for opening the tickets; tracking the total lifetime of the unit (and putting a maximum on it) sounds like a proper solution.

A (lua) script to track launches is also possible (for human players). It's actually quite easy for launched missiles that only exist 1 turn; just remove all units of that type at the end of the turn (or beginning of the next turn).
The custom script will not work for AI-players, because we do need a way to communicate the "use it or lose it" nature of the launched missile to the AI.

Re: Feature request: Unrefuelable units

Posted: Sun Oct 15, 2023 9:29 pm
by Ignatus
danau wrote: Sun Oct 15, 2023 8:04 pm The custom script will not work for AI-players, because we do need a way to communicate the "use it or lose it" nature of the launched missile to the AI.
If I recall it well, AI's management of missiles includes little transportation on their own. Or we can tell the script to spare poor stupid AIs.