stamina tweak on old state.

This commit is contained in:
Dustin 2025-06-15 10:40:13 -07:00
parent 5196b3eb6e
commit 1ceec696cc
2 changed files with 11 additions and 2 deletions

View File

@ -18,6 +18,8 @@ func _ready():
if debug_velocity_controller: if debug_velocity_controller:
velocity_controller.debug = true velocity_controller.debug = true
assert(parent is Actor, "Movement state receiver assumes parent is an Actor type.")
#var state_ref :State #var state_ref :State
#var state_name :String #var state_name :String
#state_name = 'jump' #state_name = 'jump'

View File

@ -198,6 +198,13 @@ func use_secondary_item() -> String:
func _on_Movement_StateMachine_state_changed(old_state_name, new_state): func _on_Movement_StateMachine_state_changed(old_state_name, new_state):
## Reduce stamina if this state has a cost ## Reduce stamina if this state has a cost
if state_stamina_cost.has(new_state.name): if state_stamina_cost.has(new_state.name):
## Skip stamina removal when coming from certain states
match old_state_name:
'climb':
pass
'ledge_grab':
pass
_:
stamina_component.reduce_stamina(state_stamina_cost[new_state.name]) stamina_component.reduce_stamina(state_stamina_cost[new_state.name])