Fixed bug with starve and day end dialogs stomping on each other
This commit is contained in:
parent
ef7a22a980
commit
ba3c1b6055
@ -27,7 +27,12 @@ func _unhandled_input(event):
|
||||
toggle_pause_menu()
|
||||
|
||||
func _on_player_starved_to_death():
|
||||
play_simple_dialog("starve")
|
||||
var node = Dialogic.start("starve")
|
||||
node.pause_mode = PAUSE_MODE_PROCESS
|
||||
add_child(node)
|
||||
get_tree().paused = true
|
||||
yield(node, "timeline_end")
|
||||
get_tree().paused = false
|
||||
get_tree().change_scene(MainMenuScenePath)
|
||||
|
||||
func play_simple_dialog(var dialog_name : String):
|
||||
|
@ -64,6 +64,7 @@ func set_health(new_value):
|
||||
child.visible = child.get_index() < health
|
||||
if health <= 0:
|
||||
emit_signal("starved_to_death")
|
||||
hunger_timer.stop()
|
||||
|
||||
func consume_food(item : Resource):
|
||||
set_health(MAX_HEALTH)
|
||||
|
@ -42,8 +42,6 @@ func enter_from(state):
|
||||
# Warp the player to the right position & orientation
|
||||
model_transform.global_transform = hop_position.global_transform
|
||||
else:
|
||||
# Harm the player and show message
|
||||
ctx.set_health(ctx.health - 1)
|
||||
var node = Dialogic.start("day_end")
|
||||
node.pause_mode = ctx.PAUSE_MODE_PROCESS
|
||||
ctx.add_child(node)
|
||||
@ -91,11 +89,16 @@ func unhandled_input(event: InputEvent):
|
||||
tween.tween_property(model_transform, "global_transform:origin", old_model_origin, .1)
|
||||
yield(tween, "finished")
|
||||
|
||||
# Show message
|
||||
var node = Dialogic.start("wake_up")
|
||||
node.pause_mode = ctx.PAUSE_MODE_PROCESS
|
||||
ctx.add_child(node)
|
||||
yield(node, "timeline_end")
|
||||
# Harm the player and show message after they hop out
|
||||
if !made_it_to_bed:
|
||||
ctx.set_health(ctx.health - 1)
|
||||
|
||||
if ctx.health > 0:
|
||||
# Show message
|
||||
var node = Dialogic.start("wake_up")
|
||||
node.pause_mode = ctx.PAUSE_MODE_PROCESS
|
||||
ctx.add_child(node)
|
||||
yield(node, "timeline_end")
|
||||
|
||||
ctx.change_state(ctx.StateDefault.new())
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user