Reimplemented the editor_generate property for the tile maps.

This commit is contained in:
Relintai 2022-09-30 09:30:52 +02:00
parent ebfd0914c4
commit f695a8fa59

View File

@ -1,3 +1,4 @@
tool
extends Node2D extends Node2D
# Copyright (c) 2019 Péter Magyar # Copyright (c) 2019 Péter Magyar
@ -54,6 +55,9 @@ onready var tile_map : = $Terrarin
onready var visibility_map : RTileMap = $VisibilityMap onready var visibility_map : RTileMap = $VisibilityMap
func _ready(): func _ready():
if Engine.editor_hint:
return
tile_size = get_node("/root/Main").get_tile_size() tile_size = get_node("/root/Main").get_tile_size()
connect("visibility_changed", self, "on_visibility_changed") connect("visibility_changed", self, "on_visibility_changed")
@ -464,16 +468,22 @@ func get_editor_generate() -> bool:
return _editor_generate return _editor_generate
func set_editor_generate(value : bool) -> void: func set_editor_generate(value : bool) -> void:
if !Engine.editor_hint:
return
if value: if value:
#library.refresh_rects() #library.refresh_rects()
#level_generator.setup(self, current_seed, false, library) #level_generator.setup(self, current_seed, false, library)
#spawn() #spawn()
pass build_level()
visibility_map.clear()
else: else:
#spawned = false #spawned = false
#clear() rooms.clear()
pass map.clear()
tile_map.clear()
visibility_map.clear()
_editor_generate = value _editor_generate = value