mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Primary ability fully functional.
This commit is contained in:
parent
19c81f1528
commit
21e6f4797c
@ -11,5 +11,4 @@ BasicRanged(
|
||||
projectile_light: None,
|
||||
projectile_gravity: Some(Gravity(0.2)),
|
||||
projectile_speed: 100.0,
|
||||
can_continue: true,
|
||||
)
|
||||
|
@ -11,5 +11,4 @@ BasicRanged(
|
||||
projectile_light: None,
|
||||
projectile_gravity: Some(Gravity(0.2)),
|
||||
projectile_speed: 100.0,
|
||||
can_continue: true,
|
||||
)
|
||||
|
@ -10,5 +10,4 @@ BasicRanged(
|
||||
}),*/
|
||||
projectile_gravity: None,
|
||||
projectile_speed: 100.0,
|
||||
can_continue: false,
|
||||
)
|
@ -14,5 +14,4 @@ BasicRanged(
|
||||
}),*/
|
||||
projectile_gravity: Some(Gravity(0.3)),
|
||||
projectile_speed: 60.0,
|
||||
can_continue: true,
|
||||
)
|
||||
|
@ -14,5 +14,4 @@ BasicRanged(
|
||||
}),*/
|
||||
projectile_gravity: Some(Gravity(0.3)),
|
||||
projectile_speed: 60.0,
|
||||
can_continue: true,
|
||||
)
|
||||
|
@ -14,5 +14,4 @@ BasicRanged(
|
||||
}),*/
|
||||
projectile_gravity: Some(Gravity(5.0)),
|
||||
projectile_speed: 70.0,
|
||||
can_continue: true,
|
||||
)
|
||||
|
@ -11,5 +11,4 @@ BasicRanged(
|
||||
projectile_light: None,
|
||||
projectile_gravity: Some(Gravity(0.1)),
|
||||
projectile_speed: 100.0,
|
||||
can_continue: true,
|
||||
)
|
||||
|
@ -13,5 +13,4 @@ BasicRanged(
|
||||
}),*/
|
||||
projectile_gravity: Some(Gravity(0.3)),
|
||||
projectile_speed: 60.0,
|
||||
can_continue: true,
|
||||
)
|
||||
|
@ -994,7 +994,7 @@ impl Client {
|
||||
pub fn handle_input(&mut self, input: InputKind, pressed: bool) {
|
||||
if pressed {
|
||||
self.control_action(ControlAction::StartInput {
|
||||
ability: input,
|
||||
input,
|
||||
target: None,
|
||||
});
|
||||
} else {
|
||||
|
@ -75,7 +75,6 @@ pub enum CharacterAbility {
|
||||
projectile_light: Option<LightEmitter>,
|
||||
projectile_gravity: Option<Gravity>,
|
||||
projectile_speed: f32,
|
||||
can_continue: bool,
|
||||
},
|
||||
RepeaterRanged {
|
||||
energy_cost: f32,
|
||||
@ -1121,6 +1120,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState {
|
||||
timer: Duration::default(),
|
||||
stage_section: StageSection::Buildup,
|
||||
exhausted: false,
|
||||
end: false,
|
||||
}),
|
||||
CharacterAbility::BasicRanged {
|
||||
buildup_duration,
|
||||
@ -1130,7 +1130,6 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState {
|
||||
projectile_light,
|
||||
projectile_gravity,
|
||||
projectile_speed,
|
||||
can_continue,
|
||||
energy_cost: _,
|
||||
} => CharacterState::BasicRanged(basic_ranged::Data {
|
||||
static_data: basic_ranged::StaticData {
|
||||
@ -1141,13 +1140,12 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState {
|
||||
projectile_light: *projectile_light,
|
||||
projectile_gravity: *projectile_gravity,
|
||||
projectile_speed: *projectile_speed,
|
||||
can_continue: *can_continue,
|
||||
ability_info,
|
||||
},
|
||||
timer: Duration::default(),
|
||||
stage_section: StageSection::Buildup,
|
||||
exhausted: false,
|
||||
continue_next: false,
|
||||
end: false,
|
||||
}),
|
||||
CharacterAbility::Boost {
|
||||
movement_duration,
|
||||
@ -1252,7 +1250,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState {
|
||||
stage: 1,
|
||||
timer: Duration::default(),
|
||||
stage_section: StageSection::Buildup,
|
||||
next_stage: false,
|
||||
end: false,
|
||||
}),
|
||||
CharacterAbility::LeapMelee {
|
||||
energy_cost: _,
|
||||
@ -1497,6 +1495,7 @@ impl From<(&CharacterAbility, AbilityInfo)> for CharacterState {
|
||||
},
|
||||
timer: Duration::default(),
|
||||
stage_section: StageSection::Buildup,
|
||||
end: false,
|
||||
}),
|
||||
CharacterAbility::BasicAura {
|
||||
buildup_duration,
|
||||
|
@ -112,7 +112,7 @@ pub enum ControlAction {
|
||||
Stand,
|
||||
Talk,
|
||||
StartInput {
|
||||
ability: InputKind,
|
||||
input: InputKind,
|
||||
target: Option<Uid>,
|
||||
},
|
||||
CancelInput(InputKind),
|
||||
|
@ -3,7 +3,7 @@ use crate::{
|
||||
Attack, AttackDamage, AttackEffect, CombatEffect, CombatRequirement, Damage, DamageSource,
|
||||
GroupTarget,
|
||||
},
|
||||
comp::{beam, CharacterState, EnergyChange, EnergySource, Ori, Pos, StateUpdate},
|
||||
comp::{beam, CharacterState, EnergyChange, EnergySource, InputKind, Ori, Pos, StateUpdate},
|
||||
event::ServerEvent,
|
||||
states::{
|
||||
behavior::{CharacterBehavior, JoinData},
|
||||
@ -56,6 +56,8 @@ pub struct Data {
|
||||
pub timer: Duration,
|
||||
/// What section the character stage is in
|
||||
pub stage_section: StageSection,
|
||||
/// Whether or not the state should end
|
||||
pub end: bool,
|
||||
}
|
||||
|
||||
impl CharacterBehavior for Data {
|
||||
@ -108,7 +110,9 @@ impl CharacterBehavior for Data {
|
||||
}
|
||||
},
|
||||
StageSection::Cast => {
|
||||
if ability_key_is_pressed(data, self.static_data.ability_info.key)
|
||||
if
|
||||
/* ability_key_is_pressed(data, self.static_data.ability_info.key) */
|
||||
!self.end
|
||||
&& (self.static_data.energy_drain <= f32::EPSILON
|
||||
|| update.energy.current() > 0)
|
||||
{
|
||||
@ -205,6 +209,17 @@ impl CharacterBehavior for Data {
|
||||
|
||||
update
|
||||
}
|
||||
|
||||
fn cancel_input(&self, data: &JoinData, input: InputKind) -> StateUpdate {
|
||||
let mut update = StateUpdate::from(data);
|
||||
update.removed_inputs.push(input);
|
||||
|
||||
if Some(input) == self.static_data.ability_info.input {
|
||||
update.character = CharacterState::BasicBeam(Data { end: true, ..*self });
|
||||
}
|
||||
|
||||
update
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
combat::{Attack, AttackDamage, AttackEffect, CombatBuff, CombatEffect, CombatRequirement},
|
||||
comp::{CharacterState, Melee, StateUpdate},
|
||||
comp::{CharacterState, InputKind, Melee, StateUpdate},
|
||||
states::{
|
||||
behavior::{CharacterBehavior, JoinData},
|
||||
utils::*,
|
||||
@ -44,6 +44,8 @@ pub struct Data {
|
||||
pub stage_section: StageSection,
|
||||
/// Whether the attack can deal more damage
|
||||
pub exhausted: bool,
|
||||
/// Whether or not the state should end
|
||||
pub end: bool,
|
||||
}
|
||||
|
||||
impl CharacterBehavior for Data {
|
||||
@ -162,9 +164,13 @@ impl CharacterBehavior for Data {
|
||||
});
|
||||
} else {
|
||||
// Done
|
||||
update.character = CharacterState::Wielding;
|
||||
// Make sure attack component is removed
|
||||
data.updater.remove::<Melee>(data.entity);
|
||||
if self.end || self.static_data.ability_info.input.is_none() {
|
||||
update.character = CharacterState::Wielding;
|
||||
// Make sure attack component is removed
|
||||
data.updater.remove::<Melee>(data.entity);
|
||||
} else {
|
||||
reset_state(self, data, &mut update);
|
||||
}
|
||||
}
|
||||
},
|
||||
_ => {
|
||||
@ -177,4 +183,21 @@ impl CharacterBehavior for Data {
|
||||
|
||||
update
|
||||
}
|
||||
|
||||
fn cancel_input(&self, data: &JoinData, input: InputKind) -> StateUpdate {
|
||||
let mut update = StateUpdate::from(data);
|
||||
update.removed_inputs.push(input);
|
||||
|
||||
if Some(input) == self.static_data.ability_info.input {
|
||||
if let CharacterState::BasicMelee(c) = &mut update.character {
|
||||
c.end = true;
|
||||
}
|
||||
}
|
||||
|
||||
update
|
||||
}
|
||||
}
|
||||
|
||||
fn reset_state(data: &Data, join: &JoinData, update: &mut StateUpdate) {
|
||||
handle_input(join, update, data.static_data.ability_info.input.unwrap());
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
use crate::{
|
||||
comp::{Body, CharacterState, Gravity, LightEmitter, ProjectileConstructor, StateUpdate},
|
||||
comp::{
|
||||
Body, CharacterState, Gravity, InputKind, LightEmitter, ProjectileConstructor, StateUpdate,
|
||||
},
|
||||
event::ServerEvent,
|
||||
states::{
|
||||
behavior::{CharacterBehavior, JoinData},
|
||||
@ -24,8 +26,6 @@ pub struct StaticData {
|
||||
pub projectile_speed: f32,
|
||||
/// What key is used to press ability
|
||||
pub ability_info: AbilityInfo,
|
||||
/// Whether or not the ability can auto continue
|
||||
pub can_continue: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
@ -39,9 +39,8 @@ pub struct Data {
|
||||
pub stage_section: StageSection,
|
||||
/// Whether the attack fired already
|
||||
pub exhausted: bool,
|
||||
/// If in buildup, whether the attack has continued form previous attack; if
|
||||
/// in recover, whether the attack will continue to a new attack
|
||||
pub continue_next: bool,
|
||||
/// Whether or not the state should end
|
||||
pub end: bool,
|
||||
}
|
||||
|
||||
impl CharacterBehavior for Data {
|
||||
@ -103,41 +102,24 @@ impl CharacterBehavior for Data {
|
||||
|
||||
update.character = CharacterState::BasicRanged(Data {
|
||||
exhausted: true,
|
||||
continue_next: false,
|
||||
..*self
|
||||
});
|
||||
} else if self.timer < self.static_data.recover_duration {
|
||||
if ability_key_is_pressed(data, self.static_data.ability_info.key) {
|
||||
// Recovers
|
||||
update.character = CharacterState::BasicRanged(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
continue_next: self.static_data.can_continue,
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
// Recovers
|
||||
update.character = CharacterState::BasicRanged(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
..*self
|
||||
});
|
||||
}
|
||||
} else if self.continue_next {
|
||||
// Restarts character state
|
||||
// Recovers
|
||||
update.character = CharacterState::BasicRanged(Data {
|
||||
timer: Duration::default(),
|
||||
stage_section: StageSection::Buildup,
|
||||
exhausted: false,
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
..*self
|
||||
})
|
||||
});
|
||||
} else {
|
||||
// Done
|
||||
update.character = CharacterState::Wielding;
|
||||
if self.end || self.static_data.ability_info.input.is_none() {
|
||||
update.character = CharacterState::Wielding;
|
||||
} else {
|
||||
reset_state(self, data, &mut update);
|
||||
}
|
||||
}
|
||||
},
|
||||
_ => {
|
||||
@ -148,4 +130,21 @@ impl CharacterBehavior for Data {
|
||||
|
||||
update
|
||||
}
|
||||
|
||||
fn cancel_input(&self, data: &JoinData, input: InputKind) -> StateUpdate {
|
||||
let mut update = StateUpdate::from(data);
|
||||
update.removed_inputs.push(input);
|
||||
|
||||
if Some(input) == self.static_data.ability_info.input {
|
||||
if let CharacterState::BasicRanged(c) = &mut update.character {
|
||||
c.end = true;
|
||||
}
|
||||
}
|
||||
|
||||
update
|
||||
}
|
||||
}
|
||||
|
||||
fn reset_state(data: &Data, join: &JoinData, update: &mut StateUpdate) {
|
||||
handle_input(join, update, data.static_data.ability_info.input.unwrap());
|
||||
}
|
||||
|
@ -51,9 +51,7 @@ pub trait CharacterBehavior {
|
||||
ControlAction::Sneak => self.sneak(data),
|
||||
ControlAction::Stand => self.stand(data),
|
||||
ControlAction::Talk => self.talk(data),
|
||||
ControlAction::StartInput { ability, target } => {
|
||||
self.handle_input(data, ability, target)
|
||||
},
|
||||
ControlAction::StartInput { input, target } => self.handle_input(data, input, target),
|
||||
ControlAction::CancelInput(input) => self.cancel_input(data, input),
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ impl CharacterBehavior for Data {
|
||||
if self.end || self.static_data.ability_info.input.is_none() {
|
||||
update.character = CharacterState::Wielding;
|
||||
} else {
|
||||
reset_state(self, &mut update);
|
||||
reset_state(self, data, &mut update);
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,16 +64,15 @@ impl CharacterBehavior for Data {
|
||||
update.removed_inputs.push(input);
|
||||
|
||||
if Some(input) == self.static_data.ability_info.input {
|
||||
update.character = CharacterState::Boost(Data { end: true, ..*self });
|
||||
if let CharacterState::Boost(c) = &mut update.character {
|
||||
c.end = true;
|
||||
}
|
||||
}
|
||||
|
||||
update
|
||||
}
|
||||
}
|
||||
|
||||
fn reset_state(data: &Data, update: &mut StateUpdate) {
|
||||
update.character = CharacterState::Boost(Data {
|
||||
timer: Duration::default(),
|
||||
..*data
|
||||
})
|
||||
fn reset_state(data: &Data, join: &JoinData, update: &mut StateUpdate) {
|
||||
handle_input(join, update, data.static_data.ability_info.input.unwrap());
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
combat::{Attack, AttackDamage, AttackEffect, CombatBuff, CombatEffect, CombatRequirement},
|
||||
comp::{CharacterState, Melee, StateUpdate},
|
||||
comp::{CharacterState, InputKind, Melee, StateUpdate},
|
||||
states::{
|
||||
behavior::{CharacterBehavior, JoinData},
|
||||
utils::*,
|
||||
@ -113,8 +113,8 @@ pub struct Data {
|
||||
pub timer: Duration,
|
||||
/// Checks what section a stage is in
|
||||
pub stage_section: StageSection,
|
||||
/// Whether the state should go onto the next stage
|
||||
pub next_stage: bool,
|
||||
/// Whether or not the state should end
|
||||
pub end: bool,
|
||||
}
|
||||
|
||||
impl CharacterBehavior for Data {
|
||||
@ -261,41 +261,23 @@ impl CharacterBehavior for Data {
|
||||
StageSection::Recover => {
|
||||
if self.timer < self.static_data.stage_data[stage_index].base_recover_duration {
|
||||
// Recovers
|
||||
if ability_key_is_pressed(data, self.static_data.ability_info.key) {
|
||||
// Checks if state will transition to next stage after recover
|
||||
update.character = CharacterState::ComboMelee(Data {
|
||||
static_data: self.static_data.clone(),
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0 * speed_modifer))
|
||||
.unwrap_or_default(),
|
||||
next_stage: true,
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
update.character = CharacterState::ComboMelee(Data {
|
||||
static_data: self.static_data.clone(),
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0 * speed_modifer))
|
||||
.unwrap_or_default(),
|
||||
..*self
|
||||
});
|
||||
}
|
||||
} else if self.next_stage {
|
||||
// Transitions to buildup section of next stage
|
||||
update.character = CharacterState::ComboMelee(Data {
|
||||
static_data: self.static_data.clone(),
|
||||
stage: (self.stage % self.static_data.num_stages) + 1,
|
||||
timer: Duration::default(),
|
||||
stage_section: StageSection::Buildup,
|
||||
next_stage: false,
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0 * speed_modifer))
|
||||
.unwrap_or_default(),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
// Done
|
||||
update.character = CharacterState::Wielding;
|
||||
// Make sure attack component is removed
|
||||
data.updater.remove::<Melee>(data.entity);
|
||||
if self.end || self.static_data.ability_info.input.is_none() {
|
||||
update.character = CharacterState::Wielding;
|
||||
// Make sure attack component is removed
|
||||
data.updater.remove::<Melee>(data.entity);
|
||||
} else {
|
||||
reset_state(self, data, &mut update);
|
||||
}
|
||||
}
|
||||
},
|
||||
_ => {
|
||||
@ -306,20 +288,27 @@ impl CharacterBehavior for Data {
|
||||
},
|
||||
}
|
||||
|
||||
// Grant energy on successful hit
|
||||
if let Some(attack) = data.melee_attack {
|
||||
if attack.applied && attack.hit_count > 0 {
|
||||
update.character = CharacterState::ComboMelee(Data {
|
||||
static_data: self.static_data.clone(),
|
||||
stage: self.stage,
|
||||
timer: self.timer,
|
||||
stage_section: self.stage_section,
|
||||
next_stage: self.next_stage,
|
||||
});
|
||||
data.updater.remove::<Melee>(data.entity);
|
||||
update
|
||||
}
|
||||
|
||||
fn cancel_input(&self, data: &JoinData, input: InputKind) -> StateUpdate {
|
||||
let mut update = StateUpdate::from(data);
|
||||
update.removed_inputs.push(input);
|
||||
|
||||
if Some(input) == self.static_data.ability_info.input {
|
||||
if let CharacterState::ComboMelee(c) = &mut update.character {
|
||||
c.end = true;
|
||||
}
|
||||
}
|
||||
|
||||
update
|
||||
}
|
||||
}
|
||||
|
||||
fn reset_state(data: &Data, join: &JoinData, update: &mut StateUpdate) {
|
||||
handle_input(join, update, data.static_data.ability_info.input.unwrap());
|
||||
|
||||
if let CharacterState::ComboMelee(c) = &mut update.character {
|
||||
c.stage = (data.stage % data.static_data.num_stages) + 1;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
use super::utils::*;
|
||||
use crate::{
|
||||
comp::{InventoryAction, StateUpdate},
|
||||
comp::{CharacterState, InputKind, InventoryAction, StateUpdate},
|
||||
states::behavior::{CharacterBehavior, JoinData},
|
||||
uid::Uid,
|
||||
};
|
||||
|
||||
pub struct Data;
|
||||
@ -19,6 +20,18 @@ impl CharacterBehavior for Data {
|
||||
update
|
||||
}
|
||||
|
||||
fn handle_input(
|
||||
&self,
|
||||
data: &JoinData,
|
||||
_input: InputKind,
|
||||
_target: Option<Uid>,
|
||||
) -> StateUpdate {
|
||||
let mut update = StateUpdate::from(data);
|
||||
update.character = CharacterState::Wielding;
|
||||
|
||||
update
|
||||
}
|
||||
|
||||
fn wield(&self, data: &JoinData) -> StateUpdate {
|
||||
let mut update = StateUpdate::from(data);
|
||||
attempt_wield(data, &mut update);
|
||||
|
@ -26,14 +26,9 @@ impl CharacterBehavior for Data {
|
||||
update
|
||||
}
|
||||
|
||||
fn handle_input(
|
||||
&self,
|
||||
data: &JoinData,
|
||||
ability: InputKind,
|
||||
_target: Option<Uid>,
|
||||
) -> StateUpdate {
|
||||
fn handle_input(&self, data: &JoinData, input: InputKind, _target: Option<Uid>) -> StateUpdate {
|
||||
let mut update = StateUpdate::from(data);
|
||||
handle_input(&data, &mut update, ability);
|
||||
handle_input(&data, &mut update, input);
|
||||
|
||||
update
|
||||
}
|
||||
|
@ -1082,7 +1082,7 @@ impl<'a> AgentData<'a> {
|
||||
Tactic::Melee => {
|
||||
if dist_sqrd < (min_attack_dist * self.scale).powi(2) {
|
||||
controller.actions.push(ControlAction::StartInput {
|
||||
ability: InputKind::Primary,
|
||||
input: InputKind::Primary,
|
||||
target: None,
|
||||
});
|
||||
//controller.inputs.primary.set_state(true);
|
||||
@ -1134,7 +1134,7 @@ impl<'a> AgentData<'a> {
|
||||
agent.action_timer += dt.0;
|
||||
} else {
|
||||
controller.actions.push(ControlAction::StartInput {
|
||||
ability: InputKind::Primary,
|
||||
input: InputKind::Primary,
|
||||
target: None,
|
||||
});
|
||||
//controller.inputs.primary.set_state(true);
|
||||
@ -1186,7 +1186,7 @@ impl<'a> AgentData<'a> {
|
||||
agent.action_timer += dt.0;
|
||||
} else {
|
||||
controller.actions.push(ControlAction::StartInput {
|
||||
ability: InputKind::Primary,
|
||||
input: InputKind::Primary,
|
||||
target: None,
|
||||
});
|
||||
//controller.inputs.primary.set_state(true);
|
||||
@ -1250,7 +1250,7 @@ impl<'a> AgentData<'a> {
|
||||
agent.action_timer = 0.0;
|
||||
} else {
|
||||
controller.actions.push(ControlAction::StartInput {
|
||||
ability: InputKind::Primary,
|
||||
input: InputKind::Primary,
|
||||
target: None,
|
||||
});
|
||||
//controller.inputs.primary.set_state(true);
|
||||
@ -1335,7 +1335,7 @@ impl<'a> AgentData<'a> {
|
||||
} else {
|
||||
controller.inputs.secondary.set_state(false);
|
||||
controller.actions.push(ControlAction::StartInput {
|
||||
ability: InputKind::Primary,
|
||||
input: InputKind::Primary,
|
||||
target: None,
|
||||
});
|
||||
//controller.inputs.primary.set_state(true);
|
||||
@ -1409,7 +1409,7 @@ impl<'a> AgentData<'a> {
|
||||
controller.inputs.secondary.set_state(true);
|
||||
} else {
|
||||
controller.actions.push(ControlAction::StartInput {
|
||||
ability: InputKind::Primary,
|
||||
input: InputKind::Primary,
|
||||
target: None,
|
||||
});
|
||||
//controller.inputs.primary.set_state(true);
|
||||
@ -1433,7 +1433,7 @@ impl<'a> AgentData<'a> {
|
||||
.unwrap_or_else(Vec2::zero)
|
||||
* speed;
|
||||
controller.actions.push(ControlAction::StartInput {
|
||||
ability: InputKind::Primary,
|
||||
input: InputKind::Primary,
|
||||
target: None,
|
||||
});
|
||||
//controller.inputs.primary.set_state(true);
|
||||
@ -1476,7 +1476,7 @@ impl<'a> AgentData<'a> {
|
||||
// large hitbox
|
||||
controller.inputs.move_dir = Vec2::zero();
|
||||
controller.actions.push(ControlAction::StartInput {
|
||||
ability: InputKind::Primary,
|
||||
input: InputKind::Primary,
|
||||
target: None,
|
||||
});
|
||||
//controller.inputs.primary.set_state(true);
|
||||
@ -1522,7 +1522,7 @@ impl<'a> AgentData<'a> {
|
||||
{
|
||||
controller.inputs.move_dir = Vec2::zero();
|
||||
controller.actions.push(ControlAction::StartInput {
|
||||
ability: InputKind::Primary,
|
||||
input: InputKind::Primary,
|
||||
target: None,
|
||||
});
|
||||
//controller.inputs.primary.set_state(true);
|
||||
@ -1584,7 +1584,7 @@ impl<'a> AgentData<'a> {
|
||||
.try_normalized()
|
||||
.unwrap_or_else(Vec2::unit_y);
|
||||
controller.actions.push(ControlAction::StartInput {
|
||||
ability: InputKind::Primary,
|
||||
input: InputKind::Primary,
|
||||
target: None,
|
||||
});
|
||||
//controller.inputs.primary.set_state(true);
|
||||
@ -1645,7 +1645,7 @@ impl<'a> AgentData<'a> {
|
||||
agent.action_timer = 0.0;
|
||||
} else if agent.action_timer > 1.0 {
|
||||
controller.actions.push(ControlAction::StartInput {
|
||||
ability: InputKind::Primary,
|
||||
input: InputKind::Primary,
|
||||
target: None,
|
||||
});
|
||||
//controller.inputs.primary.set_state(true);
|
||||
@ -1687,7 +1687,7 @@ impl<'a> AgentData<'a> {
|
||||
&& dist_sqrd > (2.0 * min_attack_dist * self.scale).powi(2)
|
||||
{
|
||||
controller.actions.push(ControlAction::StartInput {
|
||||
ability: InputKind::Primary,
|
||||
input: InputKind::Primary,
|
||||
target: None,
|
||||
});
|
||||
//controller.inputs.primary.set_state(true);
|
||||
@ -1726,7 +1726,7 @@ impl<'a> AgentData<'a> {
|
||||
agent.action_timer += dt.0;
|
||||
} else {
|
||||
controller.actions.push(ControlAction::StartInput {
|
||||
ability: InputKind::Primary,
|
||||
input: InputKind::Primary,
|
||||
target: None,
|
||||
});
|
||||
//controller.inputs.primary.set_state(true);
|
||||
@ -1771,7 +1771,7 @@ impl<'a> AgentData<'a> {
|
||||
) {
|
||||
if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) {
|
||||
controller.actions.push(ControlAction::StartInput {
|
||||
ability: InputKind::Primary,
|
||||
input: InputKind::Primary,
|
||||
target: None,
|
||||
});
|
||||
//controller.inputs.primary.set_state(true);
|
||||
@ -1796,7 +1796,7 @@ impl<'a> AgentData<'a> {
|
||||
agent.action_timer += dt.0;
|
||||
} else if agent.action_timer < 3.0 {
|
||||
controller.actions.push(ControlAction::StartInput {
|
||||
ability: InputKind::Primary,
|
||||
input: InputKind::Primary,
|
||||
target: None,
|
||||
});
|
||||
//controller.inputs.primary.set_state(true);
|
||||
@ -1836,7 +1836,7 @@ impl<'a> AgentData<'a> {
|
||||
.try_normalized()
|
||||
.unwrap_or_else(Vec2::unit_y);
|
||||
controller.actions.push(ControlAction::StartInput {
|
||||
ability: InputKind::Primary,
|
||||
input: InputKind::Primary,
|
||||
target: None,
|
||||
});
|
||||
//controller.inputs.primary.set_state(true);
|
||||
@ -1848,7 +1848,7 @@ impl<'a> AgentData<'a> {
|
||||
.try_normalized()
|
||||
.unwrap_or_else(Vec2::unit_y);
|
||||
controller.actions.push(ControlAction::StartInput {
|
||||
ability: InputKind::Primary,
|
||||
input: InputKind::Primary,
|
||||
target: None,
|
||||
});
|
||||
//controller.inputs.primary.set_state(true);
|
||||
@ -1883,7 +1883,7 @@ impl<'a> AgentData<'a> {
|
||||
if dist_sqrd < (2.0 * min_attack_dist * self.scale).powi(2) {
|
||||
controller.inputs.move_dir = Vec2::zero();
|
||||
controller.actions.push(ControlAction::StartInput {
|
||||
ability: InputKind::Primary,
|
||||
input: InputKind::Primary,
|
||||
target: None,
|
||||
});
|
||||
//controller.inputs.primary.set_state(true);
|
||||
@ -1910,7 +1910,7 @@ impl<'a> AgentData<'a> {
|
||||
Tactic::Turret => {
|
||||
if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) {
|
||||
controller.actions.push(ControlAction::StartInput {
|
||||
ability: InputKind::Primary,
|
||||
input: InputKind::Primary,
|
||||
target: None,
|
||||
});
|
||||
//controller.inputs.primary.set_state(true);
|
||||
@ -1922,7 +1922,7 @@ impl<'a> AgentData<'a> {
|
||||
controller.inputs.look_dir = self.ori.look_dir();
|
||||
if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) {
|
||||
controller.actions.push(ControlAction::StartInput {
|
||||
ability: InputKind::Primary,
|
||||
input: InputKind::Primary,
|
||||
target: None,
|
||||
});
|
||||
//controller.inputs.primary.set_state(true);
|
||||
@ -1940,7 +1940,7 @@ impl<'a> AgentData<'a> {
|
||||
);
|
||||
if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) {
|
||||
controller.actions.push(ControlAction::StartInput {
|
||||
ability: InputKind::Primary,
|
||||
input: InputKind::Primary,
|
||||
target: None,
|
||||
});
|
||||
//controller.inputs.primary.set_state(true);
|
||||
|
Loading…
Reference in New Issue
Block a user