Specific respawning/pill time behavior when player is in labyrinth

This commit is contained in:
karl 2020-01-26 18:32:44 +01:00
parent d8f6ba5979
commit 2135ce6f4a

View File

@ -38,9 +38,10 @@ var _inventory: Control
# public properties
#var IsSuspicios # not needed > Meldewesen handles themselves
var IsHunted # player is beeing flagged if one Meldewesen sees an illegal action
var IsOutside = true # active while player is not in factory
var IsInFactory = false # only active in factory scene
export(bool) var IsHunted # player is beeing flagged if one Meldewesen sees an illegal action
export(bool) var IsOutside = true # active while player is not in factory
export(bool) var IsInFactory = false # only active in factory scene
export(bool) var IsInLabyrinth = false
func is_in_illegalzone ():
return _illegal_areas > 0
@ -78,6 +79,11 @@ func _ready():
_inventory = get_node("HUD")
# Set special fast time when in labyrinth
if IsInLabyrinth:
Daytime.increase_per_second = 100
Pills._decrease_per_second = 0.8
# setup collisions with Meldewesen
var area = get_node("InteractArea") as Area
assert(null != area)
@ -240,17 +246,21 @@ func _on_respawn ():
Logger.info("respawning")
# fade to black and restart scene
_inventory.hide() # disable hud for the time of respawn animation
if not IsInLabyrinth:
_animationFadeOut.play("FadeOut")
yield(_animationFadeOut, "animation_finished")
_animationFadeOut.seek(0, true)
# reset values
Pills._set_level(Pills.get_max())
Daytime._set_time(0)
Logger.info("save areas: " + String(_save_areas))
if _save_areas < 1:
if _save_areas < 1 and not IsInLabyrinth:
Logger.info("reload scene")
Pills._set_level(Pills.get_max())
get_tree().reload_current_scene()
_inventory.show() # enable hud again