update scarcity
This commit is contained in:
+15
-3
@@ -877,11 +877,23 @@ func clear_spawn_highlights():
|
||||
enhanced_gridmap._update_cell_option_buttons()
|
||||
|
||||
func _find_random_spawn_position() -> Vector2i:
|
||||
if not enhanced_gridmap:
|
||||
print("Warning: No gridmap for random spawn")
|
||||
return Vector2i.ZERO
|
||||
|
||||
var available_positions = []
|
||||
|
||||
for spawn_pos in spawn_locations:
|
||||
if not is_position_occupied(spawn_pos):
|
||||
available_positions.append(spawn_pos)
|
||||
# Scan the grid for valid walkable floor tiles that are not occupied
|
||||
for x in range(enhanced_gridmap.columns):
|
||||
for z in range(enhanced_gridmap.rows):
|
||||
var pos = Vector2i(x, z)
|
||||
|
||||
# Check Floor 0 for walkable ground (Item 0)
|
||||
var ground_item = enhanced_gridmap.get_cell_item(Vector3i(x, 0, z))
|
||||
if ground_item == 0: # Assuming 0 is walkable ground
|
||||
# Check if position is occupied by another player
|
||||
if not is_position_occupied(pos):
|
||||
available_positions.append(pos)
|
||||
|
||||
if available_positions.size() > 0:
|
||||
var rng = RandomNumberGenerator.new()
|
||||
|
||||
Reference in New Issue
Block a user