This commit is contained in:
2026-03-09 11:57:48 -07:00
parent 041c0ebbdb
commit 7203c843ec
10 changed files with 246 additions and 21 deletions

View File

@@ -123,18 +123,21 @@ func start_main_script(s):
ScriptBuilder.current_script = s
func _unhandled_input(event):
if event is InputEventMouseButton and event.is_action("interact"):
print (ego.position, pathfind.to_local(get_global_mouse_position()))
if event is InputEventMouseButton and Input.is_action_just_released("interact"):
# If a script is running and can't be interrupted, delegate to it
if ScriptBuilder.current_script and not ScriptBuilder.current_script.can_interrupt:
if ScriptBuilder.current_script.handle_input(event):
return
var root = get_node("/root/Node2D")
# If look cursor is active and we got here, no SetPiece handled the input
# so this is a room-wide look
if ActionState.current_action == ActionState.Action.LOOK:
_on_room_looked()
return
var path = NavigationServer2D.map_get_path(map, ego.position, pathfind.to_local(get_global_mouse_position()), true)
start_main_script(ScriptBuilder.init(ScriptBuilder.walk_path(ego, path)).can_interrupt().build(self, "_on_script_complete"))
pass
if ActionState.current_action == ActionState.Action.WALK:
var path = NavigationServer2D.map_get_path(map, ego.position, pathfind.to_local(get_global_mouse_position()), true)
start_main_script(ScriptBuilder.init(ScriptBuilder.walk_path(ego, path)).can_interrupt().build(self, "_on_script_complete"))
func _on_room_looked() -> void:
# Default room look description - override in room scripts