fix: changes camera target vs limit errors to warnings and makes sure they're in the right places
This commit is contained in:
committed by
Julian Murgia
parent
abb01b7f0b
commit
e4bb111cb9
@@ -54,6 +54,24 @@ func validate(arguments: Array):
|
||||
% [get_command_name(), arguments[0]]
|
||||
)
|
||||
return false
|
||||
|
||||
var target_pos = (escoria.object_manager.get_object(arguments[0]).node as ESCItem).global_position
|
||||
var camera: ESCCamera = escoria.object_manager.get_object(escoria.object_manager.CAMERA).node as ESCCamera
|
||||
var camera_limit: Rect2 = Rect2(camera.limit_left, camera.limit_top, camera.limit_right - camera.limit_left, camera.limit_bottom - camera.limit_top)
|
||||
|
||||
if not camera_limit.has_point(target_pos):
|
||||
escoria.logger.warn(
|
||||
self,
|
||||
"[%s]: invalid camera position. Camera cannot be moved to %s at position %s as this is outside the current camera limit %s."
|
||||
% [
|
||||
get_command_name(),
|
||||
arguments[0],
|
||||
target_pos,
|
||||
camera_limit
|
||||
]
|
||||
)
|
||||
return false
|
||||
|
||||
if not arguments[2] in SUPPORTED_TRANSITIONS:
|
||||
escoria.logger.error(
|
||||
self,
|
||||
|
||||
@@ -34,7 +34,7 @@ func validate(arguments: Array):
|
||||
var camera_limit: Rect2 = Rect2(camera.limit_left, camera.limit_top, camera.limit_right - camera.limit_left, camera.limit_bottom - camera.limit_top)
|
||||
|
||||
if not camera_limit.has_point(new_pos):
|
||||
escoria.logger.error(
|
||||
escoria.logger.warn(
|
||||
self,
|
||||
"[%s]: invalid camera position. Camera cannot be moved to %s as this is outside the current camera limit %s."
|
||||
% [
|
||||
|
||||
@@ -81,7 +81,7 @@ func validate(arguments: Array):
|
||||
var new_pos: Vector2 = Vector2(camera.position.x + shift_by.x, camera.position.y + shift_by.y)
|
||||
|
||||
if not camera_limit.has_point(new_pos):
|
||||
escoria.logger.error(
|
||||
escoria.logger.warn(
|
||||
self,
|
||||
"[%s]: invalid camera position. Camera cannot be moved by %s to %s as this is outside the current camera limit %s."
|
||||
% [
|
||||
|
||||
@@ -164,7 +164,7 @@ func set_camera_limits(camera_limit_id: int = 0, scene: Node = current_scene) ->
|
||||
|
||||
escoria.logger.info(
|
||||
self,
|
||||
"Setting camera limits from scene " + area
|
||||
"Setting camera limits from scene " + str(area)
|
||||
)
|
||||
limits = ESCCameraLimits.new(
|
||||
area.position.x,
|
||||
|
||||
Reference in New Issue
Block a user