progresS
This commit is contained in:
15
Scene.gd
15
Scene.gd
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user