2021-12-21 21:50:22 +01:00
|
|
|
tool
|
2021-12-22 16:14:26 +01:00
|
|
|
extends "res://addons/world_generator/resources/world_gen_base_resource.gd"
|
2021-12-21 21:50:22 +01:00
|
|
|
class_name Zone
|
2021-12-22 10:03:55 +01:00
|
|
|
|
2021-12-22 16:14:26 +01:00
|
|
|
export(Array) var subzones : Array
|
|
|
|
|
|
|
|
func get_content() -> Array:
|
|
|
|
return subzones
|
|
|
|
|
|
|
|
func set_content(arr : Array) -> void:
|
|
|
|
subzones = arr
|
|
|
|
|
2021-12-26 00:25:30 +01:00
|
|
|
func create_content(item_name : String = "") -> void:
|
2021-12-25 02:15:17 +01:00
|
|
|
var subzone : SubZone = SubZone.new()
|
|
|
|
subzone.resource_name = item_name
|
|
|
|
|
2021-12-25 03:26:33 +01:00
|
|
|
var r : Rect2 = get_rect()
|
2021-12-25 11:30:22 +01:00
|
|
|
r.position = Vector2()
|
2021-12-25 03:26:33 +01:00
|
|
|
r.size.x /= 10.0
|
|
|
|
r.size.y /= 10.0
|
|
|
|
|
|
|
|
subzone.set_rect(r)
|
|
|
|
|
2021-12-26 00:25:30 +01:00
|
|
|
add_content(subzone)
|
|
|
|
|
|
|
|
func add_content(entry : WorldGenBaseResource) -> void:
|
|
|
|
subzones.append(entry)
|
2021-12-22 16:52:06 +01:00
|
|
|
emit_changed()
|
2021-12-26 00:25:30 +01:00
|
|
|
|
|
|
|
func remove_content_entry(entry : WorldGenBaseResource) -> void:
|
|
|
|
for i in range(subzones.size()):
|
|
|
|
if subzones[i] == entry:
|
|
|
|
subzones.remove(i)
|
|
|
|
emit_changed()
|
|
|
|
return
|
2021-12-22 16:52:06 +01:00
|
|
|
|
2021-12-22 16:14:26 +01:00
|
|
|
func setup_property_inspector(inspector) -> void:
|
|
|
|
.setup_property_inspector(inspector)
|