mirror of
https://github.com/thegatesbrowser/thegates.git
synced 2025-08-23 17:17:31 -04:00
gate is not responding
This commit is contained in:
parent
83406350c0
commit
4fc2d7aeb9
7 changed files with 77 additions and 19 deletions
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=33 format=3 uid="uid://kywrsqro3d5i"]
|
[gd_scene load_steps=34 format=3 uid="uid://kywrsqro3d5i"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scripts/loading/gate_loader.gd" id="1_uxhy6"]
|
[ext_resource type="Script" path="res://scripts/loading/gate_loader.gd" id="1_uxhy6"]
|
||||||
[ext_resource type="Resource" uid="uid://b1xvdym0qh6td" path="res://resources/gate_events.res" id="2_q7cvi"]
|
[ext_resource type="Resource" uid="uid://b1xvdym0qh6td" path="res://resources/gate_events.res" id="2_q7cvi"]
|
||||||
|
@ -13,6 +13,7 @@
|
||||||
[ext_resource type="Shader" path="res://shaders/render_result.gdshader" id="10_2auwe"]
|
[ext_resource type="Shader" path="res://shaders/render_result.gdshader" id="10_2auwe"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cykx425p6ylwr" path="res://assets/textures/background.png" id="10_23bjc"]
|
[ext_resource type="Texture2D" uid="uid://cykx425p6ylwr" path="res://assets/textures/background.png" id="10_23bjc"]
|
||||||
[ext_resource type="Script" path="res://scripts/sandbox/command_sync.gd" id="10_cqo55"]
|
[ext_resource type="Script" path="res://scripts/sandbox/command_sync.gd" id="10_cqo55"]
|
||||||
|
[ext_resource type="Script" path="res://scripts/sandbox/process_checker.gd" id="11_72cjp"]
|
||||||
[ext_resource type="Script" path="res://scripts/ui/world/world_ui.gd" id="12_jdwjt"]
|
[ext_resource type="Script" path="res://scripts/ui/world/world_ui.gd" id="12_jdwjt"]
|
||||||
[ext_resource type="Script" path="res://scripts/ui/world/splash_screen.gd" id="13_3b6nd"]
|
[ext_resource type="Script" path="res://scripts/ui/world/splash_screen.gd" id="13_3b6nd"]
|
||||||
[ext_resource type="Script" path="res://scripts/ui/world/gate_info.gd" id="14_8hca5"]
|
[ext_resource type="Script" path="res://scripts/ui/world/gate_info.gd" id="14_8hca5"]
|
||||||
|
@ -305,6 +306,22 @@ render_result = NodePath("../HBoxContainer/WorldCanvas/RenderResult")
|
||||||
snbx_executable = ExtResource("4_shus3")
|
snbx_executable = ExtResource("4_shus3")
|
||||||
snbx_env = ExtResource("8_a6dvr")
|
snbx_env = ExtResource("8_a6dvr")
|
||||||
|
|
||||||
|
[node name="InputSync" type="Node" parent="." node_paths=PackedStringArray("render_result")]
|
||||||
|
script = ExtResource("8_1blsi")
|
||||||
|
gate_events = ExtResource("2_q7cvi")
|
||||||
|
ui_events = ExtResource("9_ir58h")
|
||||||
|
render_result = NodePath("../HBoxContainer/WorldCanvas/RenderResult")
|
||||||
|
|
||||||
|
[node name="CommandSync" type="CommandSync" parent="."]
|
||||||
|
script = ExtResource("10_cqo55")
|
||||||
|
gate_events = ExtResource("2_q7cvi")
|
||||||
|
command_events = ExtResource("6_18mgg")
|
||||||
|
|
||||||
|
[node name="ProcessChecker" type="Node" parent="."]
|
||||||
|
script = ExtResource("11_72cjp")
|
||||||
|
gate_events = ExtResource("2_q7cvi")
|
||||||
|
command_events = ExtResource("6_18mgg")
|
||||||
|
|
||||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||||
custom_minimum_size = Vector2(0, 700)
|
custom_minimum_size = Vector2(0, 700)
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
|
@ -366,17 +383,6 @@ grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
focus_mode = 0
|
focus_mode = 0
|
||||||
|
|
||||||
[node name="InputSync" type="Node" parent="HBoxContainer/WorldCanvas" node_paths=PackedStringArray("render_result")]
|
|
||||||
script = ExtResource("8_1blsi")
|
|
||||||
gate_events = ExtResource("2_q7cvi")
|
|
||||||
ui_events = ExtResource("9_ir58h")
|
|
||||||
render_result = NodePath("../RenderResult")
|
|
||||||
|
|
||||||
[node name="CommandSync" type="CommandSync" parent="HBoxContainer/WorldCanvas"]
|
|
||||||
script = ExtResource("10_cqo55")
|
|
||||||
gate_events = ExtResource("2_q7cvi")
|
|
||||||
command_events = ExtResource("6_18mgg")
|
|
||||||
|
|
||||||
[node name="Spacing" type="Control" parent="HBoxContainer"]
|
[node name="Spacing" type="Control" parent="HBoxContainer"]
|
||||||
custom_minimum_size = Vector2(50, 0)
|
custom_minimum_size = Vector2(50, 0)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
|
@ -4,6 +4,7 @@ class_name CommandEvents
|
||||||
signal send_filehandle(filehandle_path: String)
|
signal send_filehandle(filehandle_path: String)
|
||||||
signal ext_texture_format(format: RenderingDevice.DataFormat)
|
signal ext_texture_format(format: RenderingDevice.DataFormat)
|
||||||
signal set_mouse_mode(mode: int)
|
signal set_mouse_mode(mode: int)
|
||||||
|
signal heartbeat()
|
||||||
|
|
||||||
|
|
||||||
func send_filehandle_emit(filehandle_path: String) -> void:
|
func send_filehandle_emit(filehandle_path: String) -> void:
|
||||||
|
@ -16,3 +17,7 @@ func ext_texture_format_emit(format: RenderingDevice.DataFormat) -> void:
|
||||||
|
|
||||||
func set_mouse_mode_emit(mode: int) -> void:
|
func set_mouse_mode_emit(mode: int) -> void:
|
||||||
set_mouse_mode.emit(mode)
|
set_mouse_mode.emit(mode)
|
||||||
|
|
||||||
|
|
||||||
|
func heartbeat_emit() -> void:
|
||||||
|
heartbeat.emit()
|
||||||
|
|
|
@ -8,6 +8,7 @@ signal gate_info_loaded(gate: Gate, is_cached: bool)
|
||||||
signal gate_loaded(gate: Gate)
|
signal gate_loaded(gate: Gate)
|
||||||
signal gate_entered
|
signal gate_entered
|
||||||
signal first_frame
|
signal first_frame
|
||||||
|
signal not_responding
|
||||||
signal exit_gate
|
signal exit_gate
|
||||||
|
|
||||||
signal download_progress(url: String, body_size: int, downloaded_bytes: int)
|
signal download_progress(url: String, body_size: int, downloaded_bytes: int)
|
||||||
|
@ -62,6 +63,10 @@ func first_frame_emit() -> void:
|
||||||
first_frame.emit()
|
first_frame.emit()
|
||||||
|
|
||||||
|
|
||||||
|
func not_responding_emit() -> void:
|
||||||
|
not_responding.emit()
|
||||||
|
|
||||||
|
|
||||||
func exit_gate_emit() -> void:
|
func exit_gate_emit() -> void:
|
||||||
current_search_query = ""
|
current_search_query = ""
|
||||||
current_gate_url = ""
|
current_gate_url = ""
|
||||||
|
|
|
@ -3,6 +3,8 @@ extends CommandSync
|
||||||
@export var gate_events: GateEvents
|
@export var gate_events: GateEvents
|
||||||
@export var command_events: CommandEvents
|
@export var command_events: CommandEvents
|
||||||
|
|
||||||
|
var silent_commands = ["heartbeat"]
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
gate_events.gate_entered.connect(bind)
|
gate_events.gate_entered.connect(bind)
|
||||||
|
@ -14,7 +16,9 @@ func _physics_process(_delta: float) -> void:
|
||||||
|
|
||||||
|
|
||||||
func _execute_function(command: Command) -> Variant:
|
func _execute_function(command: Command) -> Variant:
|
||||||
|
if command.name not in silent_commands:
|
||||||
Debug.logclr("Recieved command: " + command.name + ". Args: " + str(command.args), Color.SANDY_BROWN)
|
Debug.logclr("Recieved command: " + command.name + ". Args: " + str(command.args), Color.SANDY_BROWN)
|
||||||
|
|
||||||
match command.name:
|
match command.name:
|
||||||
"send_filehandle":
|
"send_filehandle":
|
||||||
if wrong_args_count(command, 1): return ERR_INVALID_PARAMETER
|
if wrong_args_count(command, 1): return ERR_INVALID_PARAMETER
|
||||||
|
@ -24,10 +28,14 @@ func _execute_function(command: Command) -> Variant:
|
||||||
if wrong_args_count(command, 1): return ERR_INVALID_PARAMETER
|
if wrong_args_count(command, 1): return ERR_INVALID_PARAMETER
|
||||||
command_events.ext_texture_format_emit(command.args[0])
|
command_events.ext_texture_format_emit(command.args[0])
|
||||||
|
|
||||||
"first_frame_drawn":
|
"first_frame":
|
||||||
if wrong_args_count(command, 0): return ERR_INVALID_PARAMETER
|
if wrong_args_count(command, 0): return ERR_INVALID_PARAMETER
|
||||||
gate_events.first_frame_emit()
|
gate_events.first_frame_emit()
|
||||||
|
|
||||||
|
"heartbeat":
|
||||||
|
if wrong_args_count(command, 0): return ERR_INVALID_PARAMETER
|
||||||
|
command_events.heartbeat_emit()
|
||||||
|
|
||||||
"set_mouse_mode":
|
"set_mouse_mode":
|
||||||
if wrong_args_count(command, 1): return ERR_INVALID_PARAMETER
|
if wrong_args_count(command, 1): return ERR_INVALID_PARAMETER
|
||||||
command_events.set_mouse_mode_emit(command.args[0])
|
command_events.set_mouse_mode_emit(command.args[0])
|
||||||
|
|
|
@ -15,15 +15,15 @@ func _ready() -> void:
|
||||||
gate_events.gate_entered.connect(start_server)
|
gate_events.gate_entered.connect(start_server)
|
||||||
ui_events.ui_mode_changed.connect(on_ui_mode_changed)
|
ui_events.ui_mode_changed.connect(on_ui_mode_changed)
|
||||||
|
|
||||||
scale_width = float(render_result.width) / ui_events.current_ui_size.x
|
|
||||||
scale_height = float(render_result.height) / ui_events.current_ui_size.y
|
|
||||||
Debug.logclr("Mouse position scale: %.2fx%.2f" % [scale_width, scale_height], Color.DIM_GRAY)
|
|
||||||
|
|
||||||
|
|
||||||
func start_server() -> void:
|
func start_server() -> void:
|
||||||
input_sync = InputSync.new()
|
input_sync = InputSync.new()
|
||||||
input_sync.bind()
|
input_sync.bind()
|
||||||
|
|
||||||
|
scale_width = float(render_result.width) / ui_events.current_ui_size.x
|
||||||
|
scale_height = float(render_result.height) / ui_events.current_ui_size.y
|
||||||
|
Debug.logclr("Mouse position scale: %.2fx%.2f" % [scale_width, scale_height], Color.DIM_GRAY)
|
||||||
|
|
||||||
|
|
||||||
func on_ui_mode_changed(mode: UiEvents.UiMode) -> void:
|
func on_ui_mode_changed(mode: UiEvents.UiMode) -> void:
|
||||||
should_send = mode == UiEvents.UiMode.FULL_SCREEN
|
should_send = mode == UiEvents.UiMode.FULL_SCREEN
|
||||||
|
|
34
app/scripts/sandbox/process_checker.gd
Normal file
34
app/scripts/sandbox/process_checker.gd
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
@export var gate_events: GateEvents
|
||||||
|
@export var command_events: CommandEvents
|
||||||
|
|
||||||
|
# Timeout interval for child process responsiveness
|
||||||
|
const BOOTUP_INTERVAL = 30
|
||||||
|
const HEARTBEAT_INTERVAL = 5
|
||||||
|
const WAIT_INTERVAL = 30
|
||||||
|
|
||||||
|
var timer: Timer
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
timer = Timer.new()
|
||||||
|
add_child(timer)
|
||||||
|
timer.timeout.connect(on_timeout)
|
||||||
|
|
||||||
|
gate_events.gate_entered.connect(start_bootup_timer)
|
||||||
|
command_events.heartbeat.connect(restart_heartbeat_timer)
|
||||||
|
|
||||||
|
|
||||||
|
func start_bootup_timer() -> void:
|
||||||
|
timer.start(BOOTUP_INTERVAL)
|
||||||
|
|
||||||
|
|
||||||
|
func restart_heartbeat_timer() -> void:
|
||||||
|
timer.start(HEARTBEAT_INTERVAL)
|
||||||
|
|
||||||
|
|
||||||
|
func on_timeout() -> void:
|
||||||
|
Debug.logerr("Gate is not responding")
|
||||||
|
gate_events.not_responding_emit()
|
||||||
|
timer.start(WAIT_INTERVAL)
|
2
godot
2
godot
|
@ -1 +1 @@
|
||||||
Subproject commit f51caa6d0deba8abd21e7ccaf09ad1edbca604c1
|
Subproject commit 8fa7f8db356dd32f8a8404cadab8d3980c05516c
|
Loading…
Add table
Add a link
Reference in a new issue