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')
[Lua Feature] Dynamic Action Blocking/Allowing (similar to movement controls)
-
leo.priori
- Posts: 38
- Joined: Mon Jan 01, 2024 3:22 am
Re: [Lua Feature] Dynamic Action Blocking/Allowing (similar to movement controls)
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.
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.