Updated WorldGenerator to the latest. I removed Dungeon, DungeonRoom adn DungeonCorridor, and added a Building class (it's a cleaned up version of Dungeon right now, it will work differently later.).

This commit is contained in:
Relintai 2021-04-19 22:30:51 +02:00
parent a3634380ed
commit 7e272029d1
19 changed files with 25 additions and 147 deletions

2
HEADS
View File

@ -1 +1 @@
{"engine": {"3.2": "94a0fc47f7b4e90f8973f9adbfd3312579ed2825", "master": "8c73e813134001e575b6f59e3b0100471c007410", "3.x": "bb10729c6ee1051965b564c43bb4493e6e7459a5"}, "world_generator": {"master": "d289ee942c19f75ae0ecbdc1d0f38a84ec4ff3e3"}, "entity_spell_system": {"master": "378ebcff23e5ab0a04c0e92119d26391de4be139"}, "ui_extensions": {"master": "f82273f54cb1ab87d458c91af9554acec5c10831"}, "voxelman": {"master": "9253cc53c6fbbd78b5e4268eb498ef55b4dd0181"}, "texture_packer": {"master": "dbf3c59a9c52f155f0d98b567d571708e8b3f253"}, "fastnoise": {"master": "d447fd5364e9ab5a6b14184483eab23cd3fe820b"}, "mesh_data_resource": {"master": "679064ea4f1fe81d14e18b3db9e113384e99cf84"}, "procedural_animations": {"master": "f8aae42bf06b3936cc6bd24cb18e1c3ec9f78f4f"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "props": {"master": "6f418a07d491539b0bcd0bf16e84211e950cb21c"}, "mesh_utils": {"master": "6725a4906c0a039eaff4c46c8dea00f6b1b99045"}, "broken_seals_module": {"master": "8bfe7efe6940c701bc9296d6e4eb565b36b6527b"}, "thread_pool": {"master": "b2e8c815392052947e7386f722913a12eea543a4"}, "terraman": {"master": "034f3b563f6dffc27accf1cc830109f23df9902c"}}
{"engine": {"3.2": "94a0fc47f7b4e90f8973f9adbfd3312579ed2825", "master": "8c73e813134001e575b6f59e3b0100471c007410", "3.x": "bb10729c6ee1051965b564c43bb4493e6e7459a5"}, "world_generator": {"master": "260c430f11b0b591eaf4714516419aa327d2842c"}, "entity_spell_system": {"master": "378ebcff23e5ab0a04c0e92119d26391de4be139"}, "ui_extensions": {"master": "f82273f54cb1ab87d458c91af9554acec5c10831"}, "voxelman": {"master": "9253cc53c6fbbd78b5e4268eb498ef55b4dd0181"}, "texture_packer": {"master": "dbf3c59a9c52f155f0d98b567d571708e8b3f253"}, "fastnoise": {"master": "d447fd5364e9ab5a6b14184483eab23cd3fe820b"}, "mesh_data_resource": {"master": "679064ea4f1fe81d14e18b3db9e113384e99cf84"}, "procedural_animations": {"master": "f8aae42bf06b3936cc6bd24cb18e1c3ec9f78f4f"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "props": {"master": "6f418a07d491539b0bcd0bf16e84211e950cb21c"}, "mesh_utils": {"master": "6725a4906c0a039eaff4c46c8dea00f6b1b99045"}, "broken_seals_module": {"master": "8bfe7efe6940c701bc9296d6e4eb565b36b6527b"}, "thread_pool": {"master": "b2e8c815392052947e7386f722913a12eea543a4"}, "terraman": {"master": "034f3b563f6dffc27accf1cc830109f23df9902c"}}

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
extends Dungeon
extends Building
# Declare member variables here. Examples:

View File

@ -1,9 +1,8 @@
[gd_resource type="Biome" load_steps=4 format=2]
[gd_resource type="Biome" load_steps=3 format=2]
[ext_resource path="res://modules/planets/test_planet/biomes/simple_biome.gd" type="Script" id=1]
[ext_resource path="res://modules/planets/test_planet/dungeons/vman_dungeon.tres" type="Dungeon" id=2]
[ext_resource path="res://modules/planets/test_planet/villages/village.tres" type="Dungeon" id=3]
[ext_resource path="res://modules/planets/test_planet/villages/village.tres" type="Building" id=2]
[resource]
dungeons = [ ExtResource( 2 ), ExtResource( 3 ) ]
buildings = [ ExtResource( 2 ) ]
script = ExtResource( 1 )

View File

@ -28,8 +28,8 @@ var voxel_scale : float = -1
func _setup():
terrarin_gen.set_current_seed(current_seed)
for i in range(get_dungeon_count()):
var d : Dungeon = get_dungeon(i)
for i in range(get_building_count()):
var d : Building = get_building(i)
d.setup()
func _generate_terra_chunk(chunk, spawn_mobs):
@ -39,8 +39,8 @@ func _generate_terra_chunk(chunk, spawn_mobs):
#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)
for i in range(get_building_count()):
var d : Building = get_building(i)
if d.has_method("has_entrance_position"):
d.entrance_position.origin = entrance_position
@ -51,8 +51,8 @@ func _generate_terra_chunk(chunk, spawn_mobs):
#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)
for i in range(get_building_count()):
get_building(i).generate_terra_chunk(chunk, spawn_mobs)
if not Engine.editor_hint and spawn_mobs and randi() % 4 == 0:
var level : int = 1

View File

@ -1,6 +0,0 @@
[gd_resource type="DungeonRoom" load_steps=2 format=2]
[ext_resource path="res://modules/planets/test_planet/dungeon_rooms/dungeon_room.tres" type="DungeonRoom" id=1]
[resource]
dungeon_room = ExtResource( 1 )

View File

@ -1,6 +0,0 @@
[gd_resource type="DungeonRoom" load_steps=2 format=2]
[ext_resource path="res://modules/planets/test_planet/dungeon_rooms/dungeon_room.tres" type="DungeonRoom" id=1]
[resource]
dungeon_room = ExtResource( 1 )

View File

@ -1,3 +0,0 @@
[gd_resource type="DungeonRoom" format=2]
[resource]

View File

@ -1,100 +0,0 @@
tool
extends DungeonRoom
# 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.
func _setup():
sizex = 4
sizey = 4
sizez = 4
#
#func a_generate_voxel_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)
#
#

View File

@ -1,6 +0,0 @@
[gd_resource type="DungeonRoom" load_steps=2 format=2]
[ext_resource path="res://modules/planets/test_planet/dungeon_start_rooms/start_room.gd" type="Script" id=1]
[resource]
script = ExtResource( 1 )

View File

@ -1,3 +1,3 @@
[gd_resource type="Dungeon" format=2]
[gd_resource type="Building" format=2]
[resource]

View File

@ -1,5 +1,5 @@
tool
extends Dungeon
extends Building
# Copyright (c) 2019-2021 Péter Magyar
#

View File

@ -1,4 +1,4 @@
[gd_resource type="Dungeon" load_steps=12 format=2]
[gd_resource type="Building" load_steps=12 format=2]
[ext_resource path="res://modules/planets/test_planet/dungeons/dungeon.gd" type="Script" id=1]
[ext_resource path="res://modules/species/Human/Female/character_models/huf_calf_left.gltf" type="MeshDataResource" id=2]

View File

@ -1,4 +1,4 @@
[gd_resource type="Dungeon" load_steps=12 format=2]
[gd_resource type="Building" load_steps=12 format=2]
[ext_resource path="res://modules/planets/test_planet/dungeons/dungeon.gd" type="Script" id=1]
[ext_resource path="res://modules/species/Human/Female/character_models/huf_calf_left.gltf" type="MeshDataResource" id=2]

View File

@ -1,5 +1,5 @@
tool
extends Dungeon
extends Building
# Copyright (c) 2019-2021 Péter Magyar
#
@ -72,7 +72,7 @@ func _instance(p_seed, p_instance):
func _setup():
if sizex == 0 || sizey == 0 || sizez == 0:
print("Dungeon size is 0!")
print("Building size is 0!")
return
# entrance_position.origin = Vector3(7, 5, 7)

View File

@ -1,4 +1,4 @@
[gd_resource type="Dungeon" load_steps=3 format=2]
[gd_resource type="Building" load_steps=3 format=2]
[ext_resource path="res://modules/planets/test_planet/dungeons/vman_dungeon.gd" type="Script" id=1]
[ext_resource path="res://modules/planets/test_planet/dungeons/dung_teleporter.tscn" type="PackedScene" id=2]

View File

@ -56,8 +56,8 @@ func _generate_voxel_chunk(chunk, spawn_mobs):
b.generate_voxel_chunk(chunk, spawn_mobs)
for i in range(get_dungeon_count()):
get_dungeon(i).generate_voxel_chunk(chunk, spawn_mobs)
for i in range(get_building_count()):
get_building(i).generate_voxel_chunk(chunk, spawn_mobs)
func _generate_terra_chunk(chunk, spawn_mobs):
if (get_biome_count() == 0):
@ -67,6 +67,6 @@ func _generate_terra_chunk(chunk, spawn_mobs):
b.generate_terra_chunk(chunk, spawn_mobs)
for i in range(get_dungeon_count()):
get_dungeon(i).generate_terra_chunk(chunk, spawn_mobs)
for i in range(get_building_count()):
get_building(i).generate_terra_chunk(chunk, spawn_mobs)

View File

@ -1,5 +1,5 @@
tool
extends Dungeon
extends Building
export (EntityData) var trainer : EntityData
export (EntityData) var vendor : EntityData

View File

@ -1,4 +1,4 @@
[gd_resource type="Dungeon" load_steps=4 format=2]
[gd_resource type="Building" load_steps=4 format=2]
[ext_resource path="res://modules/planets/test_planet/villages/village.gd" type="Script" id=1]
[ext_resource path="res://modules/entity_classes/naturalist/entities/3_naturalist_trainer.tres" type="EntityData" id=2]