mirror of
https://github.com/thegatesbrowser/thegates.git
synced 2025-08-23 08:17:34 -04:00
create/kill world process
This commit is contained in:
parent
6ea7db44c4
commit
1e6718b37d
2 changed files with 21 additions and 4 deletions
|
@ -15,8 +15,7 @@ func load_gate(config_url: String) -> void:
|
|||
c_gate = ConfigGate.new(config_path, config_url)
|
||||
|
||||
var image_path = await FileDownloader.download(c_gate.image_url)
|
||||
var gate = Gate.create(config_url, c_gate.title, c_gate.description,
|
||||
image_path, "", "", "")
|
||||
var gate = Gate.create(config_url, c_gate.title, c_gate.description, image_path, "", "", "")
|
||||
gate_events.gate_info_loaded_emit(gate)
|
||||
|
||||
gate.godot_config = await FileDownloader.download(c_gate.godot_config_url)
|
||||
|
|
|
@ -8,9 +8,12 @@ var gate: Gate
|
|||
var c_g_script: ConfigGlobalScript
|
||||
var c_godot: ConfigGodot
|
||||
|
||||
var pid: int
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
gate_events.gate_loaded.connect(load_pack)
|
||||
# gate_events.gate_loaded.connect(load_pack)
|
||||
gate_events.gate_loaded.connect(create_process)
|
||||
|
||||
|
||||
func load_pack(_gate: Gate) -> void:
|
||||
|
@ -40,5 +43,20 @@ func unload_pack() -> void:
|
|||
if c_g_script != null: c_g_script.unload_config()
|
||||
|
||||
|
||||
func create_process(_gate: Gate) -> void:
|
||||
gate = _gate
|
||||
|
||||
var pack_file = ProjectSettings.globalize_path(gate.resource_pack)
|
||||
var args = ["--main-pack", pack_file]
|
||||
print("./godot " + " ".join(args))
|
||||
pid = OS.create_instance(args)
|
||||
|
||||
|
||||
func kill_process() -> void:
|
||||
if OS.is_process_running(pid):
|
||||
OS.kill(pid)
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
unload_pack()
|
||||
# unload_pack()
|
||||
kill_process()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue