mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-11-13 20:47:19 +01:00
Added an another layer to the world generator addon. Now subzones contain subzone props. Reworked the old subzones into these.
This commit is contained in:
parent
d66c678db4
commit
487b05fecb
7
game/addons/world_generator/resources/sub_zone_prop.gd
Normal file
7
game/addons/world_generator/resources/sub_zone_prop.gd
Normal file
@ -0,0 +1,7 @@
|
||||
tool
|
||||
extends "res://addons/world_generator/resources/world_gen_base_resource.gd"
|
||||
class_name SubZoneProp
|
||||
|
||||
func setup_property_inspector(inspector) -> void:
|
||||
.setup_property_inspector(inspector)
|
||||
|
@ -2,6 +2,37 @@ tool
|
||||
extends "res://addons/world_generator/resources/world_gen_base_resource.gd"
|
||||
class_name SubZone
|
||||
|
||||
export(Array) var subzone_props : Array
|
||||
|
||||
func get_content() -> Array:
|
||||
return subzone_props
|
||||
|
||||
func set_content(arr : Array) -> void:
|
||||
subzone_props = arr
|
||||
|
||||
func create_content(item_name : String = "") -> void:
|
||||
var subzone_prop : SubZoneProp = SubZoneProp.new()
|
||||
subzone_prop.resource_name = item_name
|
||||
|
||||
var r : Rect2 = get_rect()
|
||||
r.position = Vector2()
|
||||
r.size.x /= 10.0
|
||||
r.size.y /= 10.0
|
||||
|
||||
subzone_prop.set_rect(r)
|
||||
|
||||
add_content(subzone_prop)
|
||||
|
||||
func add_content(entry : WorldGenBaseResource) -> void:
|
||||
subzone_props.append(entry)
|
||||
emit_changed()
|
||||
|
||||
func remove_content_entry(entry : WorldGenBaseResource) -> void:
|
||||
for i in range(subzone_props.size()):
|
||||
if subzone_props[i] == entry:
|
||||
subzone_props.remove(i)
|
||||
emit_changed()
|
||||
return
|
||||
|
||||
func setup_property_inspector(inspector) -> void:
|
||||
.setup_property_inspector(inspector)
|
||||
|
||||
|
@ -5,11 +5,13 @@ class_name WorldGeneratorSettings
|
||||
export(PoolStringArray) var continent_class_folders : PoolStringArray
|
||||
export(PoolStringArray) var zone_class_folders : PoolStringArray
|
||||
export(PoolStringArray) var subzone_class_folders : PoolStringArray
|
||||
export(PoolStringArray) var subzone_prop_class_folders : PoolStringArray
|
||||
|
||||
enum WorldGeneratorScriptType {
|
||||
CONTINENT = 0,
|
||||
ZONE = 1,
|
||||
SUBZONE = 2,
|
||||
SUBZONE_PROP = 3,
|
||||
};
|
||||
|
||||
func evaluate_scripts(script_type : int, tree : Tree) -> void:
|
||||
@ -19,6 +21,8 @@ func evaluate_scripts(script_type : int, tree : Tree) -> void:
|
||||
evaluate_zone_scripts(tree)
|
||||
elif (script_type == WorldGeneratorScriptType.SUBZONE):
|
||||
evaluate_subzone_scripts(tree)
|
||||
elif (script_type == WorldGeneratorScriptType.SUBZONE_PROP):
|
||||
evaluate_subzone_prop_scripts(tree)
|
||||
|
||||
func evaluate_continent_scripts(tree : Tree) -> void:
|
||||
tree.clear()
|
||||
@ -56,6 +60,18 @@ func evaluate_subzone_scripts(tree : Tree) -> void:
|
||||
|
||||
root.select(0)
|
||||
|
||||
func evaluate_subzone_prop_scripts(tree : Tree) -> void:
|
||||
tree.clear()
|
||||
|
||||
var root : TreeItem = tree.create_item()
|
||||
root.set_text(0, "SubZoneProp")
|
||||
root.set_meta("class_name", "SubZoneProp")
|
||||
|
||||
for s in subzone_prop_class_folders:
|
||||
evaluate_folder(s, tree, root)
|
||||
|
||||
root.select(0)
|
||||
|
||||
func evaluate_folder(folder : String, tree : Tree, root : TreeItem) -> void:
|
||||
var ti : TreeItem = null
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
tool
|
||||
extends Tree
|
||||
|
||||
export(int, "Continent,Zone,Sub Zone") var class_types : int = 0
|
||||
export(int, "Continent,Zone,Sub Zone,Sub Zone Prop") var class_types : int = 0
|
||||
|
||||
var edited_resource : WorldGenBaseResource = null
|
||||
var name_edited_resource : WorldGenBaseResource = null
|
||||
|
@ -8,12 +8,14 @@ func set_plugin(plugin : EditorPlugin) -> void:
|
||||
$TabContainer/Continent.set_plugin(plugin)
|
||||
$TabContainer/Zone.set_plugin(plugin)
|
||||
$TabContainer/SubZone.set_plugin(plugin)
|
||||
$TabContainer/SubZoneProp.set_plugin(plugin)
|
||||
|
||||
func refresh() -> void:
|
||||
$TabContainer/World.set_wgworld(edited_world)
|
||||
$TabContainer/Continent.set_wgworld(edited_world)
|
||||
$TabContainer/Zone.set_wgworld(edited_world)
|
||||
$TabContainer/SubZone.set_wgworld(edited_world)
|
||||
$TabContainer/SubZoneProp.set_wgworld(edited_world)
|
||||
|
||||
func set_wgworld(wgw : WorldGenWorld) -> void:
|
||||
edited_world = wgw
|
||||
|
@ -1,10 +1,11 @@
|
||||
[gd_scene load_steps=6 format=2]
|
||||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://addons/world_generator/ui/MainScreen.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/world_generator/ui/tabs/World.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://addons/world_generator/ui/tabs/Continent.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://addons/world_generator/ui/tabs/Zone.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://addons/world_generator/ui/tabs/SubZone.tscn" type="PackedScene" id=5]
|
||||
[ext_resource path="res://addons/world_generator/ui/tabs/SubZoneProp.tscn" type="PackedScene" id=6]
|
||||
|
||||
[node name="WorldGenerator" type="PanelContainer"]
|
||||
anchor_right = 1.0
|
||||
@ -41,7 +42,6 @@ margin_bottom = -4.0
|
||||
|
||||
[node name="SubZone" parent="TabContainer" instance=ExtResource( 5 )]
|
||||
visible = false
|
||||
margin_left = 4.0
|
||||
margin_top = 32.0
|
||||
margin_right = -4.0
|
||||
margin_bottom = -4.0
|
||||
|
||||
[node name="SubZoneProp" parent="TabContainer" instance=ExtResource( 6 )]
|
||||
visible = false
|
||||
|
@ -7,23 +7,45 @@ var edited_zone : Zone = null
|
||||
var edited_sub_zone : SubZone = null
|
||||
|
||||
func _ready():
|
||||
var coption_button : OptionButton = $VBoxContainer/ContinentOptionButton
|
||||
var coption_button : OptionButton = $HSplitContainer/VBoxContainer/ContinentOptionButton
|
||||
coption_button.connect("item_selected", self, "on_continent_item_selected")
|
||||
|
||||
var zoption_button : OptionButton = $VBoxContainer/ZoneOptionButton
|
||||
var zoption_button : OptionButton = $HSplitContainer/VBoxContainer/ZoneOptionButton
|
||||
zoption_button.connect("item_selected", self, "on_zone_item_selected")
|
||||
|
||||
var szoption_button : OptionButton = $VBoxContainer/SubZoneOptionButton
|
||||
var szoption_button : OptionButton = $HSplitContainer/VBoxContainer/SubZoneOptionButton
|
||||
szoption_button.connect("item_selected", self, "on_sub_zone_item_selected")
|
||||
|
||||
func set_plugin(plugin : EditorPlugin) -> void:
|
||||
$VBoxContainer/HBoxContainer2/ResourcePropertyList.set_plugin(plugin)
|
||||
$HSplitContainer/VBoxContainer/HBoxContainer2/ResourcePropertyList.set_plugin(plugin)
|
||||
$HSplitContainer/VBoxContainer/HBoxContainer2/VBoxContainer/DataList.set_plugin(plugin)
|
||||
$HSplitContainer/RectEditor.set_plugin(plugin)
|
||||
|
||||
func refresh() -> void:
|
||||
var option_button : OptionButton = $HSplitContainer/VBoxContainer/ContinentOptionButton
|
||||
option_button.clear()
|
||||
edited_continent = null
|
||||
edited_zone = null
|
||||
|
||||
if !edited_world:
|
||||
return
|
||||
|
||||
var content : Array = edited_world.get_content()
|
||||
|
||||
for c in content:
|
||||
if c:
|
||||
option_button.add_item(c.resource_name)
|
||||
option_button.set_item_metadata(option_button.get_item_count() - 1, c)
|
||||
|
||||
if !edited_continent:
|
||||
edited_continent = c
|
||||
|
||||
continent_changed()
|
||||
|
||||
func continent_changed() -> void:
|
||||
var option_button : OptionButton = $VBoxContainer/ZoneOptionButton
|
||||
var option_button : OptionButton = $HSplitContainer/VBoxContainer/ZoneOptionButton
|
||||
option_button.clear()
|
||||
edited_zone = null
|
||||
edited_sub_zone = null
|
||||
|
||||
if !edited_continent:
|
||||
return
|
||||
@ -37,11 +59,11 @@ func continent_changed() -> void:
|
||||
|
||||
if !edited_zone:
|
||||
edited_zone = c
|
||||
|
||||
|
||||
zone_changed()
|
||||
|
||||
func zone_changed() -> void:
|
||||
var option_button : OptionButton = $VBoxContainer/SubZoneOptionButton
|
||||
var option_button : OptionButton = $HSplitContainer/VBoxContainer/SubZoneOptionButton
|
||||
option_button.clear()
|
||||
edited_sub_zone = null
|
||||
|
||||
@ -62,34 +84,10 @@ func zone_changed() -> void:
|
||||
|
||||
|
||||
func sub_zone_changed() -> void:
|
||||
$VBoxContainer/HBoxContainer2/ResourcePropertyList.edit_resource(edited_sub_zone)
|
||||
$HSplitContainer/VBoxContainer/HBoxContainer2/ResourcePropertyList.edit_resource(edited_sub_zone)
|
||||
$HSplitContainer/VBoxContainer/HBoxContainer2/VBoxContainer/DataList.set_edited_resource(edited_sub_zone)
|
||||
$HSplitContainer/RectEditor.set_edited_resource(edited_sub_zone)
|
||||
|
||||
func refresh() -> void:
|
||||
var option_button : OptionButton = $VBoxContainer/ContinentOptionButton
|
||||
option_button.clear()
|
||||
|
||||
if !edited_world:
|
||||
return
|
||||
|
||||
var content : Array = edited_world.get_content()
|
||||
|
||||
for c in content:
|
||||
if c:
|
||||
option_button.add_item(c.resource_name)
|
||||
option_button.set_item_metadata(option_button.get_item_count() - 1, c)
|
||||
|
||||
if !edited_continent:
|
||||
edited_continent = c
|
||||
|
||||
continent_changed()
|
||||
|
||||
func set_wgworld(wgw : WorldGenWorld) -> void:
|
||||
edited_world = wgw
|
||||
edited_continent = null
|
||||
edited_zone = null
|
||||
|
||||
refresh()
|
||||
|
||||
func set_continent(continent : Continent) -> void:
|
||||
edited_continent = continent
|
||||
edited_zone = null
|
||||
@ -100,23 +98,30 @@ func set_zone(zone : Zone) -> void:
|
||||
edited_zone = zone
|
||||
|
||||
zone_changed()
|
||||
|
||||
|
||||
func set_sub_zone(sub_zone : SubZone) -> void:
|
||||
edited_sub_zone = sub_zone
|
||||
|
||||
sub_zone_changed()
|
||||
|
||||
func set_wgworld(wgw : WorldGenWorld) -> void:
|
||||
edited_world = wgw
|
||||
edited_continent = null
|
||||
edited_zone = null
|
||||
|
||||
refresh()
|
||||
|
||||
func on_continent_item_selected(idx : int) -> void:
|
||||
var option_button : OptionButton = $VBoxContainer/ContinentOptionButton
|
||||
var option_button : OptionButton = $HSplitContainer/VBoxContainer/ContinentOptionButton
|
||||
|
||||
set_continent(option_button.get_item_metadata(idx))
|
||||
|
||||
func on_zone_item_selected(idx : int) -> void:
|
||||
var option_button : OptionButton = $VBoxContainer/ZoneOptionButton
|
||||
var option_button : OptionButton = $HSplitContainer/VBoxContainer/ZoneOptionButton
|
||||
|
||||
set_zone(option_button.get_item_metadata(idx))
|
||||
|
||||
func on_sub_zone_item_selected(idx : int) -> void:
|
||||
var option_button : OptionButton = $VBoxContainer/SubZoneOptionButton
|
||||
var option_button : OptionButton = $HSplitContainer/VBoxContainer/SubZoneOptionButton
|
||||
|
||||
set_sub_zone(option_button.get_item_metadata(idx))
|
||||
|
@ -1,7 +1,9 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://addons/world_generator/ui/tabs/SubZone.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/world_generator/ui/ResourcePropertyList.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://addons/world_generator/ui/DataList.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://addons/world_generator/ui/RectEditor.tscn" type="PackedScene" id=4]
|
||||
|
||||
[node name="SubZone" type="HBoxContainer"]
|
||||
anchor_right = 1.0
|
||||
@ -9,41 +11,97 @@ anchor_bottom = 1.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
[node name="HSplitContainer" type="HSplitContainer" parent="."]
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 600.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="ContinentOptionButton" type="OptionButton" parent="VBoxContainer"]
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 20.0
|
||||
|
||||
[node name="ZoneOptionButton" type="OptionButton" parent="VBoxContainer"]
|
||||
margin_top = 24.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 44.0
|
||||
|
||||
[node name="SubZoneOptionButton" type="OptionButton" parent="VBoxContainer"]
|
||||
margin_top = 48.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 68.0
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer"]
|
||||
margin_top = 72.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 600.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="ResourcePropertyList" parent="VBoxContainer/HBoxContainer2" instance=ExtResource( 2 )]
|
||||
[node name="RectEditor" parent="HSplitContainer" instance=ExtResource( 4 )]
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_right = 735.0
|
||||
margin_bottom = 600.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="HSplitContainer"]
|
||||
margin_left = 747.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 600.0
|
||||
|
||||
[node name="ContinentOptionButton" type="OptionButton" parent="HSplitContainer/VBoxContainer"]
|
||||
margin_right = 277.0
|
||||
margin_bottom = 20.0
|
||||
|
||||
[node name="ZoneOptionButton" type="OptionButton" parent="HSplitContainer/VBoxContainer"]
|
||||
margin_top = 24.0
|
||||
margin_right = 277.0
|
||||
margin_bottom = 44.0
|
||||
|
||||
[node name="SubZoneOptionButton" type="OptionButton" parent="HSplitContainer/VBoxContainer"]
|
||||
margin_top = 48.0
|
||||
margin_right = 277.0
|
||||
margin_bottom = 68.0
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="HSplitContainer/VBoxContainer"]
|
||||
margin_top = 72.0
|
||||
margin_right = 277.0
|
||||
margin_bottom = 600.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="ResourcePropertyList" parent="HSplitContainer/VBoxContainer/HBoxContainer2" instance=ExtResource( 2 )]
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_right = 100.0
|
||||
margin_bottom = 528.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="HSplitContainer/VBoxContainer/HBoxContainer2"]
|
||||
margin_left = 104.0
|
||||
margin_right = 277.0
|
||||
margin_bottom = 528.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="Label" type="Label" parent="HSplitContainer/VBoxContainer/HBoxContainer2/VBoxContainer"]
|
||||
margin_right = 173.0
|
||||
margin_bottom = 14.0
|
||||
text = "Sub Zones"
|
||||
align = 1
|
||||
valign = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="HSplitContainer/VBoxContainer/HBoxContainer2/VBoxContainer"]
|
||||
margin_top = 18.0
|
||||
margin_right = 173.0
|
||||
margin_bottom = 38.0
|
||||
|
||||
[node name="AddButton" type="Button" parent="HSplitContainer/VBoxContainer/HBoxContainer2/VBoxContainer/HBoxContainer"]
|
||||
margin_right = 37.0
|
||||
margin_bottom = 20.0
|
||||
text = "Add"
|
||||
|
||||
[node name="DeleteButton" type="Button" parent="HSplitContainer/VBoxContainer/HBoxContainer2/VBoxContainer/HBoxContainer"]
|
||||
margin_left = 41.0
|
||||
margin_right = 96.0
|
||||
margin_bottom = 20.0
|
||||
text = "Delete"
|
||||
|
||||
[node name="Duplicate" type="Button" parent="HSplitContainer/VBoxContainer/HBoxContainer2/VBoxContainer/HBoxContainer"]
|
||||
margin_left = 100.0
|
||||
margin_right = 173.0
|
||||
margin_bottom = 20.0
|
||||
text = "Duplicate"
|
||||
|
||||
[node name="DataList" parent="HSplitContainer/VBoxContainer/HBoxContainer2/VBoxContainer" instance=ExtResource( 3 )]
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_top = 42.0
|
||||
margin_right = 173.0
|
||||
margin_bottom = 528.0
|
||||
class_types = 3
|
||||
|
||||
[connection signal="pressed" from="HSplitContainer/VBoxContainer/HBoxContainer2/VBoxContainer/HBoxContainer/AddButton" to="HSplitContainer/VBoxContainer/HBoxContainer2/VBoxContainer/DataList" method="add_button_pressed"]
|
||||
[connection signal="pressed" from="HSplitContainer/VBoxContainer/HBoxContainer2/VBoxContainer/HBoxContainer/DeleteButton" to="HSplitContainer/VBoxContainer/HBoxContainer2/VBoxContainer/DataList" method="delete_button_pressed"]
|
||||
[connection signal="pressed" from="HSplitContainer/VBoxContainer/HBoxContainer2/VBoxContainer/HBoxContainer/Duplicate" to="HSplitContainer/VBoxContainer/HBoxContainer2/VBoxContainer/DataList" method="duplicate_button_pressed"]
|
||||
|
162
game/addons/world_generator/ui/tabs/SubZoneProp.gd
Normal file
162
game/addons/world_generator/ui/tabs/SubZoneProp.gd
Normal file
@ -0,0 +1,162 @@
|
||||
tool
|
||||
extends HBoxContainer
|
||||
|
||||
var edited_world : WorldGenWorld = null
|
||||
var edited_continent : Continent = null
|
||||
var edited_zone : Zone = null
|
||||
var edited_sub_zone : SubZone = null
|
||||
var edited_sub_zone_prop : SubZoneProp = null
|
||||
|
||||
func _ready():
|
||||
var coption_button : OptionButton = $VBoxContainer/ContinentOptionButton
|
||||
coption_button.connect("item_selected", self, "on_continent_item_selected")
|
||||
|
||||
var zoption_button : OptionButton = $VBoxContainer/ZoneOptionButton
|
||||
zoption_button.connect("item_selected", self, "on_zone_item_selected")
|
||||
|
||||
var szoption_button : OptionButton = $VBoxContainer/SubZoneOptionButton
|
||||
szoption_button.connect("item_selected", self, "on_sub_zone_item_selected")
|
||||
|
||||
var szpoption_button : OptionButton = $VBoxContainer/SubZonePropOptionButton
|
||||
szpoption_button.connect("item_selected", self, "on_sub_zone_prop_item_selected")
|
||||
|
||||
func set_plugin(plugin : EditorPlugin) -> void:
|
||||
$VBoxContainer/HBoxContainer2/ResourcePropertyList.set_plugin(plugin)
|
||||
|
||||
func continent_changed() -> void:
|
||||
var option_button : OptionButton = $VBoxContainer/ZoneOptionButton
|
||||
option_button.clear()
|
||||
edited_zone = null
|
||||
edited_sub_zone = null
|
||||
|
||||
if !edited_continent:
|
||||
return
|
||||
|
||||
var content : Array = edited_continent.get_content()
|
||||
|
||||
for c in content:
|
||||
if c:
|
||||
option_button.add_item(c.resource_name)
|
||||
option_button.set_item_metadata(option_button.get_item_count() - 1, c)
|
||||
|
||||
if !edited_zone:
|
||||
edited_zone = c
|
||||
|
||||
zone_changed()
|
||||
|
||||
func zone_changed() -> void:
|
||||
var option_button : OptionButton = $VBoxContainer/SubZoneOptionButton
|
||||
option_button.clear()
|
||||
edited_sub_zone = null
|
||||
|
||||
if !edited_zone:
|
||||
return
|
||||
|
||||
var content : Array = edited_zone.get_content()
|
||||
|
||||
for c in content:
|
||||
if c:
|
||||
option_button.add_item(c.resource_name)
|
||||
option_button.set_item_metadata(option_button.get_item_count() - 1, c)
|
||||
|
||||
if !edited_sub_zone:
|
||||
edited_sub_zone = c
|
||||
|
||||
sub_zone_changed()
|
||||
|
||||
func sub_zone_changed() -> void:
|
||||
var option_button : OptionButton = $VBoxContainer/SubZonePropOptionButton
|
||||
option_button.clear()
|
||||
edited_sub_zone_prop = null
|
||||
|
||||
if !edited_sub_zone:
|
||||
return
|
||||
|
||||
var content : Array = edited_sub_zone.get_content()
|
||||
|
||||
for c in content:
|
||||
if c:
|
||||
option_button.add_item(c.resource_name)
|
||||
option_button.set_item_metadata(option_button.get_item_count() - 1, c)
|
||||
|
||||
if !edited_sub_zone_prop:
|
||||
edited_sub_zone_prop = c
|
||||
|
||||
sub_zone_prop_changed()
|
||||
|
||||
func sub_zone_prop_changed() -> void:
|
||||
$VBoxContainer/HBoxContainer2/ResourcePropertyList.edit_resource(edited_sub_zone_prop)
|
||||
|
||||
func refresh() -> void:
|
||||
var option_button : OptionButton = $VBoxContainer/ContinentOptionButton
|
||||
option_button.clear()
|
||||
|
||||
if !edited_world:
|
||||
return
|
||||
|
||||
var content : Array = edited_world.get_content()
|
||||
|
||||
for c in content:
|
||||
if c:
|
||||
option_button.add_item(c.resource_name)
|
||||
option_button.set_item_metadata(option_button.get_item_count() - 1, c)
|
||||
|
||||
if !edited_continent:
|
||||
edited_continent = c
|
||||
|
||||
continent_changed()
|
||||
|
||||
func set_wgworld(wgw : WorldGenWorld) -> void:
|
||||
edited_world = wgw
|
||||
edited_continent = null
|
||||
edited_zone = null
|
||||
edited_sub_zone = null
|
||||
edited_sub_zone_prop = null
|
||||
|
||||
refresh()
|
||||
|
||||
func set_continent(continent : Continent) -> void:
|
||||
edited_continent = continent
|
||||
edited_zone = null
|
||||
edited_sub_zone = null
|
||||
edited_sub_zone_prop = null
|
||||
|
||||
continent_changed()
|
||||
|
||||
func set_zone(zone : Zone) -> void:
|
||||
edited_zone = zone
|
||||
edited_sub_zone = null
|
||||
edited_sub_zone_prop = null
|
||||
|
||||
zone_changed()
|
||||
|
||||
func set_sub_zone(sub_zone : SubZone) -> void:
|
||||
edited_sub_zone = sub_zone
|
||||
edited_sub_zone_prop = null
|
||||
|
||||
sub_zone_changed()
|
||||
|
||||
func set_sub_zone_prop(sub_zone_prop : SubZoneProp) -> void:
|
||||
edited_sub_zone_prop = sub_zone_prop
|
||||
|
||||
sub_zone_prop_changed()
|
||||
|
||||
func on_continent_item_selected(idx : int) -> void:
|
||||
var option_button : OptionButton = $VBoxContainer/ContinentOptionButton
|
||||
|
||||
set_continent(option_button.get_item_metadata(idx))
|
||||
|
||||
func on_zone_item_selected(idx : int) -> void:
|
||||
var option_button : OptionButton = $VBoxContainer/ZoneOptionButton
|
||||
|
||||
set_zone(option_button.get_item_metadata(idx))
|
||||
|
||||
func on_sub_zone_item_selected(idx : int) -> void:
|
||||
var option_button : OptionButton = $VBoxContainer/SubZoneOptionButton
|
||||
|
||||
set_sub_zone(option_button.get_item_metadata(idx))
|
||||
|
||||
func on_sub_zone_prop_item_selected(idx : int) -> void:
|
||||
var option_button : OptionButton = $VBoxContainer/SubZonePropOptionButton
|
||||
|
||||
set_sub_zone_prop(option_button.get_item_metadata(idx))
|
51
game/addons/world_generator/ui/tabs/SubZoneProp.tscn
Normal file
51
game/addons/world_generator/ui/tabs/SubZoneProp.tscn
Normal file
@ -0,0 +1,51 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://addons/world_generator/ui/tabs/SubZoneProp.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/world_generator/ui/ResourcePropertyList.tscn" type="PackedScene" id=2]
|
||||
|
||||
[node name="SubZoneProp" type="HBoxContainer"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 600.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="ContinentOptionButton" type="OptionButton" parent="VBoxContainer"]
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 20.0
|
||||
|
||||
[node name="ZoneOptionButton" type="OptionButton" parent="VBoxContainer"]
|
||||
margin_top = 24.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 44.0
|
||||
|
||||
[node name="SubZoneOptionButton" type="OptionButton" parent="VBoxContainer"]
|
||||
margin_top = 48.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 68.0
|
||||
|
||||
[node name="SubZonePropOptionButton" type="OptionButton" parent="VBoxContainer"]
|
||||
margin_top = 72.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 92.0
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer"]
|
||||
margin_top = 96.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 600.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="ResourcePropertyList" parent="VBoxContainer/HBoxContainer2" instance=ExtResource( 2 )]
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 504.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
@ -110,6 +110,11 @@ _global_script_classes=[ {
|
||||
"language": @"GDScript",
|
||||
"path": "res://addons/world_generator/resources/subzone.gd"
|
||||
}, {
|
||||
"base": "Resource",
|
||||
"class": @"SubZoneProp",
|
||||
"language": @"GDScript",
|
||||
"path": "res://addons/world_generator/resources/sub_zone_prop.gd"
|
||||
}, {
|
||||
"base": "TerrainLevelGenerator",
|
||||
"class": @"TerrainWorldGenerator",
|
||||
"language": @"GDScript",
|
||||
@ -164,6 +169,7 @@ _global_script_class_icons={
|
||||
@"PlayerGD": "",
|
||||
@"GameModule": "",
|
||||
@"LayeredTextureMaker": "",
|
||||
@"SubZoneProp": "",
|
||||
@"SubZone": "",
|
||||
@"DisplayPlayerGD": "",
|
||||
@"ItemTemplateGD": "",
|
||||
|
@ -1,5 +1,5 @@
|
||||
tool
|
||||
extends SubZone
|
||||
extends SubZoneProp
|
||||
|
||||
export(PackedScene) var dungeon_teleporter : PackedScene
|
||||
|
@ -1,5 +1,5 @@
|
||||
tool
|
||||
extends SubZone
|
||||
extends SubZoneProp
|
||||
|
||||
export (EntityData) var trainer : EntityData
|
||||
export (EntityData) var vendor : EntityData
|
@ -0,0 +1,20 @@
|
||||
tool
|
||||
extends SubZoneProp
|
||||
|
||||
func get_editor_rect_border_color() -> Color:
|
||||
return Color(0.8, 0.8, 0.8, 1)
|
||||
|
||||
func get_editor_rect_color() -> Color:
|
||||
return Color(0.8, 0.8, 0.8, 0.9)
|
||||
|
||||
func get_editor_rect_border_size() -> int:
|
||||
return 2
|
||||
|
||||
func get_editor_font_color() -> Color:
|
||||
return Color(0, 0, 0, 1)
|
||||
|
||||
func get_editor_class() -> String:
|
||||
return "TestSubZone"
|
||||
|
||||
func get_editor_additional_text() -> String:
|
||||
return "TestSubZone"
|
@ -7,3 +7,4 @@ script = ExtResource( 1 )
|
||||
continent_class_folders = PoolStringArray( "res://scripts/world_generator/continents/" )
|
||||
zone_class_folders = PoolStringArray( "res://scripts/world_generator/zones/" )
|
||||
subzone_class_folders = PoolStringArray( "res://scripts/world_generator/subzones/" )
|
||||
subzone_prop_class_folders = PoolStringArray( "res://scripts/world_generator/subzoneprops/" )
|
||||
|
@ -1,44 +1,45 @@
|
||||
[gd_resource type="Resource" load_steps=17 format=2]
|
||||
[gd_resource type="Resource" load_steps=18 format=2]
|
||||
|
||||
[ext_resource path="res://scripts/world_generator/worlds/ocean_base_world.gd" type="Script" id=1]
|
||||
[ext_resource path="res://scripts/world_generator/subzones/spawner.gd" type="Script" id=2]
|
||||
[ext_resource path="res://scripts/world_generator/subzones/test_subzone.gd" type="Script" id=2]
|
||||
[ext_resource path="res://scripts/world_generator/continents/test_continent.gd" type="Script" id=3]
|
||||
[ext_resource path="res://worlds/test_world/dungeons/dung_teleporter.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://scripts/world_generator/subzoneprops/dungeon_spawner.gd" type="Script" id=4]
|
||||
[ext_resource path="res://models/collections/low_poly_rpg_item_collection_3/t2scene.tres" type="PropData" id=5]
|
||||
[ext_resource path="res://models/collections/low_poly_rpg_item_collection_3/t1scene.tres" type="PropData" id=6]
|
||||
[ext_resource path="res://scripts/world_generator/zones/test_zone.gd" type="Script" id=7]
|
||||
[ext_resource path="res://entity_classes/naturalist/entities/4_naturalist_vendor.tres" type="EntityData" id=8]
|
||||
[ext_resource path="res://entity_classes/naturalist/entities/3_naturalist_trainer.tres" type="EntityData" id=9]
|
||||
[ext_resource path="res://scripts/world_generator/subzoneprops/spawner.gd" type="Script" id=8]
|
||||
[ext_resource path="res://entity_classes/naturalist/entities/4_naturalist_vendor.tres" type="EntityData" id=9]
|
||||
[ext_resource path="res://worlds/test_world/noises/base_ocean_noise.tres" type="FastnoiseNoiseParams" id=10]
|
||||
[ext_resource path="res://scripts/world_generator/subzones/dungeon_spawner.gd" type="Script" id=11]
|
||||
|
||||
[sub_resource type="Resource" id=2]
|
||||
resource_name = "Spawner"
|
||||
script = ExtResource( 2 )
|
||||
rect = Rect2( 9.6719, 4.34375, 2.09375, 1.6875 )
|
||||
min_size = Vector2i( 1, 1 )
|
||||
max_size = Vector2i( 1e+06, 1e+06 )
|
||||
locked = false
|
||||
trainer = ExtResource( 9 )
|
||||
vendor = ExtResource( 8 )
|
||||
|
||||
[sub_resource type="Resource" id=4]
|
||||
resource_name = "DungeonSpawner"
|
||||
script = ExtResource( 11 )
|
||||
rect = Rect2( 9.96875, 4.07812, 2.26562, 1.79688 )
|
||||
min_size = Vector2i( 1, 1 )
|
||||
max_size = Vector2i( 1e+06, 1e+06 )
|
||||
locked = false
|
||||
dungeon_teleporter = ExtResource( 4 )
|
||||
[ext_resource path="res://entity_classes/naturalist/entities/3_naturalist_trainer.tres" type="EntityData" id=11]
|
||||
[ext_resource path="res://worlds/test_world/dungeons/dung_teleporter.tscn" type="PackedScene" id=12]
|
||||
|
||||
[sub_resource type="Resource" id=5]
|
||||
resource_name = "DungeonSpawner2"
|
||||
script = ExtResource( 11 )
|
||||
rect = Rect2( 16.8488, 8.40883, 1, 1.0625 )
|
||||
resource_name = "Spawner"
|
||||
script = ExtResource( 8 )
|
||||
rect = Rect2( 1.01562, 2.54688, 2.45312, 2.09375 )
|
||||
min_size = Vector2i( 1, 1 )
|
||||
max_size = Vector2i( 1e+06, 1e+06 )
|
||||
locked = false
|
||||
dungeon_teleporter = ExtResource( 4 )
|
||||
trainer = ExtResource( 11 )
|
||||
vendor = ExtResource( 9 )
|
||||
|
||||
[sub_resource type="Resource" id=6]
|
||||
resource_name = "DS"
|
||||
script = ExtResource( 4 )
|
||||
rect = Rect2( 2.34402, 1.7592, 1.79547, 1.78381 )
|
||||
min_size = Vector2i( 1, 1 )
|
||||
max_size = Vector2i( 1e+06, 1e+06 )
|
||||
locked = false
|
||||
dungeon_teleporter = ExtResource( 12 )
|
||||
|
||||
[sub_resource type="Resource" id=4]
|
||||
resource_name = "Village"
|
||||
script = ExtResource( 2 )
|
||||
rect = Rect2( 6.4375, 3.21875, 6.3125, 5.5625 )
|
||||
min_size = Vector2i( 1, 1 )
|
||||
max_size = Vector2i( 1e+06, 1e+06 )
|
||||
locked = false
|
||||
subzone_props = [ SubResource( 5 ), SubResource( 6 ) ]
|
||||
|
||||
[sub_resource type="Resource" id=3]
|
||||
resource_name = "TestForest"
|
||||
@ -47,7 +48,7 @@ rect = Rect2( 8.75557, 6.875, 21.9944, 11.2839 )
|
||||
min_size = Vector2i( 1, 1 )
|
||||
max_size = Vector2i( 1e+06, 1e+06 )
|
||||
locked = false
|
||||
subzones = [ SubResource( 2 ), SubResource( 4 ), SubResource( 5 ) ]
|
||||
subzones = [ SubResource( 4 ) ]
|
||||
zone_radius = 0.5
|
||||
zone_bevel = 0.3
|
||||
zone_base = 0.0
|
||||
|
Loading…
Reference in New Issue
Block a user