Fixed bug with starve and day end dialogs stomping on each other

This commit is contained in:
akshay committed 2022-08-21 12:13:33 -04:00
1 parent ef7a22a980
commit ba3c1b6055
3 files changed
+18 -9

No files matched your search

+1
View File
@@ -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)
+11 -8
View File
@@ -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)
@@ -90,12 +88,17 @@ func unhandled_input(event: InputEvent):
var tween = model_transform.create_tween()
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())