Fix: unwanted error messages when opening a room in editor

This commit is contained in:
Julian Murgia
2022-11-08 01:29:23 +01:00
committed by Duncan Brown
parent c80e71c395
commit 056db75929
2 changed files with 17 additions and 10 deletions

View File

@@ -66,12 +66,13 @@ func _ready():
) != self.filename: ) != self.filename:
is_run_directly = true is_run_directly = true
if not Engine.is_editor_hint():
escoria.room_manager.init_room(self) escoria.room_manager.init_room(self)
# Draw the camera limits visualization if enabled # Draw the camera limits visualization if enabled
func _draw(): func _draw():
if !Engine.is_editor_hint(): if not Engine.is_editor_hint():
return return
if editor_debug_mode == EditorRoomDebugDisplay.NONE: if editor_debug_mode == EditorRoomDebugDisplay.NONE:
return return

View File

@@ -4,6 +4,10 @@ extends Navigation2D
class_name ESCTerrain, "res://addons/escoria-core/design/esc_terrain.svg" class_name ESCTerrain, "res://addons/escoria-core/design/esc_terrain.svg"
# Logger class
const Logger = preload("res://addons/escoria-core/game/esc_logger.gd")
# Visualize scales or the lightmap for debugging purposes # Visualize scales or the lightmap for debugging purposes
enum DebugMode { enum DebugMode {
NONE NONE
@@ -45,7 +49,6 @@ export(int, "None", "Scales", "Lightmap") var debug_mode = DebugMode.NONE \
# The currently activ navigation polygon # The currently activ navigation polygon
var current_active_navigation_instance: NavigationPolygonInstance = null var current_active_navigation_instance: NavigationPolygonInstance = null
# Currently visualized texture for debug mode # Currently visualized texture for debug mode
var _texture = null var _texture = null
@@ -55,26 +58,29 @@ var _lightmap_data
# Prohibits multiple calls to update_texture # Prohibits multiple calls to update_texture
var _texture_in_update = false var _texture_in_update = false
# Logger instance
onready var logger = Logger.ESCLoggerFile.new()
# Set a reference to the active navigation polygon, register to Escoria # Set a reference to the active navigation polygon, register to Escoria
# and update the texture # and update the texture
func _ready(): func _ready():
var navigation_enabled_found = false var navigation_enabled_found = false
for n in get_children(): for n in get_children():
if n is NavigationPolygonInstance: if n is NavigationPolygonInstance and n.enabled:
if n.enabled: if navigation_enabled_found:
if !Engine.is_editor_hint() and navigation_enabled_found: if Engine.is_editor_hint():
escoria.logger.error( logger.warn(
self, self,
"Multiple NavigationPolygonInstances enabled " + \ "Multiple NavigationPolygonInstances enabled " + \
"at the same time." "at the same time."
) )
elif Engine.is_editor_hint(): else:
escoria.logger.warn( logger.error(
self, self,
"Multiple NavigationPolygonInstances enabled " + \ "Multiple NavigationPolygonInstances enabled " + \
"at the same time." "at the same time."
) )
else:
navigation_enabled_found = true navigation_enabled_found = true
current_active_navigation_instance = n current_active_navigation_instance = n