Removed parent_positions from WorldGenBaseResources, and also removed the setup() method. I'ts better this way, as they are resources, and now they can be reused (even though the gui itself doesn't support it). Spawning code is also simpler.

This commit is contained in:
Relintai 2022-08-04 20:05:19 +02:00
parent 345aa62ed4
commit ffe566b0ac
7 changed files with 2 additions and 30 deletions

View File

@ -52,7 +52,6 @@ func edit(object):
if object is WorldGenWorld:
var wgw : WorldGenWorld = object as WorldGenWorld
wgw.setup()
editor_scene.set_wgworld(wgw)
func make_visible(visible):

View File

@ -25,7 +25,6 @@ func create_content(item_name : String = "") -> void:
func add_content(entry : WorldGenBaseResource) -> void:
zones.append(entry)
entry.set_parent_pos(get_parent_pos() + get_rect().position)
emit_changed()
func remove_content_entry(entry : WorldGenBaseResource) -> void:

View File

@ -5,19 +5,6 @@ class_name WorldGenBaseResource
export(Rect2) var rect : Rect2 = Rect2(0, 0, 100, 100)
export(bool) var locked : bool = false
var _parent_pos : Vector2 = Vector2()
func setup() -> void:
_setup()
for c in get_content():
if c:
c.set_parent_pos(_parent_pos + get_rect().position)
c.setup()
func _setup() -> void:
pass
func get_rect() -> Rect2:
return rect
@ -32,16 +19,6 @@ func set_locked(r : bool) -> void:
locked = r
emit_changed()
func get_parent_pos() -> Vector2:
return _parent_pos
func set_parent_pos(parent_pos : Vector2) -> void:
_parent_pos = parent_pos
for c in get_content():
if c:
c.set_parent_pos(_parent_pos + get_rect().position)
func get_content() -> Array:
return Array()

View File

@ -25,7 +25,6 @@ func add_content(entry : WorldGenBaseResource) -> void:
entry.set_rect(r)
continents.append(entry)
entry.set_parent_pos(get_parent_pos() + get_rect().position)
emit_changed()
func remove_content_entry(entry : WorldGenBaseResource) -> void:

View File

@ -25,7 +25,6 @@ func create_content(item_name : String = "") -> void:
func add_content(entry : WorldGenBaseResource) -> void:
subzones.append(entry)
entry.set_parent_pos(get_parent_pos() + get_rect().position)
emit_changed()
func remove_content_entry(entry : WorldGenBaseResource) -> void:

View File

@ -35,7 +35,6 @@ func setup(world : TerrainWorld, level_seed : int, spawn_mobs : bool, library: T
_library = library
if world_gen_world != null:
world_gen_world.setup()
world_gen_world.setup_terra_library(_library, _level_seed)
_library.refresh_rects()

View File

@ -23,14 +23,14 @@ vendor = ExtResource( 8 )
[sub_resource type="Resource" id=4]
resource_name = "DungeonSpawner"
script = ExtResource( 11 )
rect = Rect2( 10.4375, 4.76562, 0.734375, 0.734375 )
rect = Rect2( 9.96875, 4.07812, 2.26562, 1.79688 )
locked = false
dungeon_teleporter = ExtResource( 4 )
[sub_resource type="Resource" id=5]
resource_name = "DungeonSpawner2"
script = ExtResource( 11 )
rect = Rect2( 13.689, 6.71965, 1.30323, 1.0916 )
rect = Rect2( 13.439, 6.6259, 3.11573, 2.0916 )
locked = false
dungeon_teleporter = ExtResource( 4 )