mirror of
https://github.com/Relintai/broken_seals.git
synced 2025-01-25 14:19:19 +01:00
Fixed dungeon spawner spawn locations both in the test dungeon and in the world. Also now in the world the generator creates a little plateau for them.
This commit is contained in:
parent
11912f0a85
commit
3e88eaaa11
File diff suppressed because one or more lines are too long
@ -104,7 +104,7 @@ func teleport():
|
|||||||
_dungeon_back_teleporter = dungeon_back_teleporter.instance() as Spatial
|
_dungeon_back_teleporter = dungeon_back_teleporter.instance() as Spatial
|
||||||
var tdb : Transform = global_transform
|
var tdb : Transform = global_transform
|
||||||
tdb = tdb.translated(Vector3(0, -500, 0))
|
tdb = tdb.translated(Vector3(0, -500, 0))
|
||||||
tdb = tdb.translated(Vector3(1, 0.5, -1))
|
tdb = tdb.translated(Vector3(1, 0, -1))
|
||||||
_dungeon_back_teleporter.transform = tdb
|
_dungeon_back_teleporter.transform = tdb
|
||||||
_dungeon_back_teleporter.teleport_to = global_transform.xform(Vector3())
|
_dungeon_back_teleporter.teleport_to = global_transform.xform(Vector3())
|
||||||
get_parent().add_child(_dungeon_back_teleporter)
|
get_parent().add_child(_dungeon_back_teleporter)
|
||||||
|
@ -101,7 +101,7 @@ func _generate_terra_chunk(chunk: TerrainChunk, pseed : int, spawn_mobs: bool, s
|
|||||||
func gen_terra_chunk(chunk: TerrainChunk, rng : RandomNumberGenerator) -> void:
|
func gen_terra_chunk(chunk: TerrainChunk, rng : RandomNumberGenerator) -> void:
|
||||||
chunk.channel_ensure_allocated(TerrainChunkDefault.DEFAULT_CHANNEL_TYPE, 1)
|
chunk.channel_ensure_allocated(TerrainChunkDefault.DEFAULT_CHANNEL_TYPE, 1)
|
||||||
chunk.channel_ensure_allocated(TerrainChunkDefault.DEFAULT_CHANNEL_ISOLEVEL, 0)
|
chunk.channel_ensure_allocated(TerrainChunkDefault.DEFAULT_CHANNEL_ISOLEVEL, 0)
|
||||||
|
|
||||||
var s : FastNoise = FastNoise.new()
|
var s : FastNoise = FastNoise.new()
|
||||||
s.set_noise_type(FastNoise.TYPE_SIMPLEX)
|
s.set_noise_type(FastNoise.TYPE_SIMPLEX)
|
||||||
s.set_seed(current_seed)
|
s.set_seed(current_seed)
|
||||||
@ -149,11 +149,24 @@ func gen_terra_chunk(chunk: TerrainChunk, rng : RandomNumberGenerator) -> void:
|
|||||||
|
|
||||||
|
|
||||||
func spawn_dungeon(chunk: TerrainChunk, dungeon_seed : int, spawn_mobs : bool) -> void:
|
func spawn_dungeon(chunk: TerrainChunk, dungeon_seed : int, spawn_mobs : bool) -> void:
|
||||||
var x : float = chunk.position_x * chunk.voxel_scale * chunk.size_x
|
var world_space_data_coordinates_x : int = chunk.position_x * chunk.size_x
|
||||||
var z : float = chunk.position_z * chunk.voxel_scale * chunk.size_z
|
var world_space_data_coordinates_z : int = chunk.position_z * chunk.size_z
|
||||||
|
|
||||||
var vh : int = chunk.get_voxel(6, 6, TerrainChunkDefault.DEFAULT_CHANNEL_ISOLEVEL)
|
var vpx : int = 6
|
||||||
var vwh : float = chunk.get_voxel_scale() * chunk.get_world_height() * (vh / 256.0)
|
var vpz : int = 6
|
||||||
|
|
||||||
|
var x : float = (world_space_data_coordinates_x + vpx) * chunk.voxel_scale
|
||||||
|
var z : float = (world_space_data_coordinates_z + vpz) * chunk.voxel_scale
|
||||||
|
|
||||||
|
var vh : int = chunk.get_voxel(vpx, vpz, TerrainChunkDefault.DEFAULT_CHANNEL_ISOLEVEL)
|
||||||
|
|
||||||
|
var orx : int = (randi() % 3) + 1
|
||||||
|
var orz : int = (randi() % 3) + 1
|
||||||
|
|
||||||
|
for wx in range(vpx - orx, vpx + orx + 1):
|
||||||
|
for wz in range(vpz - orz, vpz + orz + 1):
|
||||||
|
chunk.set_voxel(vh, wx, wz, TerrainChunkDefault.DEFAULT_CHANNEL_ISOLEVEL)
|
||||||
|
var vwh : float = chunk.get_voxel_scale() * chunk.get_world_height() * (vh / 255.0)
|
||||||
|
|
||||||
var dt : Spatial = dungeon_teleporter.instance()
|
var dt : Spatial = dungeon_teleporter.instance()
|
||||||
chunk.voxel_world.add_child(dt)
|
chunk.voxel_world.add_child(dt)
|
||||||
|
Loading…
Reference in New Issue
Block a user