Added the resource properties to the inspector wherever they were needed.

This commit is contained in:
Relintai 2021-12-27 22:06:43 +01:00
parent f9662ed967
commit cfc3bc5ff7
2 changed files with 46 additions and 0 deletions

View File

@ -8,6 +8,27 @@ export(PropData) var prop_tree2 : PropData
var voxel_scale : float = 1 var voxel_scale : float = 1
var current_seed : int = 0 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: func get_editor_rect_border_color() -> Color:
return Color(0.8, 0.8, 0.8, 1) 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.spawn_mobs = spawn_mobs
dt.transform = Transform(Basis().scaled(Vector3(chunk.voxel_scale, chunk.voxel_scale, chunk.voxel_scale)), Vector3(x, vwh, z)) 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")

View File

@ -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) 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) 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: func get_editor_rect_border_color() -> Color:
return Color(0.8, 0.8, 0.8, 1) return Color(0.8, 0.8, 0.8, 1)
@ -45,3 +58,9 @@ func get_editor_class() -> String:
func get_editor_additional_text() -> String: func get_editor_additional_text() -> String:
return "Spawner" 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")