add hud to joiners...

sync alittle better, so double damage isn't done.
This commit is contained in:
2026-01-11 04:02:21 +01:00
parent 92ac3df666
commit a43a17ed10
5 changed files with 56 additions and 13 deletions

View File

@@ -997,6 +997,9 @@ func _sync_dungeon(dungeon_data_sync: Dictionary, seed_value: int, level: int, h
# Note: Level number is shown via _sync_show_level_number RPC, not here
# This prevents duplicate displays and ensures consistent timing
# Load HUD on client (same as server does)
call_deferred("_load_hud")
# Sync existing dungeon to newly connected clients
if multiplayer.is_server():
# This shouldn't happen, but just in case
@@ -1441,7 +1444,17 @@ func _clear_level():
# Clear previous level data
print("GameWorld: Clearing previous level...")
# Clear tilemap layers
# Clear tilemap layers - ensure we get references from scene if they exist
var environment = get_node_or_null("Environment")
if environment:
var layer0 = environment.get_node_or_null("DungeonLayer0")
if layer0:
layer0.clear()
var layer_above = environment.get_node_or_null("TileMapLayerAbove")
if layer_above:
layer_above.clear()
# Also clear via stored references if they exist
if dungeon_tilemap_layer:
dungeon_tilemap_layer.clear()
if dungeon_tilemap_layer_above:
@@ -2414,7 +2427,7 @@ func _spawn_blocking_doors():
func _spawn_floor_switch(i_position: Vector2, required_weight: float, tile_x: int, tile_y: int, switch_type: String = "walk", switch_room: Dictionary = {}) -> Node:
# Spawn a floor switch using the scene file
# switch_type: "walk" for walk-on switch (weight 1), "pillar" for pillar switch (weight 5)
var switch_scene = preload("res://scenes/floor_switch.tscn")
var switch_scene = load("res://scenes/floor_switch.tscn")
if not switch_scene:
push_error("ERROR: Could not load floor_switch scene!")
return null