mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-12-25 01:17:10 +01:00
Now the planet generator uses Terraman. Also updated the modules, as I fixed a vmethod.
This commit is contained in:
parent
a4e54f048a
commit
3e07631361
2
HEADS
2
HEADS
@ -1 +1 @@
|
||||
{"engine": {"3.2": "94a0fc47f7b4e90f8973f9adbfd3312579ed2825", "master": "8c73e813134001e575b6f59e3b0100471c007410", "3.x": "eaeb650367c2dc3b053f24888e3155bdfc5ac083"}, "world_generator": {"master": "977114f072feccd5f6c2db2193807102cfb37862"}, "entity_spell_system": {"master": "3bbe1138973bafe57638e569e87d28b6e0a0eb46"}, "ui_extensions": {"master": "f1ae14c1be0750f65c77ecaad037dbe1cfb28269"}, "voxelman": {"master": "9253cc53c6fbbd78b5e4268eb498ef55b4dd0181"}, "texture_packer": {"master": "c712c4b30839400ba22e5a6b01f2a20fd9b311fa"}, "fastnoise": {"master": "d447fd5364e9ab5a6b14184483eab23cd3fe820b"}, "mesh_data_resource": {"master": "2cb2d2e558e00e55c8995b19d59e3b7c654b5210"}, "procedural_animations": {"master": "f8aae42bf06b3936cc6bd24cb18e1c3ec9f78f4f"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "props": {"master": "f4bc70c94e5042c2f8bc91b89bd5d476274f79cc"}, "mesh_utils": {"master": "9bd800489580680d4b778d78cc7b2449092caefd"}, "broken_seals_module": {"master": "4d8de70db8e48b283beb0b0537649e7e4f1b19e7"}, "thread_pool": {"master": "da4e049da09cb726a00f1edb1df935a2e8475902"}, "terraman": {"master": "a6d8ee6ae4505752b861c3ff96eefb73fbe2feee"}}
|
||||
{"engine": {"3.2": "94a0fc47f7b4e90f8973f9adbfd3312579ed2825", "master": "8c73e813134001e575b6f59e3b0100471c007410", "3.x": "eaeb650367c2dc3b053f24888e3155bdfc5ac083"}, "world_generator": {"master": "8c9a36fe28ae07101984e8521780361785b749c3"}, "entity_spell_system": {"master": "3bbe1138973bafe57638e569e87d28b6e0a0eb46"}, "ui_extensions": {"master": "f1ae14c1be0750f65c77ecaad037dbe1cfb28269"}, "voxelman": {"master": "9253cc53c6fbbd78b5e4268eb498ef55b4dd0181"}, "texture_packer": {"master": "c712c4b30839400ba22e5a6b01f2a20fd9b311fa"}, "fastnoise": {"master": "d447fd5364e9ab5a6b14184483eab23cd3fe820b"}, "mesh_data_resource": {"master": "2cb2d2e558e00e55c8995b19d59e3b7c654b5210"}, "procedural_animations": {"master": "f8aae42bf06b3936cc6bd24cb18e1c3ec9f78f4f"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "props": {"master": "f4bc70c94e5042c2f8bc91b89bd5d476274f79cc"}, "mesh_utils": {"master": "9bd800489580680d4b778d78cc7b2449092caefd"}, "broken_seals_module": {"master": "4d8de70db8e48b283beb0b0537649e7e4f1b19e7"}, "thread_pool": {"master": "da4e049da09cb726a00f1edb1df935a2e8475902"}, "terraman": {"master": "a6d8ee6ae4505752b861c3ff96eefb73fbe2feee"}}
|
@ -32,11 +32,7 @@ func _setup():
|
||||
var d : Dungeon = get_dungeon(i)
|
||||
d.setup()
|
||||
|
||||
func _generate_chunk(chunk: VoxelChunk, spawn_mobs: bool) -> void:
|
||||
# var chunk : VoxelChunk = chunk.get_chunk()
|
||||
|
||||
# generate_terrarin(chunk, spawn_mobs)\
|
||||
|
||||
func _generate_voxel_chunk(chunk: VoxelChunk, spawn_mobs: bool) -> void:
|
||||
if voxel_scale < 0:
|
||||
voxel_scale = chunk.voxel_scale
|
||||
|
||||
@ -68,6 +64,39 @@ func _generate_chunk(chunk: VoxelChunk, spawn_mobs: bool) -> void:
|
||||
(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_terra_chunk(chunk, spawn_mobs):
|
||||
if voxel_scale < 0:
|
||||
voxel_scale = chunk.voxel_scale
|
||||
|
||||
#todo generate this properly
|
||||
var entrance_position : Vector3 = Vector3(7, 5, 7)
|
||||
|
||||
for i in range(get_dungeon_count()):
|
||||
var d : Dungeon = get_dungeon(i)
|
||||
|
||||
if d.has_method("has_entrance_position"):
|
||||
d.entrance_position.origin = entrance_position
|
||||
|
||||
entrance_position = d.next_level_teleporter_position_data_space
|
||||
entrance_position *= voxel_scale
|
||||
|
||||
#terrarin_gen.generate_simple_terrarin(chunk, spawn_mobs)
|
||||
gen_terra_chunk(chunk)
|
||||
|
||||
for i in range(get_dungeon_count()):
|
||||
get_dungeon(i).generate_terra_chunk(chunk, spawn_mobs)
|
||||
|
||||
if not Engine.editor_hint and spawn_mobs and randi() % 4 == 0:
|
||||
var level : int = 1
|
||||
|
||||
if chunk.get_voxel_world().has_method("get_mob_level"):
|
||||
level = chunk.get_voxel_world().get_mob_level()
|
||||
|
||||
ESS.entity_spawner.spawn_mob(0, level, \
|
||||
Vector3(chunk.position_x * chunk.size_x * chunk.voxel_scale + chunk.size_x / 2,\
|
||||
100, \
|
||||
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
|
||||
@ -218,3 +247,26 @@ func box_blur(chunk : VoxelChunk):
|
||||
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)
|
||||
|
||||
func gen_terra_chunk(chunk: TerraChunk) -> void:
|
||||
chunk.channel_ensure_allocated(TerraChunkDefault.DEFAULT_CHANNEL_TYPE, 1)
|
||||
chunk.channel_ensure_allocated(TerraChunkDefault.DEFAULT_CHANNEL_ISOLEVEL, 0)
|
||||
|
||||
var s : OpenSimplexNoise = OpenSimplexNoise.new()
|
||||
s.seed = current_seed
|
||||
|
||||
for x in range(-chunk.margin_start, chunk.size_x + chunk.margin_end):
|
||||
for z in range(-chunk.margin_start, chunk.size_x + chunk.margin_end):
|
||||
var vx : int = x + (chunk.position_x * chunk.size_x)
|
||||
var vz : int = z + (chunk.position_z * chunk.size_z)
|
||||
|
||||
var val : float = (s.get_noise_2d(vx, vz) + 2)
|
||||
val *= val
|
||||
val *= 20.0
|
||||
|
||||
chunk.set_voxel(val, x, z, TerraChunkDefault.DEFAULT_CHANNEL_ISOLEVEL)
|
||||
|
||||
if val < 50:
|
||||
chunk.set_voxel(2, x, z, TerraChunkDefault.DEFAULT_CHANNEL_TYPE)
|
||||
elif val > 70:
|
||||
chunk.set_voxel(4, x, z, TerraChunkDefault.DEFAULT_CHANNEL_TYPE)
|
||||
|
@ -26,7 +26,7 @@ func _setup():
|
||||
sizey = 4
|
||||
sizez = 4
|
||||
|
||||
func a_generate_chunk(chunk : VoxelChunk, spawn_mobs: bool) -> void:
|
||||
func a_generate_voxel_chunk(chunk : VoxelChunk, spawn_mobs: bool) -> void:
|
||||
if chunk.position_x != 0 or chunk.position_z != 0:
|
||||
return
|
||||
|
||||
|
@ -111,15 +111,23 @@ func _setup():
|
||||
|
||||
build()
|
||||
|
||||
func _setup_library(library):
|
||||
._setup_library(library)
|
||||
func _setup_voxel_library(library):
|
||||
._setup_voxel_library(library)
|
||||
|
||||
if library is VoxelmanLibraryMerger:
|
||||
library.get_prop_packer().add_texture(wall_texture)
|
||||
library.get_prop_packer().add_texture(floor_texture)
|
||||
library.get_prop_packer().add_texture(ceiling_texture)
|
||||
|
||||
func _generate_chunk(chunk, spawn_mobs):
|
||||
func _setup_terra_library(library):
|
||||
._setup_terra_library(library)
|
||||
|
||||
if library is TerramanLibraryMerger:
|
||||
library.get_prop_packer().add_texture(wall_texture)
|
||||
library.get_prop_packer().add_texture(floor_texture)
|
||||
library.get_prop_packer().add_texture(ceiling_texture)
|
||||
|
||||
func _generate_voxel_chunk(chunk, spawn_mobs):
|
||||
var aabb : AABB = AABB(Vector3(posx - 1, posy - 1, posz - 1) * Vector3(chunk.voxel_scale, chunk.voxel_scale, chunk.voxel_scale), Vector3(sizex + 2, sizey + 2, sizez + 2) * Vector3(chunk.voxel_scale, chunk.voxel_scale, chunk.voxel_scale))
|
||||
var chunk_aabb : AABB = AABB(chunk.get_position() * Vector3(chunk.size_x, chunk.size_y, chunk.size_z) * Vector3(chunk.voxel_scale, chunk.voxel_scale, chunk.voxel_scale), Vector3(chunk.size_x, chunk.size_y, chunk.size_z) * Vector3(chunk.voxel_scale, chunk.voxel_scale, chunk.voxel_scale))
|
||||
|
||||
|
@ -95,7 +95,7 @@ func _setup():
|
||||
|
||||
build()
|
||||
|
||||
func _generate_chunk(chunk, spawn_mobs):
|
||||
func _generate_voxel_chunk(chunk, spawn_mobs):
|
||||
var aabb : AABB = AABB(Vector3(posx - 1, posy - 1, posz - 1) * Vector3(chunk.voxel_scale, chunk.voxel_scale, chunk.voxel_scale), Vector3(sizex + 2, sizey + 2, sizez + 2) * Vector3(chunk.voxel_scale, chunk.voxel_scale, chunk.voxel_scale))
|
||||
var chunk_aabb : AABB = AABB(chunk.get_position() * Vector3(chunk.size_x, chunk.size_y, chunk.size_z) * Vector3(chunk.voxel_scale, chunk.voxel_scale, chunk.voxel_scale), Vector3(chunk.size_x, chunk.size_y, chunk.size_z) * Vector3(chunk.voxel_scale, chunk.voxel_scale, chunk.voxel_scale))
|
||||
|
||||
|
@ -48,14 +48,25 @@ func _setup():
|
||||
#
|
||||
# add_dungeon(dung)
|
||||
|
||||
func _generate_chunk(chunk, spawn_mobs):
|
||||
func _generate_voxel_chunk(chunk, spawn_mobs):
|
||||
if (get_biome_count() == 0):
|
||||
return
|
||||
|
||||
var b : Biome = get_biome(0)
|
||||
|
||||
b.generate_chunk(chunk, spawn_mobs)
|
||||
b.generate_voxel_chunk(chunk, spawn_mobs)
|
||||
|
||||
for i in range(get_dungeon_count()):
|
||||
get_dungeon(i).generate_chunk(chunk, spawn_mobs)
|
||||
get_dungeon(i).generate_voxel_chunk(chunk, spawn_mobs)
|
||||
|
||||
func _generate_terra_chunk(chunk, spawn_mobs):
|
||||
if (get_biome_count() == 0):
|
||||
return
|
||||
|
||||
var b : Biome = get_biome(0)
|
||||
|
||||
b.generate_terra_chunk(chunk, spawn_mobs)
|
||||
|
||||
for i in range(get_dungeon_count()):
|
||||
get_dungeon(i).generate_terra_chunk(chunk, spawn_mobs)
|
||||
|
||||
|
@ -12,7 +12,7 @@ func _instance(p_seed, p_instance):
|
||||
|
||||
return p_instance
|
||||
|
||||
func _generate_chunk(chunk : VoxelChunk, spawn_mobs : bool):
|
||||
func _generate_voxel_chunk(chunk : VoxelChunk, spawn_mobs : bool):
|
||||
if trainer == null || vendor == null:
|
||||
return
|
||||
|
||||
@ -24,3 +24,16 @@ func _generate_chunk(chunk : VoxelChunk, spawn_mobs : bool):
|
||||
pos = Vector3(2 * chunk.voxel_scale, 8 * chunk.voxel_scale, 2 * chunk.voxel_scale)
|
||||
|
||||
ESS.entity_spawner.spawn_mob(vendor.id, 1, pos)
|
||||
|
||||
func _generate_terra_chunk(chunk : TerraChunk, spawn_mobs : bool):
|
||||
if trainer == null || vendor == null:
|
||||
return
|
||||
|
||||
if chunk.position_x == 0 && chunk.position_z == 0:
|
||||
var pos : Vector3 = Vector3(4 * chunk.voxel_scale, 8 * chunk.voxel_scale, 4 * chunk.voxel_scale)
|
||||
|
||||
ESS.entity_spawner.spawn_mob(trainer.id, 1, pos)
|
||||
|
||||
pos = Vector3(2 * chunk.voxel_scale, 8 * chunk.voxel_scale, 2 * chunk.voxel_scale)
|
||||
|
||||
ESS.entity_spawner.spawn_mob(vendor.id, 1, pos)
|
||||
|
@ -154,6 +154,11 @@ _global_script_classes=[ {
|
||||
"language": "GDScript",
|
||||
"path": "res://scripts/world_generators/MainPlanetGenerator.gd"
|
||||
}, {
|
||||
"base": "TerramanLevelGenerator",
|
||||
"class": "MainTPlanetGenerator",
|
||||
"language": "GDScript",
|
||||
"path": "res://scripts/world_generators/MainTPlanetGenerator.gd"
|
||||
}, {
|
||||
"base": "EntityResource",
|
||||
"class": "ManaResource",
|
||||
"language": "GDScript",
|
||||
@ -254,6 +259,7 @@ _global_script_class_icons={
|
||||
"LayeredTextureMaker": "",
|
||||
"Main": "",
|
||||
"MainPlanetGenerator": "",
|
||||
"MainTPlanetGenerator": "",
|
||||
"ManaResource": "",
|
||||
"Menu": "",
|
||||
"MobGD": "",
|
||||
|
@ -7,14 +7,14 @@
|
||||
[ext_resource path="res://modules/planets/test_planet/DungeonPlanetData.tres" type="Planet" id=5]
|
||||
[ext_resource path="res://voxelman/world/TVVoxelWorld.gd" type="Script" id=8]
|
||||
|
||||
[sub_resource type="VoxelmanLevelGenerator" id=50]
|
||||
[sub_resource type="VoxelmanLevelGenerator" id=1]
|
||||
script = ExtResource( 1 )
|
||||
_force_planet = -1
|
||||
_level_seed = 0
|
||||
_spawn_mobs = false
|
||||
planet = ExtResource( 5 )
|
||||
|
||||
[sub_resource type="ProceduralSky" id=48]
|
||||
[sub_resource type="ProceduralSky" id=2]
|
||||
sky_top_color = Color( 0.34902, 0.643137, 0.705882, 1 )
|
||||
sky_horizon_color = Color( 0.27451, 0.278431, 0.207843, 1 )
|
||||
sky_curve = 0.263535
|
||||
@ -31,9 +31,9 @@ sun_angle_max = 23.15
|
||||
sun_energy = 9.29
|
||||
texture_size = 0
|
||||
|
||||
[sub_resource type="Environment" id=49]
|
||||
[sub_resource type="Environment" id=3]
|
||||
background_mode = 2
|
||||
background_sky = SubResource( 48 )
|
||||
background_sky = SubResource( 2 )
|
||||
ambient_light_color = Color( 0.870588, 0.870588, 0.870588, 1 )
|
||||
ambient_light_energy = 1.67
|
||||
ambient_light_sky_contribution = 0.09
|
||||
@ -62,7 +62,7 @@ data_margin_end = 2
|
||||
max_concurrent_generations = 8
|
||||
max_frame_chunk_build_steps = 4
|
||||
library = ExtResource( 2 )
|
||||
level_generator = SubResource( 50 )
|
||||
level_generator = SubResource( 1 )
|
||||
voxel_scale = 2.0
|
||||
chunk_spawn_range = 6
|
||||
build_flags = 511
|
||||
@ -73,7 +73,7 @@ spawn_height = 3
|
||||
test_prop = ExtResource( 4 )
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource( 49 )
|
||||
environment = SubResource( 3 )
|
||||
__meta__ = {
|
||||
"_editor_description_": ""
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ func _generate_chunk(chunk : VoxelChunk) -> void:
|
||||
if _planet == null:
|
||||
return
|
||||
|
||||
_planet.generate_chunk(chunk, _spawn_mobs)
|
||||
_planet.generate_voxel_chunk(chunk, _spawn_mobs)
|
||||
|
||||
func create_planet():
|
||||
var planet_files : Array = get_planets(planet_folder)
|
||||
|
104
game/scripts/world_generators/MainTPlanetGenerator.gd
Normal file
104
game/scripts/world_generators/MainTPlanetGenerator.gd
Normal file
@ -0,0 +1,104 @@
|
||||
tool
|
||||
extends TerramanLevelGenerator
|
||||
class_name MainTPlanetGenerator
|
||||
|
||||
# Copyright (c) 2019-2021 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.
|
||||
|
||||
const planet_folder : String = "res://modules/planets"
|
||||
|
||||
export(int) var _force_planet : int = -1
|
||||
export(int) var _level_seed : int
|
||||
export(bool) var _spawn_mobs : bool
|
||||
export(Planet) var planet : Planet = null
|
||||
|
||||
var _world : TerraWorld
|
||||
var _planet : Planet
|
||||
var _library : TerramanLibrary
|
||||
|
||||
func setup(world : TerraWorld, level_seed : int, spawn_mobs : bool, library: TerramanLibrary) -> void:
|
||||
_level_seed = level_seed
|
||||
_world = world
|
||||
_spawn_mobs = spawn_mobs
|
||||
_library = library
|
||||
|
||||
if planet != null:
|
||||
_planet = planet.instance(_level_seed)
|
||||
_planet.current_seed = _level_seed
|
||||
_planet.setup()
|
||||
_planet.setup_terra_library(_library)
|
||||
_library.refresh_rects()
|
||||
|
||||
# create_planet()
|
||||
|
||||
func _generate_chunk(chunk : TerraChunk) -> void:
|
||||
if _planet == null:
|
||||
return
|
||||
|
||||
_planet.generate_terra_chunk(chunk, _spawn_mobs)
|
||||
|
||||
func create_planet():
|
||||
var planet_files : Array = get_planets(planet_folder)
|
||||
|
||||
if planet_files.size() == 0:
|
||||
return
|
||||
|
||||
var ind : int
|
||||
if _force_planet == -1:
|
||||
seed(_level_seed)
|
||||
ind = randi() % planet_files.size()
|
||||
else:
|
||||
ind = _force_planet
|
||||
|
||||
var planet_data : Planet = ResourceLoader.load(planet_files[ind], "Planet")
|
||||
|
||||
if planet_data == null:
|
||||
print("planet_data is null!")
|
||||
return
|
||||
|
||||
print("planet loaded: " + planet_data.resource_path)
|
||||
|
||||
_planet = planet_data.instance(_level_seed)
|
||||
|
||||
_planet.current_seed = _level_seed
|
||||
_planet.data = planet_data
|
||||
_planet.setup()
|
||||
_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
|
@ -83,8 +83,8 @@ func on_settings_loaded():
|
||||
vis_update += VIS_UPDATE_INTERVAL
|
||||
|
||||
func generate():
|
||||
#if level_generator != null:
|
||||
# level_generator.setup(self, 80, false, library)
|
||||
if level_generator != null:
|
||||
level_generator.setup(self, 80, false, library)
|
||||
|
||||
spawn(0, 0)
|
||||
|
||||
@ -319,8 +319,8 @@ func setup_client_seed(pseed : int) -> void:
|
||||
|
||||
Server.sset_seed(pseed)
|
||||
|
||||
#if level_generator != null:
|
||||
#level_generator.setup(self, pseed, false, library)
|
||||
if level_generator != null:
|
||||
level_generator.setup(self, pseed, false, library)
|
||||
|
||||
spawn(0, 0)
|
||||
|
||||
@ -336,8 +336,8 @@ func load_character(file_name : String) -> void:
|
||||
|
||||
Server.sset_seed(_player.sseed)
|
||||
|
||||
#if level_generator != null:
|
||||
# level_generator.setup(self, _player.sseed, true, library)
|
||||
if level_generator != null:
|
||||
level_generator.setup(self, _player.sseed, true, library)
|
||||
|
||||
spawn(0, 0)
|
||||
|
||||
|
@ -1,12 +1,20 @@
|
||||
[gd_scene load_steps=8 format=2]
|
||||
[gd_scene load_steps=10 format=2]
|
||||
|
||||
[ext_resource path="res://tw/new_terramanlibrarymerger.tres" type="TerramanLibraryMerger" id=1]
|
||||
[ext_resource path="res://tw/TerraWorldBlocky.gd" type="Script" id=2]
|
||||
[ext_resource path="res://tw/new_terramanlevelgenerator.tres" type="TerramanLevelGenerator" id=3]
|
||||
[ext_resource path="res://scripts/world_generators/MainTPlanetGenerator.gd" type="Script" id=3]
|
||||
[ext_resource path="res://scripts/settings/DirectionalLightSettings.gd" type="Script" id=4]
|
||||
[ext_resource path="res://test_props/MeshDataInstance.tres" type="PropData" id=5]
|
||||
[ext_resource path="res://modules/planets/test_planet/DungeonPlanetData.tres" type="Planet" id=6]
|
||||
|
||||
[sub_resource type="ProceduralSky" id=1]
|
||||
[sub_resource type="TerramanLevelGenerator" id=1]
|
||||
script = ExtResource( 3 )
|
||||
_force_planet = -1
|
||||
_level_seed = 0
|
||||
_spawn_mobs = false
|
||||
planet = ExtResource( 6 )
|
||||
|
||||
[sub_resource type="ProceduralSky" id=2]
|
||||
sky_top_color = Color( 0.34902, 0.643137, 0.705882, 1 )
|
||||
sky_horizon_color = Color( 0.27451, 0.278431, 0.207843, 1 )
|
||||
sky_curve = 0.263535
|
||||
@ -23,9 +31,9 @@ sun_angle_max = 23.15
|
||||
sun_energy = 9.29
|
||||
texture_size = 0
|
||||
|
||||
[sub_resource type="Environment" id=2]
|
||||
[sub_resource type="Environment" id=3]
|
||||
background_mode = 2
|
||||
background_sky = SubResource( 1 )
|
||||
background_sky = SubResource( 2 )
|
||||
ambient_light_color = Color( 0.870588, 0.870588, 0.870588, 1 )
|
||||
ambient_light_energy = 1.67
|
||||
ambient_light_sky_contribution = 0.09
|
||||
@ -50,7 +58,7 @@ glow_hdr_luminance_cap = 1.0
|
||||
[node name="World" type="TerraWorldBlocky"]
|
||||
world_height = 100.0
|
||||
library = ExtResource( 1 )
|
||||
level_generator = ExtResource( 3 )
|
||||
level_generator = SubResource( 1 )
|
||||
voxel_scale = 2.0
|
||||
build_flags = 510
|
||||
num_lods = 1
|
||||
@ -58,7 +66,7 @@ script = ExtResource( 2 )
|
||||
test_prop = ExtResource( 5 )
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource( 2 )
|
||||
environment = SubResource( 3 )
|
||||
__meta__ = {
|
||||
"_editor_description_": ""
|
||||
}
|
||||
|
@ -1,11 +1,17 @@
|
||||
tool
|
||||
extends TerramanLevelGenerator
|
||||
|
||||
var lseed = 0
|
||||
|
||||
func setup(world : TerraWorld, level_seed : int, spawn_mobs : bool, library: TerramanLibrary) -> void:
|
||||
lseed = level_seed
|
||||
|
||||
func _generate_chunk(chunk: TerraChunk) -> void:
|
||||
chunk.channel_ensure_allocated(TerraChunkDefault.DEFAULT_CHANNEL_TYPE, 1)
|
||||
chunk.channel_ensure_allocated(TerraChunkDefault.DEFAULT_CHANNEL_ISOLEVEL, 0)
|
||||
|
||||
var s : OpenSimplexNoise = OpenSimplexNoise.new()
|
||||
s.seed = lseed
|
||||
|
||||
for x in range(-chunk.margin_start, chunk.size_x + chunk.margin_end):
|
||||
for z in range(-chunk.margin_start, chunk.size_x + chunk.margin_end):
|
||||
|
Loading…
Reference in New Issue
Block a user