mirror of
https://github.com/Relintai/broken_seals_roguelike.git
synced 2024-11-21 13:17:17 +01:00
Remove the planets folder, as it's not used (to make upgrading modules easier).
This commit is contained in:
parent
917fb8048a
commit
f647606949
@ -1,10 +0,0 @@
|
||||
[gd_resource type="PlanetData" load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://modules/planets/test_planet/biomes/2_tdungb.tres" type="BiomeData" id=1]
|
||||
[ext_resource path="res://modules/planets/test_planet/planets/dung_simple_planet.gd" type="Script" id=2]
|
||||
|
||||
|
||||
[resource]
|
||||
id = 1
|
||||
target_script = ExtResource( 2 )
|
||||
biome_datas = [ ExtResource( 1 ) ]
|
@ -1,10 +0,0 @@
|
||||
[gd_resource type="BiomeData" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://modules/planets/test_planet/biomes/simple_biome.gd" type="Script" id=1]
|
||||
|
||||
|
||||
|
||||
|
||||
[resource]
|
||||
target_script = ExtResource( 1 )
|
||||
voxel_surfaces = [ null, null, null, null ]
|
@ -1,10 +0,0 @@
|
||||
[gd_resource type="BiomeData" load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://modules/planets/test_planet/dungeons/1_test.tres" type="DungeonData" id=1]
|
||||
[ext_resource path="res://modules/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 ]
|
@ -1,178 +0,0 @@
|
||||
extends BiomeBase
|
||||
|
||||
# Copyright (c) 2019-2020 Péter Magyar
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
func _generate_chunk(chunk: VoxelChunk, spawn_mobs: bool) -> void:
|
||||
# var chunk : VoxelChunk = chunk.get_chunk()
|
||||
|
||||
# generate_terrarin(chunk, spawn_mobs)
|
||||
|
||||
generate_simple_terrarin(chunk, spawn_mobs)
|
||||
|
||||
if not Engine.editor_hint and chunk.position_y == 0 and spawn_mobs:
|
||||
ESS.entity_spawner.spawn_mob(0, randi() % 3, Vector3(chunk.position_x * chunk.size_x * chunk.voxel_scale + chunk.size_x / 2,\
|
||||
(chunk.position_y + 1) * chunk.size_y * chunk.voxel_scale, \
|
||||
chunk.position_z * chunk.size_z * chunk.voxel_scale + chunk.size_z / 2))
|
||||
|
||||
func generate_terrarin(chunk : VoxelChunk, spawn_mobs: bool) -> void:
|
||||
var noise : OpenSimplexNoise = OpenSimplexNoise.new()
|
||||
noise.seed = 10 * current_seed
|
||||
noise.octaves = 4
|
||||
noise.period = 280.0
|
||||
noise.persistence = 0.8
|
||||
|
||||
var terr_noise : OpenSimplexNoise = OpenSimplexNoise.new()
|
||||
terr_noise.seed = 10 * 321 + 112 * current_seed
|
||||
terr_noise.octaves = 4
|
||||
terr_noise.period = 90.0
|
||||
terr_noise.persistence = 0.9
|
||||
|
||||
var det_noise : OpenSimplexNoise = OpenSimplexNoise.new()
|
||||
det_noise.seed = 10 * 3231 + 112 * current_seed
|
||||
det_noise.octaves = 6
|
||||
det_noise.period = 80.0
|
||||
det_noise.persistence = 0.3
|
||||
|
||||
for x in range(-chunk.get_margin_start(), chunk.size_x + chunk.get_margin_end()):
|
||||
for z in range(-chunk.get_margin_start(), chunk.size_z + chunk.get_margin_end()):
|
||||
var val : float = noise.get_noise_2d(x + (chunk.position_x * chunk.size_x), z + (chunk.position_z * chunk.size_z))
|
||||
val *= val
|
||||
val *= 200
|
||||
val += 2
|
||||
|
||||
var tv : float = terr_noise.get_noise_2d(x + (chunk.position_x * chunk.size_x), z + (chunk.position_z * chunk.size_z))
|
||||
tv *= tv * tv * tv
|
||||
val += tv * 2
|
||||
|
||||
var dval : float = noise.get_noise_2d(x + (chunk.position_x * chunk.size_x), z + (chunk.position_z * chunk.size_z))
|
||||
|
||||
val += dval * 6
|
||||
|
||||
var v : int = (int(val))
|
||||
|
||||
v -= chunk.position_y * (chunk.size_y)
|
||||
|
||||
if v > chunk.size_y + chunk.get_margin_end():
|
||||
v = chunk.size_y + chunk.get_margin_end()
|
||||
|
||||
for y in range(-chunk.get_margin_start(), v):
|
||||
seed(x + (chunk.position_x * chunk.size_x) + z + (chunk.position_z * chunk.size_z) + y + (chunk.position_y * chunk.size_y))
|
||||
|
||||
|
||||
if v < 2:
|
||||
chunk.set_voxel(1, x, y, z, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE)
|
||||
elif v == 2:
|
||||
chunk.set_voxel(3, x, y, z, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE)
|
||||
else:
|
||||
chunk.set_voxel(2, x, y, z, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE)
|
||||
|
||||
# if y == v - 1:
|
||||
# chunk.set_voxel(int(255.0 * (val - int(val))), x, y, z, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL)
|
||||
# else:
|
||||
# chunk.set_voxel(255, x, y, z, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL)
|
||||
#
|
||||
|
||||
var val2 : float = (val - int(val)) * 4.0
|
||||
val2 = int(val2)
|
||||
val2 /= 4.0
|
||||
|
||||
chunk.set_voxel(int(255.0 * val2), x, y, z, VoxelChunkDefault.DEFAULT_CHANNEL_ISOLEVEL)
|
||||
# chunk.set_voxel(int(255.0 * (val - int(val)) / 180.0) * 180, x, y, z, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL)
|
||||
# chunk.set_voxel(int(255.0 * (val - int(val))), x, y, z, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL)
|
||||
|
||||
# box_blur(chunk)
|
||||
|
||||
# chunk.build()
|
||||
|
||||
if not Engine.editor_hint and chunk.position_y == 0 and spawn_mobs:
|
||||
ESS.entity_spawner.spawn_mob(0, randi() % 3, Vector3(chunk.position_x * chunk.size_x * chunk.voxel_scale + chunk.size_x / 2,\
|
||||
(chunk.position_y + 1) * chunk.size_y * chunk.voxel_scale, \
|
||||
chunk.position_z * chunk.size_z * chunk.voxel_scale + chunk.size_z / 2))
|
||||
|
||||
func box_blur(chunk : VoxelChunk):
|
||||
for x in range(0, chunk.size_x):
|
||||
for z in range(0, chunk.size_z):
|
||||
for y in range(0, chunk.size_z):
|
||||
|
||||
var avg : float = 0
|
||||
var avgc : int = 0
|
||||
|
||||
var curr : int = chunk.get_voxel(x, y, z, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL)
|
||||
|
||||
if curr > 0:
|
||||
avg += curr
|
||||
avgc += 1
|
||||
|
||||
curr = chunk.get_voxel(x + 1, y, z, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL)
|
||||
|
||||
if curr > 0:
|
||||
avg += curr
|
||||
avgc += 1
|
||||
|
||||
curr = chunk.get_voxel(x, y, z + 1, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL)
|
||||
|
||||
if curr > 0:
|
||||
avg += curr
|
||||
avgc += 1
|
||||
|
||||
curr = chunk.get_voxel(x + 1, y, z + 1, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL)
|
||||
|
||||
if curr > 0:
|
||||
avg += curr
|
||||
avgc += 1
|
||||
|
||||
curr = chunk.get_voxel(x, y + 1, z, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL)
|
||||
|
||||
if curr > 0:
|
||||
avg += curr
|
||||
avgc += 1
|
||||
|
||||
curr = chunk.get_voxel(x + 1, y + 1, z, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL)
|
||||
|
||||
if curr > 0:
|
||||
avg += curr
|
||||
avgc += 1
|
||||
|
||||
curr = chunk.get_voxel(x, y + 1, z + 1, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL)
|
||||
|
||||
if curr > 0:
|
||||
avg += curr
|
||||
avgc += 1
|
||||
|
||||
curr = chunk.get_voxel(x + 1, y + 1, z + 1, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL)
|
||||
|
||||
if curr > 0:
|
||||
avg += curr
|
||||
avgc += 1
|
||||
|
||||
|
||||
avg /= float(avgc)
|
||||
|
||||
var aavg: int = int(avg)
|
||||
|
||||
chunk.set_voxel(aavg, x, y, z, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL)
|
||||
chunk.set_voxel(aavg, x + 1, y, z, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL)
|
||||
chunk.set_voxel(aavg, x, y, z + 1, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL)
|
||||
chunk.set_voxel(aavg, x + 1, y, z + 1, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL)
|
||||
chunk.set_voxel(aavg, x, y + 1, z, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL)
|
||||
chunk.set_voxel(aavg, x + 1, y + 1, z, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL)
|
||||
chunk.set_voxel(aavg, x, y + 1, z + 1, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL)
|
||||
chunk.set_voxel(aavg, x + 1, y + 1, z + 1, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL)
|
@ -1,3 +0,0 @@
|
||||
[gd_resource type="DungeonRoomData" format=2]
|
||||
|
||||
[resource]
|
@ -1,7 +0,0 @@
|
||||
[gd_resource type="DungeonRoomData" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://modules/planets/test_planet/dungeon_start_rooms/start_room.gd" type="Script" id=1]
|
||||
|
||||
|
||||
[resource]
|
||||
target_script = ExtResource( 1 )
|
@ -1,100 +0,0 @@
|
||||
tool
|
||||
extends DungeonRoom
|
||||
|
||||
# Copyright (c) 2019-2020 Péter Magyar
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
func _setup():
|
||||
sizex = 4
|
||||
sizey = 4
|
||||
sizez = 4
|
||||
|
||||
func _generate_chunk(chunk : VoxelChunk, spawn_mobs: bool) -> void:
|
||||
if chunk.position_x != 0 or chunk.position_z != 0:
|
||||
return
|
||||
|
||||
var hs : int = chunk.get_size_y() / 2 - sizex / 2
|
||||
|
||||
if chunk.position_y == 0:
|
||||
for y in range(0, 4):
|
||||
for x in range(-4, 5):
|
||||
for z in range(-4, 5):
|
||||
if chunk.get_voxel(hs + x, y, hs + z, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE) != 0:
|
||||
chunk.set_voxel(4, hs + x, y, hs + z, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE)
|
||||
|
||||
|
||||
for x in range(-5, 5):
|
||||
for z in [-5, 4]:
|
||||
for y in range(0, randi() % 5):
|
||||
if chunk.get_voxel(hs + x, y, hs + z, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE) == 0:
|
||||
chunk.set_voxel(4, hs + x, y, hs + z, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE)
|
||||
chunk.set_voxel(10, hs + x, y, hs + z, VoxelChunkDefault.DEFAULT_CHANNEL_ISOLEVEL)
|
||||
|
||||
for x in [-5, 5]:
|
||||
for z in range(-5, 4):
|
||||
for y in range(0, randi() % 5):
|
||||
if chunk.get_voxel(hs + x, y, hs + z, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE) == 0:
|
||||
chunk.set_voxel(4, hs + x, y, hs + z, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE)
|
||||
chunk.set_voxel(10, hs + x, y, hs + z, VoxelChunkDefault.DEFAULT_CHANNEL_ISOLEVEL)
|
||||
|
||||
# var num : int = randi() % 10 + 7
|
||||
# for i in range(num):
|
||||
# var x : int = randi() % 12 - 6
|
||||
# var z : int = randi() % 12 - 6
|
||||
#
|
||||
# for y in range(4, 1, -1):
|
||||
# if chunk.get_voxel(hs + x, y, hs + z, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE) != 0:
|
||||
# chunk.set_voxel(1, hs + x, y + 1, hs + z, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE)
|
||||
# chunk.set_voxel(100, hs + x, y + 1, hs + z, VoxelChunkDefault.DEFAULT_CHANNEL_ISOLEVEL)
|
||||
# break
|
||||
|
||||
for y in range(-chunk.get_margin_start(), chunk.size_y + chunk.get_margin_end()):
|
||||
for x in range(0, 2):
|
||||
for z in range(0, 2):
|
||||
chunk.set_voxel(0, hs + x, y, hs + z, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE)
|
||||
|
||||
for y in range(3, chunk.get_size_y() / 2):
|
||||
chunk.set_voxel(4, hs, y, hs, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE)
|
||||
chunk.set_voxel((16 - y) * 8, hs, y, hs, VoxelChunkDefault.DEFAULT_CHANNEL_ISOLEVEL)
|
||||
|
||||
if chunk.position_y == -1:
|
||||
for y in range(chunk.get_size_y() - sizey - 1, chunk.get_size_y()):
|
||||
for x in range(hs - 1, hs + sizex + 1):
|
||||
for z in range(hs - 1, hs + sizez + 1):
|
||||
chunk.set_voxel(4, x, y, z, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE)
|
||||
chunk.set_voxel(255, x, y, z, VoxelChunkDefault.DEFAULT_CHANNEL_ISOLEVEL)
|
||||
|
||||
for y in range(chunk.get_size_y() - sizey + 1, chunk.size_y + chunk.get_margin_end()):
|
||||
for x in range(0, 2):
|
||||
for z in range(0, 2):
|
||||
chunk.set_voxel(0, hs + x, y, hs + z, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE)
|
||||
|
||||
|
||||
for y in range(chunk.get_size_y() - sizey, chunk.get_size_y() - 1):
|
||||
for x in range(hs, hs + sizex):
|
||||
for z in range(hs, hs + sizez):
|
||||
chunk.set_voxel(0, x, y, z, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE)
|
||||
|
||||
for x in range(0, 2):
|
||||
for z in range(0, 2):
|
||||
chunk.set_voxel(3, hs + x, chunk.get_size_y() - sizey, hs + z, VoxelChunkDefault.DEFAULT_CHANNEL_TYPE)
|
||||
chunk.set_voxel(30, x, chunk.get_size_y() - sizey, z, VoxelChunkDefault.DEFAULT_CHANNEL_ISOLEVEL)
|
||||
|
||||
|
@ -1,9 +0,0 @@
|
||||
[gd_resource type="DungeonData" load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://modules/planets/test_planet/dungeons/dungeon.gd" type="Script" id=1]
|
||||
[ext_resource path="res://modules/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 ) ]
|
@ -1,63 +0,0 @@
|
||||
tool
|
||||
extends Dungeon
|
||||
|
||||
# Copyright (c) 2019-2020 Péter Magyar
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
func _setup():
|
||||
if data.get_dungeon_start_room_data_count() == 0:
|
||||
return
|
||||
|
||||
var drd : DungeonRoomData = data.get_dungeon_start_room_data(0)
|
||||
|
||||
var dung : DungeonRoom
|
||||
if drd.target_script != null:
|
||||
dung = drd.target_script.new()
|
||||
|
||||
if dung == null:
|
||||
print("drd is null. wrong type? " + drd.resource_path)
|
||||
return
|
||||
elif drd.target_class_name != "":
|
||||
if not ClassDB.class_exists(drd.target_class_name):
|
||||
print("class doesnt exists" + drd.resource_path)
|
||||
return
|
||||
|
||||
dung = ClassDB.instance(drd.target_class_name)
|
||||
else:
|
||||
dung = DungeonRoom.new()
|
||||
|
||||
dung.posx = posx
|
||||
dung.posy = posy
|
||||
dung.posz = posz
|
||||
dung.current_seed = current_seed
|
||||
dung.data = drd
|
||||
dung.setup()
|
||||
|
||||
add_dungeon_start_room(dung)
|
||||
|
||||
func _setup_library(library):
|
||||
._setup_library(library)
|
||||
|
||||
for i in range(get_dungeon_start_room_count()):
|
||||
get_dungeon_start_room(i).setup_library(library)
|
||||
|
||||
func _generate_chunk(chunk, spawn_mobs):
|
||||
for i in range(get_dungeon_start_room_count()):
|
||||
get_dungeon_start_room(i).generate_chunk(chunk, spawn_mobs)
|
@ -1,13 +0,0 @@
|
||||
[gd_resource type="Environment" load_steps=2 format=2]
|
||||
|
||||
[sub_resource type="ProceduralSky" id=1]
|
||||
sky_top_color = Color( 0.0470588, 0.454902, 0.976471, 1 )
|
||||
sky_horizon_color = Color( 0.556863, 0.823529, 0.909804, 1 )
|
||||
sky_curve = 0.25
|
||||
ground_bottom_color = Color( 0.101961, 0.145098, 0.188235, 1 )
|
||||
ground_horizon_color = Color( 0.482353, 0.788235, 0.952941, 1 )
|
||||
ground_curve = 0.01
|
||||
|
||||
[resource]
|
||||
background_mode = 2
|
||||
background_sky = SubResource( 1 )
|
@ -1,110 +0,0 @@
|
||||
tool
|
||||
extends Planet
|
||||
|
||||
# Copyright (c) 2019-2020 Péter Magyar
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
func _setup():
|
||||
if data == null:
|
||||
return
|
||||
|
||||
if data.get_biome_data_count() == 0:
|
||||
return
|
||||
|
||||
var bdata : BiomeData = data.get_biome_data(0)
|
||||
|
||||
var b : Biome
|
||||
|
||||
if bdata.target_script != null:
|
||||
b = bdata.target_script.new()
|
||||
|
||||
if b == null:
|
||||
print("biome is null. wrong type? " + bdata.resource_path)
|
||||
return
|
||||
elif bdata.target_class_name != "":
|
||||
if not ClassDB.class_exists(bdata.target_class_name):
|
||||
print("class doesnt exists" + bdata.resource_path)
|
||||
return
|
||||
|
||||
b = ClassDB.instance(bdata.target_class_name)
|
||||
else:
|
||||
b = Biome.new()
|
||||
|
||||
b.current_seed = current_seed
|
||||
b.data = bdata
|
||||
b.setup()
|
||||
add_biome(b)
|
||||
|
||||
if bdata.get_dungeon_data_count() == 0:
|
||||
return
|
||||
|
||||
var dd : DungeonData = bdata.get_dungeon_data(0)
|
||||
|
||||
var dung : Dungeon
|
||||
if dd.target_script != null:
|
||||
dung = dd.target_script.new()
|
||||
|
||||
if dung == null:
|
||||
print("dd is null. wrong type? " + dd.resource_path)
|
||||
return
|
||||
elif dd.target_class_name != "":
|
||||
if not ClassDB.class_exists(dd.target_class_name):
|
||||
print("class doesnt exists" + dd.resource_path)
|
||||
return
|
||||
|
||||
dung = ClassDB.instance(dd.target_class_name)
|
||||
else:
|
||||
dung = Dungeon.new()
|
||||
|
||||
dung.posx = 0
|
||||
dung.posy = -4
|
||||
dung.posz = 0
|
||||
dung.current_seed = current_seed
|
||||
dung.data = dd
|
||||
dung.setup()
|
||||
|
||||
add_dungeon(dung)
|
||||
|
||||
func _setup_library(library):
|
||||
._setup_library(library)
|
||||
|
||||
for i in range(get_biome_count()):
|
||||
var b : Biome = get_biome(i)
|
||||
|
||||
if b != null:
|
||||
b.setup_library(library)
|
||||
|
||||
for i in range(get_dungeon_count()):
|
||||
var d : Dungeon = get_dungeon(i)
|
||||
|
||||
if d != null:
|
||||
d.setup_library(library)
|
||||
|
||||
func _generate_chunk(chunk, spawn_mobs):
|
||||
if (get_biome_count() == 0):
|
||||
return
|
||||
|
||||
var b : Biome = get_biome(0)
|
||||
|
||||
b.generate_chunk(chunk, spawn_mobs)
|
||||
|
||||
for i in range(get_dungeon_count()):
|
||||
get_dungeon(i).generate_chunk(chunk, spawn_mobs)
|
||||
|
@ -1,70 +0,0 @@
|
||||
tool
|
||||
extends Planet
|
||||
|
||||
# Copyright (c) 2019-2020 Péter Magyar
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
func _setup():
|
||||
if data == null:
|
||||
return
|
||||
|
||||
if data.get_biome_data_count() == 0:
|
||||
return
|
||||
|
||||
var bdata : BiomeData = data.get_biome_data(0)
|
||||
|
||||
var b : Biome
|
||||
|
||||
if bdata.target_script != null:
|
||||
b = bdata.target_script.new()
|
||||
|
||||
if b == null:
|
||||
print("biome is null. wrong type? " + bdata.resource_path)
|
||||
return
|
||||
elif bdata.target_class_name != "":
|
||||
if not ClassDB.class_exists(bdata.target_class_name):
|
||||
print("class doesnt exists" + bdata.resource_path)
|
||||
return
|
||||
|
||||
b = ClassDB.instance(bdata.target_class_name)
|
||||
else:
|
||||
b = Biome.new()
|
||||
|
||||
b.current_seed = current_seed
|
||||
b.data = bdata
|
||||
b.setup()
|
||||
add_biome(b)
|
||||
|
||||
func _setup_library(library):
|
||||
._setup_library(library)
|
||||
|
||||
for i in range(get_biome_count()):
|
||||
var b : Biome = get_biome(i)
|
||||
|
||||
if b != null:
|
||||
b.setup_library(library)
|
||||
|
||||
func _generate_chunk(chunk, spawn_mobs):
|
||||
if (get_biome_count() == 0):
|
||||
return
|
||||
|
||||
var b : Biome = get_biome(0)
|
||||
|
||||
b.generate_chunk(chunk, spawn_mobs)
|
Loading…
Reference in New Issue
Block a user