mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
automatically wield on secondary or ability3
This commit is contained in:
parent
44da25729c
commit
8bcafa6f19
@ -11,7 +11,7 @@ impl CharacterBehavior for Data {
|
||||
fn behavior(&self, data: &JoinData) -> StateUpdate {
|
||||
let mut update = StateUpdate::from(data);
|
||||
|
||||
handle_primary_wield(data, &mut update);
|
||||
handle_wield(data, &mut update);
|
||||
|
||||
// Try to Fall/Stand up/Move
|
||||
if !data.physics.on_ground || data.inputs.move_dir.magnitude_squared() > 0.0 {
|
||||
|
@ -12,7 +12,7 @@ impl CharacterBehavior for Data {
|
||||
|
||||
handle_move(data, &mut update, 1.0);
|
||||
handle_jump(data, &mut update);
|
||||
handle_primary_wield(data, &mut update);
|
||||
handle_wield(data, &mut update);
|
||||
handle_climb(data, &mut update);
|
||||
handle_glide(data, &mut update);
|
||||
handle_dodge_input(data, &mut update);
|
||||
|
@ -11,7 +11,7 @@ impl CharacterBehavior for Data {
|
||||
fn behavior(&self, data: &JoinData) -> StateUpdate {
|
||||
let mut update = StateUpdate::from(data);
|
||||
|
||||
handle_primary_wield(data, &mut update);
|
||||
handle_wield(data, &mut update);
|
||||
|
||||
// Try to Fall/Stand up/Move
|
||||
if !data.physics.on_ground || data.inputs.move_dir.magnitude_squared() > 0.0 {
|
||||
|
@ -96,10 +96,13 @@ fn swim_move(data: &JoinData, update: &mut StateUpdate, efficiency: f32) {
|
||||
}
|
||||
}
|
||||
|
||||
/// First checks whether `primary` input is pressed, then
|
||||
/// attempts to go into Equipping state, otherwise Idle
|
||||
pub fn handle_primary_wield(data: &JoinData, update: &mut StateUpdate) {
|
||||
if data.inputs.primary.is_pressed() {
|
||||
/// First checks whether `primary`, `secondary` or `ability3` input is pressed,
|
||||
/// then attempts to go into Equipping state, otherwise Idle
|
||||
pub fn handle_wield(data: &JoinData, update: &mut StateUpdate) {
|
||||
if data.inputs.primary.is_pressed()
|
||||
|| data.inputs.secondary.is_pressed()
|
||||
|| data.inputs.ability3.is_pressed()
|
||||
{
|
||||
attempt_wield(data, update);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user