mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-12-21 13:16:49 +01:00
Implemented mob spawning (turned it off for now). Also now the menu now won't spawn in the dungeon.
This commit is contained in:
parent
41a528a892
commit
7770879003
@ -20,7 +20,7 @@
|
|||||||
[ext_resource path="res://scripts/world_generators/MainPlanetGenerator.gd" type="Script" id=18]
|
[ext_resource path="res://scripts/world_generators/MainPlanetGenerator.gd" type="Script" id=18]
|
||||||
[ext_resource path="res://scripts/settings/DirectionalLightSettings.gd" type="Script" id=19]
|
[ext_resource path="res://scripts/settings/DirectionalLightSettings.gd" type="Script" id=19]
|
||||||
[ext_resource path="res://ui/about/About.tscn" type="PackedScene" id=20]
|
[ext_resource path="res://ui/about/About.tscn" type="PackedScene" id=20]
|
||||||
[ext_resource path="res://modules/planets/test_planet/DungeonPlanetData.tres" type="PlanetData" id=21]
|
[ext_resource path="res://modules/planets/test_planet/SimplePlanetData.tres" type="PlanetData" id=21]
|
||||||
|
|
||||||
[sub_resource type="VoxelmanLevelGenerator" id=1]
|
[sub_resource type="VoxelmanLevelGenerator" id=1]
|
||||||
script = ExtResource( 18 )
|
script = ExtResource( 18 )
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[gd_resource type="PlanetData" load_steps=3 format=2]
|
[gd_resource type="PlanetData" load_steps=3 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://modules/planets/test_planet/planets/simple_planet.tres" type="Planet" id=1]
|
[ext_resource path="res://modules/planets/test_planet/planets/simple_planet.tres" type="Planet" id=1]
|
||||||
[ext_resource path="res://modules/planets/test_planet/biomes/2_tdungb.tres" type="BiomeData" id=2]
|
[ext_resource path="res://modules/planets/test_planet/biomes/1_test.tres" type="BiomeData" id=2]
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
id = 1
|
id = 1
|
||||||
|
@ -26,6 +26,8 @@ export(int) var min_room_dimension : int = 5
|
|||||||
export(int) var max_room_dimension : int = 8
|
export(int) var max_room_dimension : int = 8
|
||||||
export(int) var enemy_count : int = 14
|
export(int) var enemy_count : int = 14
|
||||||
|
|
||||||
|
export(bool) var spawn_mobs : bool = false
|
||||||
|
|
||||||
export(MeshDataResource) var dung_floor : MeshDataResource = null
|
export(MeshDataResource) var dung_floor : MeshDataResource = null
|
||||||
export(MeshDataResource) var dung_ceiling : MeshDataResource = null
|
export(MeshDataResource) var dung_ceiling : MeshDataResource = null
|
||||||
export(MeshDataResource) var dung_wall_xp : MeshDataResource = null
|
export(MeshDataResource) var dung_wall_xp : MeshDataResource = null
|
||||||
@ -49,6 +51,8 @@ var inner_entrance_position : Vector3 = Vector3()
|
|||||||
var player_inner_entrance_position_x : int = 0
|
var player_inner_entrance_position_x : int = 0
|
||||||
var player_inner_entrance_position_z : int = 0
|
var player_inner_entrance_position_z : int = 0
|
||||||
|
|
||||||
|
var enemy_data : Array = []
|
||||||
|
|
||||||
# in binary: WallXP = 00001, WallXN = 0010, WallZP = 0100, WallZN = 1000
|
# in binary: WallXP = 00001, WallXN = 0010, WallZP = 0100, WallZN = 1000
|
||||||
enum NeighbourCaseCodeFlags { WallXP = 1, WallXN = 2, WallZP = 4, WallZN = 8 }
|
enum NeighbourCaseCodeFlags { WallXP = 1, WallXN = 2, WallZP = 4, WallZN = 8 }
|
||||||
enum Tile { Wall, Floor, Door, Empty }
|
enum Tile { Wall, Floor, Door, Empty }
|
||||||
@ -163,6 +167,14 @@ func _generate_chunk(chunk, spawn_mobs):
|
|||||||
xx += 1
|
xx += 1
|
||||||
zz = 0
|
zz = 0
|
||||||
|
|
||||||
|
if spawn_mobs:
|
||||||
|
for enemy in enemy_data:
|
||||||
|
var bp = enemy[0]
|
||||||
|
var pos : Vector3 = Vector3(bp.x * chunk.voxel_scale, floor_pos, bp.y * chunk.voxel_scale)
|
||||||
|
|
||||||
|
ESS.entity_spawner.spawn_mob(enemy[1], enemy[2], pos)
|
||||||
|
# entities.app
|
||||||
|
|
||||||
# for i in range(get_dungeon_start_room_count()):
|
# for i in range(get_dungeon_start_room_count()):
|
||||||
# get_dungeon_start_room(i).generate_chunk(chunk, spawn_mobs)
|
# get_dungeon_start_room(i).generate_chunk(chunk, spawn_mobs)
|
||||||
|
|
||||||
@ -192,28 +204,22 @@ func build():
|
|||||||
#Server.sset_seed(_player.sseed)
|
#Server.sset_seed(_player.sseed)
|
||||||
|
|
||||||
#Place enemies
|
#Place enemies
|
||||||
# for i in range(enemy_count):
|
if spawn_mobs:
|
||||||
# var room = rooms[1 + randi() % (rooms.size() - 1)]
|
for i in range(enemy_count):
|
||||||
# var x = room.position.x + 1 + randi() % int (room.size.x - 2)
|
var room = rooms[1 + randi() % (rooms.size() - 1)]
|
||||||
# var y = room.position.y + 1 + randi() % int (room.size.y - 2)
|
var x = room.position.x + 1 + randi() % int (room.size.x - 2)
|
||||||
#
|
var y = room.position.y + 1 + randi() % int (room.size.y - 2)
|
||||||
# var blocked = false
|
|
||||||
# for enemy in enemies:
|
var blocked = false
|
||||||
# var body = enemy.get_body()
|
for enemy in enemy_data:
|
||||||
# var bp = body.get_tile_position()
|
var bp = enemy[0]
|
||||||
# if bp.x == x && bp.y == y:
|
if bp.x == x && bp.y == y:
|
||||||
# blocked = true
|
blocked = true
|
||||||
# break
|
break
|
||||||
#
|
|
||||||
# if !blocked:
|
if !blocked:
|
||||||
# var t = tile_to_pixel_center(x, y)
|
enemy_data.append([Vector2(x, y), 1, 1])
|
||||||
# var enemy = ESS.entity_spawner.spawn_mob(1, 1, Vector3(t.x, t.y, 0), get_path())
|
# var enemy = ESS.entity_spawner.spawn_mob(1, 1, Vector3(t.x, t.y, 0), get_path())
|
||||||
#
|
|
||||||
# enemies.append(enemy)
|
|
||||||
#
|
|
||||||
# tile_map.update_dirty_quadrants()
|
|
||||||
#
|
|
||||||
# generated = true
|
|
||||||
|
|
||||||
func build_level():
|
func build_level():
|
||||||
rooms.clear()
|
rooms.clear()
|
||||||
|
@ -21,6 +21,7 @@ level_room_count = 9
|
|||||||
min_room_dimension = 5
|
min_room_dimension = 5
|
||||||
max_room_dimension = 8
|
max_room_dimension = 8
|
||||||
enemy_count = 14
|
enemy_count = 14
|
||||||
|
spawn_mobs = false
|
||||||
dung_floor = ExtResource( 7 )
|
dung_floor = ExtResource( 7 )
|
||||||
dung_ceiling = ExtResource( 4 )
|
dung_ceiling = ExtResource( 4 )
|
||||||
dung_wall_xp = ExtResource( 5 )
|
dung_wall_xp = ExtResource( 5 )
|
||||||
|
@ -44,6 +44,7 @@ func setup(world : VoxelWorld, level_seed : int, spawn_mobs : bool, library: Vox
|
|||||||
_planet.current_seed = _level_seed
|
_planet.current_seed = _level_seed
|
||||||
_planet.setup()
|
_planet.setup()
|
||||||
_planet.setup_library(_library)
|
_planet.setup_library(_library)
|
||||||
|
_library.refresh_rects()
|
||||||
|
|
||||||
# create_planet()
|
# create_planet()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user