Add mood mapping to profile
This commit is contained in:
parent
0c5a0ad84a
commit
4095d4df0f
|
@ -8,6 +8,9 @@ extends Node2D
|
||||||
@export var happiness_decay : float
|
@export var happiness_decay : float
|
||||||
@export var lashout_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.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
pass # Replace with function body.
|
pass # Replace with function body.
|
||||||
|
|
|
@ -45,10 +45,6 @@ func _process(delta):
|
||||||
|
|
||||||
update_expression()
|
update_expression()
|
||||||
|
|
||||||
func hear_joke():
|
|
||||||
var change = randf_range(-3., 3.)
|
|
||||||
update_mood(change)
|
|
||||||
|
|
||||||
func update_mood(change: float):
|
func update_mood(change: float):
|
||||||
if mood > profile.happy_threshold and change > 0 and laughter_left <= 0:
|
if mood > profile.happy_threshold and change > 0 and laughter_left <= 0:
|
||||||
laughter_left = laughter_duration
|
laughter_left = laughter_duration
|
||||||
|
@ -76,4 +72,5 @@ func set_random_face():
|
||||||
head.add_child(face)
|
head.add_child(face)
|
||||||
|
|
||||||
func on_joke(joke: Joke):
|
func on_joke(joke: Joke):
|
||||||
pass
|
var mood_change = profile.joke_mood_mapping.get(joke.type, 0)
|
||||||
|
update_mood(mood_change)
|
||||||
|
|
|
@ -31,3 +31,8 @@ angry_threshold = -3.0
|
||||||
lashout_threshold = -10.0
|
lashout_threshold = -10.0
|
||||||
happiness_decay = 1.0
|
happiness_decay = 1.0
|
||||||
lashout_decay = 10.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
Loading…
Reference in New Issue