feat: Add initial main scene with grid map, UI, touch controls, and core game logic scripts.

This commit is contained in:
Yogi Wiguna
2026-02-18 11:50:10 +08:00
parent 489e31fb39
commit 446e142a29
4 changed files with 12 additions and 19 deletions
+5 -15
View File
@@ -697,13 +697,16 @@ func _create_tekton(pos: Vector2i, tekton_id: int, is_static: bool = false):
add_child(tekton) add_child(tekton)
# Initialize # Initialize
if is_static:
tekton.is_static_turret = true
if tekton.has_method("initialize"): if tekton.has_method("initialize"):
if has_node("EnhancedGridMap"): if has_node("EnhancedGridMap"):
tekton.initialize(pos, $EnhancedGridMap) tekton.initialize(pos, $EnhancedGridMap)
# If Static, swap controller # If Static, swap controller
if is_static: if is_static:
tekton.is_static_turret = true # tekton.is_static_turret = true # Already set above
var old_controller = tekton.get_node_or_null("TektonController") var old_controller = tekton.get_node_or_null("TektonController")
if old_controller: if old_controller:
@@ -760,10 +763,7 @@ func spawn_static_tektons():
# Pick Shape on Server (0:Cyl, 1:Box, 2:Prism, 3:Sphere) # Pick Shape on Server (0:Cyl, 1:Box, 2:Prism, 3:Sphere)
var shape_idx = randi() % 4 var shape_idx = randi() % 4
# Spawn on Server # Spawn on Server AND Sync to Clients (call_local handles both)
_create_static_setup(pos, id, shape_idx)
# Sync to Clients
rpc("sync_spawn_static_setup", pos, id, shape_idx) rpc("sync_spawn_static_setup", pos, id, shape_idx)
@rpc("call_local", "reliable") @rpc("call_local", "reliable")
@@ -838,16 +838,6 @@ func _create_static_setup(pos: Vector2i, tekton_id: int, shape_idx: int):
if not has_node("Tekton_%d" % tekton_id): if not has_node("Tekton_%d" % tekton_id):
_create_tekton(pos, tekton_id, true) _create_tekton(pos, tekton_id, true)
# Force Tekton height UP to sit on stand on ALL peers
var tekton = get_node_or_null("Tekton_%d" % tekton_id)
if tekton:
var height_offset = 0.6
# If Sphere (Index 3), it is taller (Dome)
if shape_idx == 3:
height_offset = 1.3
tekton.position.y += height_offset
# ============================================================================= # =============================================================================
-1
View File
@@ -97,7 +97,6 @@ columns = 14
rows = 14 rows = 14
floors = 2 floors = 2
auto_randomize = true auto_randomize = true
immutable_items = null
metadata/_editor_floor_ = Vector3(0, 1, 0) metadata/_editor_floor_ = Vector3(0, 1, 0)
[node name="Camera3D" type="Camera3D" parent="." unique_id=1200003163] [node name="Camera3D" type="Camera3D" parent="." unique_id=1200003163]
+1 -2
View File
@@ -32,8 +32,7 @@ func _update_mesh_from_index():
var shapes = [ var shapes = [
_create_cylinder(), _create_cylinder(),
_create_box(), _create_box()
_create_sphere()
] ]
var idx = shape_index % shapes.size() var idx = shape_index % shapes.size()
+6 -1
View File
@@ -42,7 +42,12 @@ func update_visual_position():
# Side offset: place it near the edge # Side offset: place it near the edge
# Using NW corner (+0.2, +0.2) instead of center (+0.5, +0.5) # Using NW corner (+0.2, +0.2) instead of center (+0.5, +0.5)
position = Vector3(current_position.x + 0.2, floor_y, current_position.y + 0.2) var offset = 0.2
if is_static_turret:
offset = 0.5
floor_y = 0.6
position = Vector3(current_position.x + offset, floor_y, current_position.y + offset)
func move_to(target_pos: Vector2i): func move_to(target_pos: Vector2i):
if is_moving or is_carried or is_thrown: return if is_moving or is_carried or is_thrown: return