mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-05 07:49:17 +07:00
Only allow a trigger-based unit action if the trigger function is not null
Tested with "Adopt [Legalism] <for [0] movement>" - it allows me to click once, adopting the policy, but not a second time since the policy is already adopted thus the trigger function is null
This commit is contained in:
@ -199,10 +199,14 @@ object UnitActionsFromUniques {
|
||||
}
|
||||
val title = UnitActionModifiers.actionTextWithSideEffects(baseTitle, unique, unit)
|
||||
|
||||
yield(UnitAction(UnitActionType.TriggerUnique, title) {
|
||||
val triggerFunction = UniqueTriggerActivation.getTriggerFunction(unique, unit.civ, unit = unit, tile = unit.currentTile)
|
||||
val unitAction = if (triggerFunction == null) null else
|
||||
{ -> // This is the *action* that will be triggered!
|
||||
UniqueTriggerActivation.triggerUnique(unique, unit)
|
||||
UnitActionModifiers.activateSideEffects(unit, unique)
|
||||
})
|
||||
}
|
||||
|
||||
yield(UnitAction(UnitActionType.TriggerUnique, title, action = unitAction))
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user