- Added waypoint context updates to handle action queue statuses in `waypoint_context.gd`. - Introduced new scene file `manwalk.scene` with terrain and stickman setup. - Created architecture summary for the Live Director System detailing core state transitions, physics mechanics, UI elements, and action execution. - Specified class contracts and interfaces for the Live Director implementation in `phase_12_live_director.md`. - Defined state transitions, input handling, and queue editing mechanics for the Live Director feature.
41 lines
1.8 KiB
GDScript
41 lines
1.8 KiB
GDScript
class_name WaypointContext
|
|
extends PopupMenu
|
|
## WaypointContext - Right-click context menu for a walk_to waypoint (Phase 3c.3).
|
|
##
|
|
## Provides Edit/Delete/Insert actions for the waypoint's walk action plus a
|
|
## "Edit Trigger Rules" entry (shown only when rules target this waypoint).
|
|
|
|
const EDIT_WALK := 0
|
|
const DELETE_WALK := 1
|
|
const INSERT_BEFORE := 2
|
|
const INSERT_AFTER := 3
|
|
const EDIT_TRIGGER_RULES := 4
|
|
const ACTION_RUNNER := preload("res://scripts/stickman_action_runner.gd")
|
|
|
|
const _EDIT_TRIGGER_IDX := 5 # item position of the trigger-rules entry (after a separator at 4)
|
|
|
|
|
|
func _init() -> void:
|
|
# _init runs before the node is in the tree; item order is fixed here.
|
|
add_item("✎ Edit this Walk", EDIT_WALK)
|
|
add_item("✕ Delete this Walk", DELETE_WALK)
|
|
add_item("⬆ Insert action before", INSERT_BEFORE)
|
|
add_item("⬇ Insert action after", INSERT_AFTER)
|
|
add_separator()
|
|
add_item("⚡ Edit Trigger Rules", EDIT_TRIGGER_RULES)
|
|
|
|
|
|
## Updates the trigger-rules entry (count / enabled) and pops up at `rect`.
|
|
func popup_for(rect: Rect2i, trigger_rule_count: int, queue_status: int = ACTION_RUNNER.QueueStatus.NOT_STARTED) -> void:
|
|
var consumed: bool = queue_status == ACTION_RUNNER.QueueStatus.COMPLETED or queue_status == ACTION_RUNNER.QueueStatus.INTERRUPTED
|
|
set_item_disabled(get_item_index(EDIT_WALK), consumed)
|
|
set_item_disabled(get_item_index(INSERT_BEFORE), consumed or queue_status == ACTION_RUNNER.QueueStatus.ACTIVE)
|
|
set_item_disabled(get_item_index(INSERT_AFTER), consumed)
|
|
if trigger_rule_count > 0:
|
|
set_item_text(_EDIT_TRIGGER_IDX, "⚡ Edit Trigger Rules (%d rule%s)" % [trigger_rule_count, "" if trigger_rule_count == 1 else "s"])
|
|
set_item_disabled(_EDIT_TRIGGER_IDX, false)
|
|
else:
|
|
set_item_text(_EDIT_TRIGGER_IDX, "⚡ Edit Trigger Rules")
|
|
set_item_disabled(_EDIT_TRIGGER_IDX, true)
|
|
popup(rect)
|