From c0280ce6f3b9ae397aeb65cbbe16f174941c36ab Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 29 Aug 2021 23:38:15 +0200 Subject: [PATCH] Don't spawn mobs at all during world generation on a client. --- game/modules/planets/test_planet/biomes/simple_biome.gd | 7 ++++--- .../planets/test_planet/dungeons/dung_teleporter.gd | 2 ++ game/modules/planets/test_planet/villages/village.gd | 3 +++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/game/modules/planets/test_planet/biomes/simple_biome.gd b/game/modules/planets/test_planet/biomes/simple_biome.gd index 7e2cc8a6..0f4df281 100644 --- a/game/modules/planets/test_planet/biomes/simple_biome.gd +++ b/game/modules/planets/test_planet/biomes/simple_biome.gd @@ -74,10 +74,10 @@ func _generate_terra_chunk(chunk, spawn_mobs): if chunk.position_x == 0 && chunk.position_z == 0: #test - spawn_dungeon(chunk, chunk_seed) + spawn_dungeon(chunk, chunk_seed, spawn_mobs) else: if rng.randi() % 10 == 0: - spawn_dungeon(chunk, chunk_seed) + spawn_dungeon(chunk, chunk_seed, spawn_mobs) for i in range(get_building_count()): get_building(i).generate_terra_chunk(chunk, spawn_mobs) @@ -143,7 +143,7 @@ func gen_terra_chunk(chunk: TerraChunk, rng : RandomNumberGenerator) -> void: # chunk.voxel_world.prop_add(tr, prop_tree2) -func spawn_dungeon(chunk: TerraChunk, dungeon_seed : int) -> void: +func spawn_dungeon(chunk: TerraChunk, dungeon_seed : int, spawn_mobs : bool) -> void: var x : float = chunk.position_x * chunk.voxel_scale * chunk.size_x var z : float = chunk.position_z * chunk.voxel_scale * chunk.size_z @@ -162,5 +162,6 @@ func spawn_dungeon(chunk: TerraChunk, dungeon_seed : int) -> void: dt.min_level = level - 1 dt.max_level = level + 1 dt.dungeon_seed = dungeon_seed + dt.spawn_mobs = spawn_mobs dt.transform = Transform(Basis().scaled(Vector3(chunk.voxel_scale, chunk.voxel_scale, chunk.voxel_scale)), Vector3(x, vwh, z)) diff --git a/game/modules/planets/test_planet/dungeons/dung_teleporter.gd b/game/modules/planets/test_planet/dungeons/dung_teleporter.gd index efabc886..2b0c791b 100644 --- a/game/modules/planets/test_planet/dungeons/dung_teleporter.gd +++ b/game/modules/planets/test_planet/dungeons/dung_teleporter.gd @@ -10,6 +10,7 @@ export(PackedScene) var dungeon_back_teleporter : PackedScene var min_level : int = 1 var max_level : int = 2 var dungeon_seed : int = 0 +var spawn_mobs : bool = true var owner_chunk : TerraChunk = null var _dungeon : Spatial = null @@ -91,6 +92,7 @@ func teleport(): _dungeon.transform = t _dungeon.min_level = min_level _dungeon.max_level = max_level + _dungeon.spawn_mobs = spawn_mobs _dungeon.dungeon_seed = dungeon_seed get_parent().add_child(_dungeon) diff --git a/game/modules/planets/test_planet/villages/village.gd b/game/modules/planets/test_planet/villages/village.gd index b581f09d..d5b6132f 100644 --- a/game/modules/planets/test_planet/villages/village.gd +++ b/game/modules/planets/test_planet/villages/village.gd @@ -13,6 +13,9 @@ func _instance(p_seed, p_instance): return p_instance func _generate_terra_chunk(chunk : TerraChunk, spawn_mobs : bool): + if !spawn_mobs: + return + if trainer == null || vendor == null: return