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 Continent
|
2021-12-22 10:03:55 +01:00
|
|
|
|
2021-12-22 16:14:26 +01:00
|
|
|
export(Array) var zones : Array
|
|
|
|
|
|
|
|
func get_content() -> Array:
|
|
|
|
return zones
|
|
|
|
|
|
|
|
func set_content(arr : Array) -> void:
|
|
|
|
zones = 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 zone : Zone = Zone.new()
|
|
|
|
zone.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
|
|
|
|
|
|
|
|
zone.set_rect(r)
|
|
|
|
|
2021-12-26 00:25:30 +01:00
|
|
|
add_content(zone)
|
|
|
|
|
|
|
|
func add_content(entry : WorldGenBaseResource) -> void:
|
|
|
|
zones.append(entry)
|
2021-12-27 03:48:55 +01:00
|
|
|
entry.set_parent_pos(get_parent_pos() + get_rect().position)
|
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(zones.size()):
|
|
|
|
if zones[i] == entry:
|
|
|
|
zones.remove(i)
|
|
|
|
emit_changed()
|
|
|
|
return
|
|
|
|
|
2021-12-22 16:14:26 +01:00
|
|
|
func setup_property_inspector(inspector) -> void:
|
|
|
|
.setup_property_inspector(inspector)
|