From cfc3bc5ff713dbe061692859831f421908060a36 Mon Sep 17 00:00:00 2001 From: Relintai Date: Mon, 27 Dec 2021 22:06:43 +0100 Subject: [PATCH] Added the resource properties to the inspector wherever they were needed. --- .../continents/test_continent.gd | 27 +++++++++++++++++++ game/world_generator/subzones/spawner.gd | 19 +++++++++++++ 2 files changed, 46 insertions(+) diff --git a/game/world_generator/continents/test_continent.gd b/game/world_generator/continents/test_continent.gd index c387cb53..d3dbc82d 100644 --- a/game/world_generator/continents/test_continent.gd +++ b/game/world_generator/continents/test_continent.gd @@ -8,6 +8,27 @@ export(PropData) var prop_tree2 : PropData var voxel_scale : float = 1 var current_seed : int = 0 +func get_dungeon_teleporter() -> PackedScene: + return dungeon_teleporter + +func set_dungeon_teleporter(ed : PackedScene) -> void: + dungeon_teleporter = ed + emit_changed() + +func get_prop_tree() -> PropData: + return prop_tree + +func set_prop_tree(ed : PropData) -> void: + prop_tree = ed + emit_changed() + +func get_prop_tree2() -> PropData: + return prop_tree2 + +func set_prop_tree2(ed : PropData) -> void: + prop_tree2 = ed + emit_changed() + func get_editor_rect_border_color() -> Color: return Color(0.8, 0.8, 0.8, 1) @@ -149,3 +170,9 @@ func spawn_dungeon(chunk: TerraChunk, dungeon_seed : int, spawn_mobs : bool) -> dt.spawn_mobs = spawn_mobs dt.transform = Transform(Basis().scaled(Vector3(chunk.voxel_scale, chunk.voxel_scale, chunk.voxel_scale)), Vector3(x, vwh, z)) +func setup_property_inspector(inspector) -> void: + .setup_property_inspector(inspector) + + inspector.add_slot_resource("get_dungeon_teleporter", "set_dungeon_teleporter", "Dungeon Teleporter", "PackedScene") + inspector.add_slot_resource("get_prop_tree", "set_prop_tree", "Prop Tree", "PropData") + inspector.add_slot_resource("get_prop_tree2", "set_prop_tree2", "Prop Tree2", "PropData") diff --git a/game/world_generator/subzones/spawner.gd b/game/world_generator/subzones/spawner.gd index 91297ca6..6912bb63 100644 --- a/game/world_generator/subzones/spawner.gd +++ b/game/world_generator/subzones/spawner.gd @@ -27,6 +27,19 @@ func _generate_terra_chunk(chunk: TerraChunk, pseed : int, spawn_mobs: bool, sta pos = Vector3(main_chunk_pos_x * chunk.get_size_x() * chunk.voxel_scale + 2, 50 * chunk.voxel_scale, main_chunk_pos_z * chunk.get_size_z() * chunk.voxel_scale + 2) ESS.entity_spawner.spawn_mob(vendor.id, 1, pos) +func get_trainer() -> EntityData: + return trainer + +func set_trainer(ed : EntityData) -> void: + trainer = ed + emit_changed() + +func get_vendor() -> EntityData: + return vendor + +func set_vendor(ed : EntityData) -> void: + vendor = ed + emit_changed() func get_editor_rect_border_color() -> Color: return Color(0.8, 0.8, 0.8, 1) @@ -45,3 +58,9 @@ func get_editor_class() -> String: func get_editor_additional_text() -> String: return "Spawner" + +func setup_property_inspector(inspector) -> void: + .setup_property_inspector(inspector) + + inspector.add_slot_resource("get_trainer", "set_trainer", "Trainer", "EntityData") + inspector.add_slot_resource("get_vendor", "set_vendor", "Vendor", "EntityData")