fix double spawn
This commit is contained in:
@@ -823,6 +823,11 @@ func _get_static_spawn_chunk_root_from_point(spawn_point: Node) -> Node:
|
||||
|
||||
return null
|
||||
|
||||
func _get_static_entity_spawn_key(spawn_root: Node) -> String:
|
||||
if spawn_root.scene_file_path != "":
|
||||
return spawn_root.scene_file_path
|
||||
return "instance:%s" % spawn_root.get_instance_id()
|
||||
|
||||
func _spawn_entities_for_static_spawn_points() -> void:
|
||||
var current_scene = get_tree().current_scene
|
||||
if current_scene == null:
|
||||
@@ -849,14 +854,14 @@ func _spawn_entities_for_static_obstacle(root: Node, grid_pos: Vector2i) -> void
|
||||
if spawn_root == null or not is_instance_valid(spawn_root):
|
||||
return
|
||||
|
||||
var root_id: int = spawn_root.get_instance_id()
|
||||
if static_entity_spawn_roots.has(root_id):
|
||||
var tracked_root = static_entity_spawn_roots[root_id]
|
||||
var root_key: String = _get_static_entity_spawn_key(spawn_root)
|
||||
if static_entity_spawn_roots.has(root_key):
|
||||
var tracked_root = static_entity_spawn_roots[root_key]
|
||||
if is_instance_valid(tracked_root):
|
||||
return
|
||||
static_entity_spawn_roots.erase(root_id)
|
||||
static_entity_spawn_roots.erase(root_key)
|
||||
|
||||
static_entity_spawn_roots[root_id] = spawn_root
|
||||
static_entity_spawn_roots[root_key] = spawn_root
|
||||
_spawn_entities_for_chunk(spawn_root, _choose_biome_name_by_cell(grid_pos))
|
||||
|
||||
func _spawn_entities_for_chunk(root: Node, biome_name: String) -> void:
|
||||
|
||||
@@ -592,29 +592,29 @@ texture_emission = ExtResource("41_2y8tt")
|
||||
emission_energy = 5.0
|
||||
modulate = Color(0.9886375, 0.7964691, 0.64222336, 1)
|
||||
|
||||
[node name="NavigationRegion3D3" type="NavigationRegion3D" parent="." index="51" unique_id=464562369]
|
||||
transform = Transform3D(0.227, 0, 0, 0, 0.227, 0, 0, 0, 0.227, -26.172054, 0, 26.035812)
|
||||
[node name="NavigationRegion3D_Animal" type="NavigationRegion3D" parent="." index="51" unique_id=464562369]
|
||||
transform = Transform3D(0.227, 0, 0, 0, 0.227, 0, 0, 0, 0.227, -25.081772, 0, 23.200691)
|
||||
navigation_mesh = SubResource("NavigationMesh_6kqo0")
|
||||
|
||||
[node name="Marker3D" type="Marker3D" parent="NavigationRegion3D3" index="0" unique_id=1803336591]
|
||||
[node name="Marker3D" type="Marker3D" parent="NavigationRegion3D_Animal" index="0" unique_id=1803336591]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8.997475, 4.6511626, 2.5748215)
|
||||
script = ExtResource("42_2y8tt")
|
||||
allowed_type = 2
|
||||
|
||||
[node name="NavigationRegion3D2" type="NavigationRegion3D" parent="." index="52" unique_id=956919772]
|
||||
transform = Transform3D(0.221, 0, 0, 0, 0.221, 0, 0, 0, 0.221, -26.46752, 0, 26.028978)
|
||||
[node name="NavigationRegion3D_Human" type="NavigationRegion3D" parent="." index="52" unique_id=956919772]
|
||||
transform = Transform3D(0.221, 0, 0, 0, 0.221, 0, 0, 0, 0.221, -24.86479, 0, 24.841185)
|
||||
navigation_mesh = SubResource("NavigationMesh_6kqo0")
|
||||
|
||||
[node name="Marker3D" type="Marker3D" parent="NavigationRegion3D2" index="0" unique_id=716540804]
|
||||
[node name="Marker3D" type="Marker3D" parent="NavigationRegion3D_Human" index="0" unique_id=716540804]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -17.035408, 4.6511626, 2.5748215)
|
||||
script = ExtResource("42_2y8tt")
|
||||
allowed_type = 1
|
||||
|
||||
[node name="NavigationRegion3D" type="NavigationRegion3D" parent="." index="53" unique_id=1202142795]
|
||||
transform = Transform3D(0.215, 0, 0, 0, 0.215, 0, 0, 0, 0.215, -26.136889, 0, 25.477837)
|
||||
[node name="NavigationRegion3D_Animal2" type="NavigationRegion3D" parent="." index="53" unique_id=1202142795]
|
||||
transform = Transform3D(0.215, 0, 0, 0, 0.215, 0, 0, 0, 0.215, -24.922632, 0, -5.6277256)
|
||||
navigation_mesh = SubResource("NavigationMesh_6kqo0")
|
||||
|
||||
[node name="Marker3D" type="Marker3D" parent="NavigationRegion3D" index="0" unique_id=73239644]
|
||||
[node name="Marker3D" type="Marker3D" parent="NavigationRegion3D_Animal2" index="0" unique_id=73239644]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -19.39701, 4.6511626, -10.110077)
|
||||
script = ExtResource("42_2y8tt")
|
||||
allowed_type = 2
|
||||
|
||||
Reference in New Issue
Block a user