diff --git a/modules/going/player_states.h b/modules/going/player_states.h index f987bb6c..adae9a9b 100644 --- a/modules/going/player_states.h +++ b/modules/going/player_states.h @@ -114,7 +114,12 @@ void PlayerStateMachine::add_state() { template void PlayerStateMachine::force_state() { - this->states[TState::get_class_static()]; + PlayerState::StateID next{TState::get_class_static()}; + if(next != this->current_state->get_class()) { + this->current_state->state_exited(); + this->current_state = this->states[TState::get_class_static()]; + this->current_state->state_entered(); + } } #endif // !PLAYER_STATES_H