From da3109f98feb35291ac2f420421de4c17bd5822c Mon Sep 17 00:00:00 2001 From: Relintai Date: Mon, 27 Dec 2021 16:55:51 +0100 Subject: [PATCH] Also remove the MainTPlanetGenerator. --- game/project.godot | 6 - .../world_generators/MainTPlanetGenerator.gd | 104 ------------------ 2 files changed, 110 deletions(-) delete mode 100644 game/scripts/world_generators/MainTPlanetGenerator.gd diff --git a/game/project.godot b/game/project.godot index 804fe7c5..82b99142 100644 --- a/game/project.godot +++ b/game/project.godot @@ -169,11 +169,6 @@ _global_script_classes=[ { "language": "GDScript", "path": "res://scenes/MainScene.gd" }, { -"base": "TerramanLevelGenerator", -"class": "MainTPlanetGenerator", -"language": "GDScript", -"path": "res://scripts/world_generators/MainTPlanetGenerator.gd" -}, { "base": "EntityResource", "class": "ManaResource", "language": "GDScript", @@ -302,7 +297,6 @@ _global_script_class_icons={ "MMNode": "", "MMNodeUniversalProperty": "", "Main": "", -"MainTPlanetGenerator": "", "ManaResource": "", "Menu": "", "MobGD": "", diff --git a/game/scripts/world_generators/MainTPlanetGenerator.gd b/game/scripts/world_generators/MainTPlanetGenerator.gd deleted file mode 100644 index 4f82b748..00000000 --- a/game/scripts/world_generators/MainTPlanetGenerator.gd +++ /dev/null @@ -1,104 +0,0 @@ -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