Make opening lure line wake front sentries

This commit is contained in:
2026-06-20 09:33:46 +09:00
parent bd0b7a238e
commit c41906832c
7 changed files with 103 additions and 19 deletions

View File

@@ -4620,6 +4620,8 @@ func _execute_event_action(action: Dictionary, trigger_unit: Dictionary = {}) ->
return
for unit_id in unit_ids:
_withdraw_event_unit(str(unit_id))
elif action_type == "set_ai_awake":
_set_event_ai_awake(action)
elif action_type == "set_ai_target_priority":
_set_event_ai_target_priority(action)
@@ -4690,6 +4692,35 @@ func _set_event_ai_target_priority(action: Dictionary) -> void:
_notify_changed()
func _set_event_ai_awake(action: Dictionary) -> void:
var unit_ids := _event_action_unit_ids(action)
if unit_ids.is_empty():
push_error("Skipping AI awake event with no unit ids in %s." % battle_id)
return
var awake := bool(action.get("awake", true))
var changed_units: Array[Dictionary] = []
for unit_id in unit_ids:
var unit := get_unit(unit_id)
if unit.is_empty():
push_error("Skipping unknown AI awake unit %s in %s." % [unit_id, battle_id])
continue
var was_awake := bool(unit.get("ai_awake", false))
unit["ai_awake"] = awake
if was_awake != awake:
changed_units.append(unit)
if changed_units.is_empty():
return
if not bool(action.get("silent", false)):
var text := str(action.get("text", "")).strip_edges()
if text.is_empty():
text = "적 초소병의 움직임이 바뀌었다." if awake else "적 초소병이 다시 경계 위치에 머문다."
_emit_log(text)
for unit in changed_units:
if bool(unit.get("alive", false)) and bool(unit.get("deployed", true)):
_emit_combat_feedback(unit, "경계" if awake else "대기", "priority")
_notify_changed()
func _event_action_unit_ids(action: Dictionary) -> Array[String]:
var result: Array[String] = []
if action.has("unit_ids") and typeof(action["unit_ids"]) == TYPE_ARRAY: