fix reoccurring errors and clean code
This commit is contained in:
parent
e2fcc5b08f
commit
d91b2fb5fc
|
@ -12,11 +12,9 @@ func _ready():
|
||||||
EventSystem.on_slow_tick.connect(_slow_tick)
|
EventSystem.on_slow_tick.connect(_slow_tick)
|
||||||
|
|
||||||
func _slow_tick(_delta):
|
func _slow_tick(_delta):
|
||||||
if player_camera.is_inside_tree() == false:
|
if player_camera.is_inside_tree() == false||ray.is_inside_tree() == false:
|
||||||
printerr("Player camera is not inside the tree")
|
|
||||||
return
|
return
|
||||||
|
|
||||||
ray.target_position = get_parent().to_local(player_camera.global_position)
|
ray.target_position = get_parent().to_local(player_camera.global_position)
|
||||||
|
|
||||||
get_parent().visible = ray.is_colliding() == false
|
get_parent().visible = ray.is_colliding() == false
|
||||||
|
|
||||||
|
|
|
@ -89,11 +89,9 @@ func _physics_process(delta):
|
||||||
|
|
||||||
if room != last_room:
|
if room != last_room:
|
||||||
if room:
|
if room:
|
||||||
print("Room changed to: ", room.name)
|
|
||||||
HomeApi.api.update_room(room.name)
|
HomeApi.api.update_room(room.name)
|
||||||
last_room = room
|
last_room = room
|
||||||
else:
|
else:
|
||||||
print("Room changed to: ", "outside")
|
|
||||||
HomeApi.api.update_room("outside")
|
HomeApi.api.update_room("outside")
|
||||||
last_room = null
|
last_room = null
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,9 @@ func _ready():
|
||||||
func update_animation():
|
func update_animation():
|
||||||
var length = animation_player.get_animation("down").length
|
var length = animation_player.get_animation("down").length
|
||||||
|
|
||||||
|
if animation_player.current_animation == "":
|
||||||
|
return
|
||||||
|
|
||||||
if active&&animation_player.current_animation_position != length:
|
if active&&animation_player.current_animation_position != length:
|
||||||
animation_player.play("down")
|
animation_player.play("down")
|
||||||
elif !active&&animation_player.current_animation_position != 0:
|
elif !active&&animation_player.current_animation_position != 0:
|
||||||
|
|
|
@ -263,4 +263,4 @@ func update_room(room: String):
|
||||||
})
|
})
|
||||||
|
|
||||||
if response.status == Promise.Status.RESOLVED:
|
if response.status == Promise.Status.RESOLVED:
|
||||||
print("Room updated")
|
pass
|
Loading…
Reference in New Issue
Block a user