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()
|
toggle_pause_menu()
|
||||||
|
|
||||||
func _on_player_starved_to_death():
|
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)
|
get_tree().change_scene(MainMenuScenePath)
|
||||||
|
|
||||||
func play_simple_dialog(var dialog_name : String):
|
func play_simple_dialog(var dialog_name : String):
|
||||||
|
@ -64,6 +64,7 @@ func set_health(new_value):
|
|||||||
child.visible = child.get_index() < health
|
child.visible = child.get_index() < health
|
||||||
if health <= 0:
|
if health <= 0:
|
||||||
emit_signal("starved_to_death")
|
emit_signal("starved_to_death")
|
||||||
|
hunger_timer.stop()
|
||||||
|
|
||||||
func consume_food(item : Resource):
|
func consume_food(item : Resource):
|
||||||
set_health(MAX_HEALTH)
|
set_health(MAX_HEALTH)
|
||||||
|
@ -42,8 +42,6 @@ func enter_from(state):
|
|||||||
# Warp the player to the right position & orientation
|
# Warp the player to the right position & orientation
|
||||||
model_transform.global_transform = hop_position.global_transform
|
model_transform.global_transform = hop_position.global_transform
|
||||||
else:
|
else:
|
||||||
# Harm the player and show message
|
|
||||||
ctx.set_health(ctx.health - 1)
|
|
||||||
var node = Dialogic.start("day_end")
|
var node = Dialogic.start("day_end")
|
||||||
node.pause_mode = ctx.PAUSE_MODE_PROCESS
|
node.pause_mode = ctx.PAUSE_MODE_PROCESS
|
||||||
ctx.add_child(node)
|
ctx.add_child(node)
|
||||||
@ -90,12 +88,17 @@ func unhandled_input(event: InputEvent):
|
|||||||
var tween = model_transform.create_tween()
|
var tween = model_transform.create_tween()
|
||||||
tween.tween_property(model_transform, "global_transform:origin", old_model_origin, .1)
|
tween.tween_property(model_transform, "global_transform:origin", old_model_origin, .1)
|
||||||
yield(tween, "finished")
|
yield(tween, "finished")
|
||||||
|
|
||||||
# Show message
|
# Harm the player and show message after they hop out
|
||||||
var node = Dialogic.start("wake_up")
|
if !made_it_to_bed:
|
||||||
node.pause_mode = ctx.PAUSE_MODE_PROCESS
|
ctx.set_health(ctx.health - 1)
|
||||||
ctx.add_child(node)
|
|
||||||
yield(node, "timeline_end")
|
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())
|
ctx.change_state(ctx.StateDefault.new())
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user