Made behaviour during GlideWield more clean

This commit is contained in:
juliancoffee 2024-03-02 22:24:48 +02:00
parent 29ca171256
commit 3eee002fa3

View File

@ -192,8 +192,15 @@ fn maintain_if_gliding(bdata: &mut BehaviorData) -> bool {
.glider_flight(bdata.controller, bdata.read_data);
true
},
CharacterState::GlideWield(_) if bdata.agent_data.physics_state.on_ground.is_some() => {
CharacterState::GlideWield(_) => {
if bdata.agent_data.physics_state.on_ground.is_some() {
bdata.controller.push_action(ControlAction::Unwield);
}
// Always stop execution if during GlideWield.
// - If on ground, the line above will unwield the glider on next
// tick
// - If in air, we probably wouldn't want to do anything anyway, as
// character state code will shift itself to glide on next tick
true
},
_ => false,