mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-12-25 01:17:10 +01:00
Don't spawn mobs at all during world generation on a client.
This commit is contained in:
parent
f8803b99ab
commit
c0280ce6f3
@ -74,10 +74,10 @@ func _generate_terra_chunk(chunk, spawn_mobs):
|
|||||||
|
|
||||||
if chunk.position_x == 0 && chunk.position_z == 0:
|
if chunk.position_x == 0 && chunk.position_z == 0:
|
||||||
#test
|
#test
|
||||||
spawn_dungeon(chunk, chunk_seed)
|
spawn_dungeon(chunk, chunk_seed, spawn_mobs)
|
||||||
else:
|
else:
|
||||||
if rng.randi() % 10 == 0:
|
if rng.randi() % 10 == 0:
|
||||||
spawn_dungeon(chunk, chunk_seed)
|
spawn_dungeon(chunk, chunk_seed, spawn_mobs)
|
||||||
|
|
||||||
for i in range(get_building_count()):
|
for i in range(get_building_count()):
|
||||||
get_building(i).generate_terra_chunk(chunk, spawn_mobs)
|
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)
|
# 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 x : float = chunk.position_x * chunk.voxel_scale * chunk.size_x
|
||||||
var z : float = chunk.position_z * chunk.voxel_scale * chunk.size_z
|
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.min_level = level - 1
|
||||||
dt.max_level = level + 1
|
dt.max_level = level + 1
|
||||||
dt.dungeon_seed = dungeon_seed
|
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))
|
dt.transform = Transform(Basis().scaled(Vector3(chunk.voxel_scale, chunk.voxel_scale, chunk.voxel_scale)), Vector3(x, vwh, z))
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ export(PackedScene) var dungeon_back_teleporter : PackedScene
|
|||||||
var min_level : int = 1
|
var min_level : int = 1
|
||||||
var max_level : int = 2
|
var max_level : int = 2
|
||||||
var dungeon_seed : int = 0
|
var dungeon_seed : int = 0
|
||||||
|
var spawn_mobs : bool = true
|
||||||
|
|
||||||
var owner_chunk : TerraChunk = null
|
var owner_chunk : TerraChunk = null
|
||||||
var _dungeon : Spatial = null
|
var _dungeon : Spatial = null
|
||||||
@ -91,6 +92,7 @@ func teleport():
|
|||||||
_dungeon.transform = t
|
_dungeon.transform = t
|
||||||
_dungeon.min_level = min_level
|
_dungeon.min_level = min_level
|
||||||
_dungeon.max_level = max_level
|
_dungeon.max_level = max_level
|
||||||
|
_dungeon.spawn_mobs = spawn_mobs
|
||||||
_dungeon.dungeon_seed = dungeon_seed
|
_dungeon.dungeon_seed = dungeon_seed
|
||||||
get_parent().add_child(_dungeon)
|
get_parent().add_child(_dungeon)
|
||||||
|
|
||||||
|
@ -13,6 +13,9 @@ func _instance(p_seed, p_instance):
|
|||||||
return p_instance
|
return p_instance
|
||||||
|
|
||||||
func _generate_terra_chunk(chunk : TerraChunk, spawn_mobs : bool):
|
func _generate_terra_chunk(chunk : TerraChunk, spawn_mobs : bool):
|
||||||
|
if !spawn_mobs:
|
||||||
|
return
|
||||||
|
|
||||||
if trainer == null || vendor == null:
|
if trainer == null || vendor == null:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user