Removed the world generator module.

This commit is contained in:
Relintai 2021-07-12 01:00:04 +02:00
parent 8fb2d02977
commit e0b1549475
3 changed files with 14 additions and 117 deletions

View File

@ -48,7 +48,7 @@ exports = {
engine_repository = [ ['https://github.com/godotengine/godot.git', 'git@github.com:godotengine/godot.git'], 'engine', '' ]
module_repositories = [
[ ['https://github.com/Relintai/world_generator.git', 'git@github.com:Relintai/world_generator.git'], 'world_generator', '' ],
[ ['https://github.com/Relintai/entity_spell_system.git', 'git@github.com:Relintai/entity_spell_system.git'], 'entity_spell_system', '' ],
[ ['https://github.com/Relintai/ui_extensions.git', 'git@github.com:Relintai/ui_extensions.git'], 'ui_extensions', '' ],
[ ['https://github.com/Relintai/texture_packer.git', 'git@github.com:Relintai/texture_packer.git'], 'texture_packer', '' ],
@ -56,6 +56,10 @@ module_repositories = [
[ ['https://github.com/Relintai/thread_pool.git', 'git@github.com:Relintai/thread_pool.git'], 'thread_pool', '' ],
]
removed_modules = [
[ ['https://github.com/Relintai/world_generator.git', 'git@github.com:Relintai/world_generator.git'], 'world_generator', '' ],
]
addon_repositories = [
]
@ -182,6 +186,12 @@ def copytree(src, dst):
shutil.copy2(sp, dp)
def remove_repository(data, target_folder):
folder = os.path.abspath(target_folder + data[1])
if os.path.isdir(folder):
shutil.rmtree(folder)
def update_engine():
update_repository(engine_repository, '/', godot_branch)
@ -217,6 +227,9 @@ def setup_modules():
setup_repository(rep, module_clone_path)
copy_repository(rep, './engine/modules/', '.' + module_clone_path)
for rep in removed_modules:
remove_repository(rep, './engine/modules/')
def setup_addons():
for rep in addon_repositories:
setup_repository(rep, module_clone_path)

View File

@ -314,11 +314,6 @@ _global_script_classes=[ {
"language": "GDScript",
"path": "res://scenes/MainScene.gd"
}, {
"base": "Resource",
"class": "MainPlanetGenerator",
"language": "GDScript",
"path": "res://scripts/world_generators/MainPlanetGenerator.gd"
}, {
"base": "EntityResource",
"class": "ManaResource",
"language": "GDScript",
@ -436,7 +431,6 @@ _global_script_class_icons={
"ItemVisualEntry2D": "",
"LayeredTextureMaker": "",
"Main": "",
"MainPlanetGenerator": "",
"ManaResource": "",
"Menu": "",
"MobGD": "",

View File

@ -1,110 +0,0 @@
tool
#extends VoxelmanLevelGenerator
extends Resource
class_name MainPlanetGenerator
# 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.
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
#var _world : VoxelWorld
var _planet : Planet
#var _library : VoxelmanLibrary
#func setup(world : VoxelWorld, level_seed : int, spawn_mobs : bool, library: VoxelmanLibrary) -> void:
# _level_seed = level_seed
# _world = world
# _spawn_mobs = spawn_mobs
# _library = library
#
# create_planet()
#func _generate_chunk(chunk : VoxelChunk) -> void:
# if _planet == null:
# return
#
# _planet.generate_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)
if planet_data.target_script != null:
_planet = planet_data.target_script.new()
if _planet == null:
print("_planet is null. wrong type? " + planet_data.resource_path)
return
elif planet_data.target_class_name != "":
if not ClassDB.class_exists(planet_data.target_class_name):
print("class doesnt exists" + planet_data.resource_path)
return
_planet = ClassDB.instance(planet_data.target_class_name)
else:
_planet = Planet.new()
_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