Add mood mapping to profile

This commit is contained in:
Waldemar Tomme 2024-01-27 15:20:18 +01:00
parent 0c5a0ad84a
commit 4095d4df0f
4 changed files with 38 additions and 33 deletions

View File

@ -8,6 +8,9 @@ extends Node2D
@export var happiness_decay : float
@export var lashout_decay : float
# Maps JokeType (as int) to mood change (as float)
@export var joke_mood_mapping: Dictionary
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.

View File

@ -45,10 +45,6 @@ func _process(delta):
update_expression()
func hear_joke():
var change = randf_range(-3., 3.)
update_mood(change)
func update_mood(change: float):
if mood > profile.happy_threshold and change > 0 and laughter_left <= 0:
laughter_left = laughter_duration
@ -76,4 +72,5 @@ func set_random_face():
head.add_child(face)
func on_joke(joke: Joke):
pass
var mood_change = profile.joke_mood_mapping.get(joke.type, 0)
update_mood(mood_change)

View File

@ -31,3 +31,8 @@ angry_threshold = -3.0
lashout_threshold = -10.0
happiness_decay = 1.0
lashout_decay = 10.0
joke_mood_mapping = {
0: 1.0,
1: 0.0,
2: -0.5
}

File diff suppressed because one or more lines are too long