feat: Initialize the main game scene with core managers, UI, networking, and a new message bar system.
This commit is contained in:
+44
-3
@@ -611,7 +611,10 @@ func spawn_tekton_npc():
|
||||
var enhanced_gridmap = $EnhancedGridMap
|
||||
if not enhanced_gridmap: return
|
||||
|
||||
# Spawn 3 Tektons
|
||||
# Spawn Static Tektons (Bottom Right, Mid Right)
|
||||
spawn_static_tektons()
|
||||
|
||||
# Spawn 3 Roaming Tektons
|
||||
var spawned_count = 0
|
||||
var attempts = 0
|
||||
|
||||
@@ -640,7 +643,7 @@ func spawn_tekton_npc():
|
||||
func sync_spawn_tekton(pos: Vector2i, tekton_id: int):
|
||||
_create_tekton(pos, tekton_id)
|
||||
|
||||
func _create_tekton(pos: Vector2i, tekton_id: int):
|
||||
func _create_tekton(pos: Vector2i, tekton_id: int, is_static: bool = false):
|
||||
var node_name = "Tekton_%d" % tekton_id
|
||||
if has_node(node_name): return
|
||||
|
||||
@@ -654,7 +657,45 @@ func _create_tekton(pos: Vector2i, tekton_id: int):
|
||||
if has_node("EnhancedGridMap"):
|
||||
tekton.initialize(pos, $EnhancedGridMap)
|
||||
|
||||
print("[Main] Spawned Tekton at %s (ID: %d)" % [pos, tekton_id])
|
||||
# If Static, swap controller
|
||||
if is_static:
|
||||
var old_controller = tekton.get_node_or_null("TektonController")
|
||||
if old_controller:
|
||||
old_controller.queue_free()
|
||||
|
||||
var static_controller = load("res://scripts/static_tekton_controller.gd").new()
|
||||
static_controller.name = "StaticTektonController"
|
||||
tekton.add_child(static_controller)
|
||||
print("[Main] Spawned STATIC Tekton at %s (ID: %d)" % [pos, tekton_id])
|
||||
else:
|
||||
print("[Main] Spawned Tekton at %s (ID: %d)" % [pos, tekton_id])
|
||||
|
||||
func spawn_static_tektons():
|
||||
"""Spawn fixed static tektons (Bottom Right, Mid Right)."""
|
||||
if not multiplayer.is_server(): return
|
||||
var enhanced_gridmap = $EnhancedGridMap
|
||||
if not enhanced_gridmap: return
|
||||
|
||||
# Bottom Right (Max X, Max Y)
|
||||
if "columns" in enhanced_gridmap and "rows" in enhanced_gridmap:
|
||||
var cols = enhanced_gridmap.columns
|
||||
var rows = enhanced_gridmap.rows
|
||||
|
||||
# Bottom Right (Corner - 1)
|
||||
var pos_br = Vector2i(cols - 2, rows - 2)
|
||||
var id_br = 99001
|
||||
_create_tekton(pos_br, id_br, true)
|
||||
rpc("sync_spawn_static_tekton", pos_br, id_br)
|
||||
|
||||
# Mid Right
|
||||
var pos_mr = Vector2i(cols - 2, rows / 2)
|
||||
var id_mr = 99002
|
||||
_create_tekton(pos_mr, id_mr, true)
|
||||
rpc("sync_spawn_static_tekton", pos_mr, id_mr)
|
||||
|
||||
@rpc("call_remote", "reliable")
|
||||
func sync_spawn_static_tekton(pos: Vector2i, tekton_id: int):
|
||||
_create_tekton(pos, tekton_id, true)
|
||||
|
||||
|
||||
# =============================================================================
|
||||
|
||||
Reference in New Issue
Block a user