[Lua Feature] Dynamic Action Blocking/Allowing (similar to movement controls)

What would you like to see in Freeciv? Do you have a good idea what should be improved or how?
Post Reply
leo.priori
Posts: 38
Joined: Mon Jan 01, 2024 3:22 am

[Lua Feature] Dynamic Action Blocking/Allowing (similar to movement controls)

Post by leo.priori »

It would be awesome if we had a way to block and allow specific unit actions.
Of course, still respecting the [actionenabler_*] requirements, but maybe something similar to "movement_disallow()" and "movement_allow()".

Example:

action_disallow(unit, 'User Action 1')
action_allow(unit, 'Bombard 2')
Ignatus
Elite
Posts: 664
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: [Lua Feature] Dynamic Action Blocking/Allowing (similar to movement controls)

Post by Ignatus »

Likely we could handle this by adding a set of user-defined states (flags/promotions) for individual units and adding requirements like "UnitState", "MovementAllowed", "Local", TRUE to "Move" action enabler, and scripting like u:set_state"MovementAllowed" / u:unset_state"MovementAllowed". This could even interrupt the action being unset in action_started_unit_self callback.

I had a request for control over diplomatic meetings somewhere in another post on the forum. Maybe that can be done in a very similar manner, just with manipulating user flags in the table of player's diplomatic relations.
Post Reply