gd: open_gate

This commit is contained in:
Nordup 2023-05-23 23:36:19 +03:00
parent 0eda5b758d
commit a8c212ab1a
3 changed files with 5 additions and 23 deletions

View file

@ -1,21 +0,0 @@
extends Node
@export var gate_events: GateEvents
var gate_jump: String = "gate_jump"
func _ready() -> void:
gate_events.gate_entered.connect(connect_to_gate_signals)
func connect_to_gate_signals() -> void:
var root_node = get_child(0)
if root_node == null: Debug.logerr("Gate root node is null"); return
if root_node.has_signal(gate_jump):
root_node.connect(gate_jump, on_gate_jump)
func on_gate_jump(url: String) -> void:
url = Url.join(gate_events.current_gate_url, url)
gate_events.open_gate_emit(url)

View file

@ -17,7 +17,6 @@ func create_process(_gate: Gate) -> void:
var sandbox_path = "/home/nordup/projects/godot/the-gates-folder/the-gates/bin/godot.linuxbsd.editor.dev.sandbox.x86_64.llvm"
var pack_file = ProjectSettings.globalize_path(gate.resource_pack)
var main_pid = OS.get_process_id()
var args = [
"--main-pack", pack_file,

View file

@ -9,7 +9,7 @@ func _ready() -> void:
execute_function = _execute_function
func _physics_process(delta: float) -> void:
func _physics_process(_delta: float) -> void:
receive_commands()
@ -21,6 +21,10 @@ func _execute_function(command: Command) -> Variant:
"set_mouse_mode":
if command.args.size() != 1: push_error("Arg count should be 1"); return ""
command_events.set_mouse_mode_emit(command.args[0])
"open_gate":
if command.args.size() != 1: push_error("Arg count should be 1"); return ""
var url = Url.join(gate_events.current_gate_url, command.args[0])
gate_events.open_gate_emit(url)
_:
print("Command %s not implemented" % [command.name])
return ""