mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-11-13 20:47:19 +01:00
Grouped the files of my current test planet together, and made the planet loading code use the new folder structure.
This commit is contained in:
parent
238f0f2946
commit
fee3ba9137
@ -1,9 +0,0 @@
|
|||||||
[gd_resource type="BiomeData" load_steps=3 format=2]
|
|
||||||
|
|
||||||
[ext_resource path="res://scripts/biomes/simple_biome.gd" type="Script" id=1]
|
|
||||||
[ext_resource path="res://data/dungeons/1_test.tres" type="DungeonData" id=2]
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
target_script = ExtResource( 1 )
|
|
||||||
dungeon_datas = [ ExtResource( 2 ) ]
|
|
||||||
voxel_surfaces = [ null, null, null, null ]
|
|
@ -1,6 +0,0 @@
|
|||||||
[gd_resource type="DungeonRoomData" load_steps=2 format=2]
|
|
||||||
|
|
||||||
[ext_resource path="res://scripts/dungeon_start_rooms/start_room.gd" type="Script" id=1]
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
target_script = ExtResource( 1 )
|
|
@ -1,8 +0,0 @@
|
|||||||
[gd_resource type="DungeonData" load_steps=3 format=2]
|
|
||||||
|
|
||||||
[ext_resource path="res://scripts/dungeons/dungeon.gd" type="Script" id=1]
|
|
||||||
[ext_resource path="res://data/dungeon_rooms/2_test_start_room.tres" type="DungeonRoomData" id=2]
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
target_script = ExtResource( 1 )
|
|
||||||
dungeon_start_room_datas = [ ExtResource( 2 ) ]
|
|
@ -1,9 +0,0 @@
|
|||||||
[gd_resource type="PlanetData" load_steps=3 format=2]
|
|
||||||
|
|
||||||
[ext_resource path="res://scripts/planets/dung_simple_planet.gd" type="Script" id=1]
|
|
||||||
[ext_resource path="res://data/biomes/2_tdungb.tres" type="BiomeData" id=2]
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
id = 1
|
|
||||||
target_script = ExtResource( 1 )
|
|
||||||
biome_datas = [ ExtResource( 2 ) ]
|
|
9
game/data/planets/test_planet/1_tdungeon.tres
Normal file
9
game/data/planets/test_planet/1_tdungeon.tres
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[gd_resource type="PlanetData" load_steps=3 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://data/planets/test_planet/biomes/2_tdungb.tres" type="BiomeData" id=1]
|
||||||
|
[ext_resource path="res://data/planets/test_planet/planets/dung_simple_planet.gd" type="Script" id=2]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
id = 1
|
||||||
|
target_script = ExtResource( 2 )
|
||||||
|
biome_datas = [ ExtResource( 1 ) ]
|
@ -1,6 +1,8 @@
|
|||||||
[gd_resource type="BiomeData" load_steps=2 format=2]
|
[gd_resource type="BiomeData" load_steps=2 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://scripts/biomes/simple_biome.gd" type="Script" id=1]
|
[ext_resource path="res://data/planets/test_planet/biomes/simple_biome.gd" type="Script" id=1]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
target_script = ExtResource( 1 )
|
target_script = ExtResource( 1 )
|
9
game/data/planets/test_planet/biomes/2_tdungb.tres
Normal file
9
game/data/planets/test_planet/biomes/2_tdungb.tres
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[gd_resource type="BiomeData" load_steps=3 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://data/planets/test_planet/dungeons/1_test.tres" type="DungeonData" id=1]
|
||||||
|
[ext_resource path="res://data/planets/test_planet/biomes/simple_biome.gd" type="Script" id=2]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
target_script = ExtResource( 2 )
|
||||||
|
dungeon_datas = [ ExtResource( 1 ) ]
|
||||||
|
voxel_surfaces = [ null, null, null, null ]
|
@ -0,0 +1,6 @@
|
|||||||
|
[gd_resource type="DungeonRoomData" load_steps=2 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://data/planets/test_planet/dungeon_start_rooms/start_room.gd" type="Script" id=1]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
target_script = ExtResource( 1 )
|
8
game/data/planets/test_planet/dungeons/1_test.tres
Normal file
8
game/data/planets/test_planet/dungeons/1_test.tres
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
[gd_resource type="DungeonData" load_steps=3 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://data/planets/test_planet/dungeons/dungeon.gd" type="Script" id=1]
|
||||||
|
[ext_resource path="res://data/planets/test_planet/dungeon_rooms/2_test_start_room.tres" type="DungeonRoomData" id=2]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
target_script = ExtResource( 1 )
|
||||||
|
dungeon_start_room_datas = [ ExtResource( 2 ) ]
|
@ -21,6 +21,9 @@
|
|||||||
[ext_resource path="res://scripts/settings/DirectionalLightSettings.gd" type="Script" id=19]
|
[ext_resource path="res://scripts/settings/DirectionalLightSettings.gd" type="Script" id=19]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[sub_resource type="VoxelmanLevelGenerator" id=1]
|
[sub_resource type="VoxelmanLevelGenerator" id=1]
|
||||||
script = ExtResource( 18 )
|
script = ExtResource( 18 )
|
||||||
_force_planet = -1
|
_force_planet = -1
|
||||||
|
@ -5,6 +5,9 @@
|
|||||||
[ext_resource path="res://scripts/settings/DirectionalLightSettings.gd" type="Script" id=3]
|
[ext_resource path="res://scripts/settings/DirectionalLightSettings.gd" type="Script" id=3]
|
||||||
[ext_resource path="res://voxelman/world/TVVoxelWorld.gd" type="Script" id=8]
|
[ext_resource path="res://voxelman/world/TVVoxelWorld.gd" type="Script" id=8]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[sub_resource type="VoxelmanLevelGenerator" id=1]
|
[sub_resource type="VoxelmanLevelGenerator" id=1]
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
_force_planet = -1
|
_force_planet = -1
|
||||||
|
@ -22,7 +22,7 @@ class_name MainPlanetGenerator
|
|||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
# SOFTWARE.
|
# SOFTWARE.
|
||||||
|
|
||||||
const planet_folder : String = "res://data/planets/"
|
const planet_folder : String = "res://data/planets"
|
||||||
|
|
||||||
export(int) var _force_planet : int = -1
|
export(int) var _force_planet : int = -1
|
||||||
export(int) var _level_seed : int
|
export(int) var _level_seed : int
|
||||||
@ -47,17 +47,7 @@ func _generate_chunk(chunk : VoxelChunk) -> void:
|
|||||||
_planet.generate_chunk(chunk, _spawn_mobs)
|
_planet.generate_chunk(chunk, _spawn_mobs)
|
||||||
|
|
||||||
func create_planet():
|
func create_planet():
|
||||||
var planet_files : Array = Array()
|
var planet_files : Array = get_planets(planet_folder)
|
||||||
|
|
||||||
var dir = Directory.new()
|
|
||||||
if dir.open(planet_folder) == OK:
|
|
||||||
dir.list_dir_begin()
|
|
||||||
var file_name = dir.get_next()
|
|
||||||
while (file_name != ""):
|
|
||||||
if not dir.current_is_dir():
|
|
||||||
planet_files.append(file_name)
|
|
||||||
|
|
||||||
file_name = dir.get_next()
|
|
||||||
|
|
||||||
if planet_files.size() == 0:
|
if planet_files.size() == 0:
|
||||||
return
|
return
|
||||||
@ -69,7 +59,7 @@ func create_planet():
|
|||||||
else:
|
else:
|
||||||
ind = _force_planet
|
ind = _force_planet
|
||||||
|
|
||||||
var planet_data : PlanetData = ResourceLoader.load(planet_folder + planet_files[ind], "PlanetData")
|
var planet_data : PlanetData = ResourceLoader.load(planet_files[ind], "PlanetData")
|
||||||
|
|
||||||
if planet_data == null:
|
if planet_data == null:
|
||||||
print("planet_data is null!")
|
print("planet_data is null!")
|
||||||
@ -96,3 +86,24 @@ func create_planet():
|
|||||||
_planet.data = planet_data
|
_planet.data = planet_data
|
||||||
_planet.setup()
|
_planet.setup()
|
||||||
_planet.setup_library(_library)
|
_planet.setup_library(_library)
|
||||||
|
|
||||||
|
func get_planets(path : String, root : bool = true) -> Array:
|
||||||
|
var planet_files : Array = Array()
|
||||||
|
|
||||||
|
var dir = Directory.new()
|
||||||
|
if dir.open(path) == OK:
|
||||||
|
dir.list_dir_begin(true)
|
||||||
|
var file_name = dir.get_next()
|
||||||
|
while (file_name != ""):
|
||||||
|
if not dir.current_is_dir():
|
||||||
|
planet_files.append(path + "/" + file_name)
|
||||||
|
else:
|
||||||
|
if root:
|
||||||
|
var l : Array = get_planets(path + "/" + file_name, false)
|
||||||
|
|
||||||
|
for i in l:
|
||||||
|
planet_files.append(i)
|
||||||
|
|
||||||
|
file_name = dir.get_next()
|
||||||
|
|
||||||
|
return planet_files
|
||||||
|
@ -10,6 +10,9 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[sub_resource type="Environment" id=1]
|
[sub_resource type="Environment" id=1]
|
||||||
ambient_light_color = Color( 1, 1, 1, 1 )
|
ambient_light_color = Color( 1, 1, 1, 1 )
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user