feat: Implement the main game scene, initializing core managers, a new message bar system, and a pre-game countdown.
This commit is contained in:
@@ -408,6 +408,11 @@ func _randomize_tiles_around_player(player: Node):
|
||||
# Check if position is valid
|
||||
if not enhanced_gridmap.is_position_valid(pos):
|
||||
continue
|
||||
|
||||
# EXTRA CHECK: Do not spawn tiles on void (-1) or walls (4) on Floor 0
|
||||
var floor_0_item = enhanced_gridmap.get_cell_item(Vector3i(pos.x, 0, pos.y))
|
||||
if floor_0_item == -1 or floor_0_item == 4:
|
||||
continue
|
||||
|
||||
# Check if there are tiles nearby or if empty
|
||||
var current_item = enhanced_gridmap.get_cell_item(cell)
|
||||
|
||||
@@ -11,11 +11,15 @@ extends StaticBody3D
|
||||
|
||||
func _ready():
|
||||
add_to_group("StaticTektonStands")
|
||||
print("Static Stand Ready: ", name)
|
||||
print("Static Stand Ready: ", name)
|
||||
|
||||
# Clear 3x3 local GridMap void for late joiners
|
||||
call_deferred("_clear_local_gridmap_area")
|
||||
|
||||
if multiplayer.is_server():
|
||||
# Only randomize if not already set (Main.gd sets it now)
|
||||
if shape_index == -1:
|
||||
shape_index = randi() % 4
|
||||
shape_index = randi() % 4
|
||||
_update_mesh_from_index()
|
||||
else:
|
||||
# Client side:
|
||||
@@ -27,6 +31,29 @@ func _ready():
|
||||
# But just in case, we can try to request it or use a default
|
||||
pass
|
||||
|
||||
func _clear_local_gridmap_area():
|
||||
var main = get_tree().get_root().get_node_or_null("Main")
|
||||
if not main: return
|
||||
var gridmap = main.get_node_or_null("EnhancedGridMap")
|
||||
if not gridmap or not "cell_size" in gridmap: return
|
||||
|
||||
var grid_x = int(round((global_position.x - gridmap.cell_size.x / 2.0) / gridmap.cell_size.x))
|
||||
var grid_z = int(round((global_position.z - gridmap.cell_size.z / 2.0) / gridmap.cell_size.z))
|
||||
|
||||
var floor_count = 3
|
||||
if "floors" in gridmap: floor_count = gridmap.floors
|
||||
|
||||
for dx in range(-1, 2):
|
||||
for dy in range(-1, 2):
|
||||
for f in range(floor_count):
|
||||
gridmap.set_cell_item(Vector3i(grid_x + dx, f, grid_z + dy), -1)
|
||||
|
||||
# Force pathfinding update if methods exist
|
||||
if gridmap.has_method("update_grid_data"):
|
||||
gridmap.update_grid_data()
|
||||
if gridmap.has_method("update_astar_costs"):
|
||||
gridmap.update_astar_costs()
|
||||
|
||||
func _update_mesh_from_index():
|
||||
if not mesh_instance: return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user