Now the added resource's rect gets recalculated on add_content() instead in create_content()

This commit is contained in:
Relintai 2021-12-26 18:48:29 +01:00
parent 0a0f4ee865
commit f739cca1f4

View File

@ -13,17 +13,17 @@ func set_content(arr : Array) -> void:
func create_content(item_name : String = "") -> void: func create_content(item_name : String = "") -> void:
var continent : Continent = Continent.new() var continent : Continent = Continent.new()
continent.resource_name = item_name continent.resource_name = item_name
add_content(continent)
func add_content(entry : WorldGenBaseResource) -> void:
var r : Rect2 = get_rect() var r : Rect2 = get_rect()
r.position = Vector2() r.position = Vector2()
r.size.x /= 10.0 r.size.x /= 10.0
r.size.y /= 10.0 r.size.y /= 10.0
continent.set_rect(r) entry.set_rect(r)
add_content(continent)
func add_content(entry : WorldGenBaseResource) -> void:
continents.append(entry) continents.append(entry)
emit_changed() emit_changed()