fix reoccurring errors and clean code

This commit is contained in:
Nitwel 2024-03-12 12:34:44 +01:00
parent e2fcc5b08f
commit d91b2fb5fc
4 changed files with 5 additions and 6 deletions

View File

@ -12,11 +12,9 @@ func _ready():
EventSystem.on_slow_tick.connect(_slow_tick)
func _slow_tick(_delta):
if player_camera.is_inside_tree() == false:
printerr("Player camera is not inside the tree")
if player_camera.is_inside_tree() == false||ray.is_inside_tree() == false:
return
ray.target_position = get_parent().to_local(player_camera.global_position)
get_parent().visible = ray.is_colliding() == false

View File

@ -89,11 +89,9 @@ func _physics_process(delta):
if room != last_room:
if room:
print("Room changed to: ", room.name)
HomeApi.api.update_room(room.name)
last_room = room
else:
print("Room changed to: ", "outside")
HomeApi.api.update_room("outside")
last_room = null

View File

@ -99,6 +99,9 @@ func _ready():
func update_animation():
var length = animation_player.get_animation("down").length
if animation_player.current_animation == "":
return
if active&&animation_player.current_animation_position != length:
animation_player.play("down")
elif !active&&animation_player.current_animation_position != 0:

View File

@ -263,4 +263,4 @@ func update_room(room: String):
})
if response.status == Promise.Status.RESOLVED:
print("Room updated")
pass