feat: Implement nausea symptom system and related features
- Added SymptomManager autoload for managing symptom intensities. - Introduced nausea tilt effect for camera roll based on nausea intensity. - Created color desaturation shader and overlay for visual feedback. - Developed TreatmentManager to handle nausea ramping during IV treatment. - Added hospital room scene with first-person controller and interactions. - Implemented sit-down interaction for the treatment chair. - Created IV insertion sequence with animations and completion signal. - Added player controller with movement and interaction capabilities. - Integrated nausea effects into the player experience with smooth transitions.
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
class_name TreatmentManager
|
||||
extends Node
|
||||
## Drives nausea during an active treatment.
|
||||
##
|
||||
## When `start_ramp()` is called (wired to IV `iv_completed`), nausea ramps from
|
||||
## its current value up to `ramp_target` over `ramp_duration` seconds, then holds.
|
||||
## The SymptomManager autoload propagates changes to the tilt + desaturation
|
||||
## effects, so this node only needs to push intensity values.
|
||||
|
||||
signal treatment_started
|
||||
signal ramp_complete
|
||||
|
||||
## Target nausea intensity at the end of the initial ramp.
|
||||
@export var ramp_target: float = 40.0
|
||||
## How long (seconds) the initial ramp takes.
|
||||
@export var ramp_duration: float = 30.0
|
||||
|
||||
var _ramping: bool = false
|
||||
var _elapsed: float = 0.0
|
||||
var _start_value: float = 0.0
|
||||
var _sm: Node = null
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if is_inside_tree():
|
||||
_sm = get_tree().root.get_node_or_null("SymptomManager")
|
||||
if _sm == null:
|
||||
_sm = SymptomManager
|
||||
set_process(false)
|
||||
|
||||
|
||||
## Begin the nausea ramp. Safe to wire directly to IVInsertion.iv_completed.
|
||||
func start_ramp() -> void:
|
||||
if _sm == null:
|
||||
push_warning("TreatmentManager: SymptomManager not available.")
|
||||
return
|
||||
_start_value = _sm.get_intensity(_sm.NAUSEA)
|
||||
_elapsed = 0.0
|
||||
_ramping = true
|
||||
set_process(true)
|
||||
treatment_started.emit()
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if not _ramping:
|
||||
return
|
||||
_elapsed += delta
|
||||
var t := clampf(_elapsed / ramp_duration, 0.0, 1.0)
|
||||
var value := lerpf(_start_value, ramp_target, t)
|
||||
_sm.trigger_symptom(_sm.NAUSEA, value)
|
||||
if t >= 1.0:
|
||||
_ramping = false
|
||||
set_process(false)
|
||||
ramp_complete.emit()
|
||||
Reference in New Issue
Block a user