Add event prerequisite gates

This commit is contained in:
2026-06-18 14:04:06 +09:00
parent e76d7e3a7e
commit 8c4d7c8822
10 changed files with 153 additions and 8 deletions

View File

@@ -3585,6 +3585,8 @@ func _run_events(trigger_type: String, team := "", turn := -1, trigger_unit: Dic
continue
if trigger_type == "unit_reaches_tile" and not _unit_reaches_event_tile(trigger_unit, when):
continue
if not _event_gate_open(when):
continue
if not _campaign_flags_match(when.get("campaign_flags", {})):
continue
_execute_event_actions(event.get("actions", []), trigger_unit)
@@ -3604,6 +3606,13 @@ func _unit_reaches_event_tile(unit: Dictionary, when: Dictionary) -> bool:
return _unit_matches_condition_ids(unit, when.get("unit_ids", []), when.get("officer_ids", []))
func _event_gate_open(when: Dictionary) -> bool:
var after_event := str(when.get("after_event", ""))
if after_event.is_empty():
return true
return fired_event_ids.has(after_event)
func _campaign_flags_match(required_flags) -> bool:
if typeof(required_flags) != TYPE_DICTIONARY:
return true