From 50a636070fdffdb64279a5851cc54da33ca6bdb2 Mon Sep 17 00:00:00 2001 From: Mikhail Aristov <12281487+MikhailAristov@users.noreply.github.com> Date: Sat, 27 Jan 2024 15:51:52 +0100 Subject: [PATCH] fix mood cheat to trigger once per press --- godot/scenes/crowd/person.gd | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/godot/scenes/crowd/person.gd b/godot/scenes/crowd/person.gd index 53bb876..5fd4de3 100644 --- a/godot/scenes/crowd/person.gd +++ b/godot/scenes/crowd/person.gd @@ -67,11 +67,16 @@ func _process(delta): elif mood < profile.lashout_threshold * .9: mood += profile.lashout_decay * delta - if Input.is_key_pressed(KEY_SPACE) and OS.is_debug_build(): - update_mood(1.) - update_expression() +func _input(event): + var just_pressed = event.is_pressed() and not event.is_echo() + if just_pressed and OS.is_debug_build(): + if Input.is_key_pressed(KEY_SPACE): + update_mood(1.) + elif Input.is_key_pressed(KEY_ENTER): + update_mood(-1.) + func hear_joke(): var change = randf_range(-3., 3.) update_mood(change)