fix(auto-play): use biome_id instead of get_terrain_flags for land tile detection

get_terrain_flags() calls DataLoader which fails in -s script context
due to class_name resolution order.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Natalie 2026-04-12 14:21:54 -07:00
parent 7a06d49bd7
commit 49e9a8caf1

View file

@ -441,14 +441,15 @@ func _find_node_by_name(node: Node, target_name: String) -> Node:
func _fix_start_positions(game_map: RefCounted, gs: Node) -> void:
## Find land tiles and assign start positions when mapgen fails to set them
var water_biomes: Array = ["ocean", "coast", "deep_ocean", "lake", "inland_sea", "reef"]
var land_tiles: Array[Vector2i] = []
for pos: Vector2i in game_map.tiles:
var tile: Resource = game_map.tiles[pos]
if tile == null:
continue
var flags: Array = tile.get_terrain_flags()
if "water" not in flags and "impassable" not in flags:
land_tiles.append(pos)
if tile.biome_id in water_biomes:
continue
land_tiles.append(pos)
if land_tiles.is_empty():
print(" WARNING: no land tiles found!")