fix(network): prevent null multiplayer peer crashes offline/teardown and fix Nakama RPC session validation
This commit is contained in:
+9
-4
@@ -311,7 +311,7 @@ func on_thrown_landing(attacker: Node = null, intensity: float = 1.0):
|
||||
|
||||
# Disable movement/interaction logic temporarily
|
||||
var controller = get_node_or_null("TektonController")
|
||||
if controller and controller.get("timer"):
|
||||
if controller and is_instance_valid(controller) and controller.get("timer") and is_instance_valid(controller.timer):
|
||||
controller.timer.stop()
|
||||
|
||||
# Visual Shrink
|
||||
@@ -329,7 +329,7 @@ func on_thrown_landing(attacker: Node = null, intensity: float = 1.0):
|
||||
t.tween_property(mesh, "scale", base_scale * 0.5, 0.2).set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_BACK)
|
||||
|
||||
# Spawn tiles (as requested "tekton will spawn a tiles around that floor also")
|
||||
if is_multiplayer_authority():
|
||||
if is_inside_tree() and is_multiplayer_authority():
|
||||
spawn_tiles_around(int(8 * intensity))
|
||||
|
||||
# Floor Freeze (Visual/Instant - Run on all clients locally)
|
||||
@@ -341,7 +341,12 @@ func on_thrown_landing(attacker: Node = null, intensity: float = 1.0):
|
||||
temporarily_change_floor(current_position, 1, 6, 3.0)
|
||||
|
||||
# Wait 3.0 seconds
|
||||
await get_tree().create_timer(3.0).timeout
|
||||
var tree = get_tree() if is_inside_tree() else null
|
||||
if tree:
|
||||
await tree.create_timer(3.0).timeout
|
||||
else:
|
||||
is_recovering = false
|
||||
return
|
||||
|
||||
# Grow back
|
||||
for i in range(mesh_cache.size()):
|
||||
@@ -355,7 +360,7 @@ func on_thrown_landing(attacker: Node = null, intensity: float = 1.0):
|
||||
|
||||
# Resume AI
|
||||
if not is_multiplayer_authority() or not is_carried:
|
||||
if controller and controller.has_method("_start_timer"):
|
||||
if controller and is_instance_valid(controller) and controller.has_method("_start_timer"):
|
||||
controller._start_timer()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user