mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Switched to BasicMelee
This commit is contained in:
parent
b1026296cb
commit
b45df7fe10
@ -1,23 +1,11 @@
|
|||||||
ComboMelee(
|
BasicMelee(
|
||||||
stage_data: [(
|
energy_cost: 0,
|
||||||
stage: 1,
|
buildup_duration: 0.6,
|
||||||
base_damage: 150,
|
swing_duration: 0.1,
|
||||||
damage_increase: 10,
|
recover_duration: 0.15,
|
||||||
base_poise_damage: 40,
|
base_damage: 50,
|
||||||
poise_damage_increase: 0,
|
base_poise_damage: 0,
|
||||||
knockback: 10.0,
|
knockback: 0.0,
|
||||||
range: 4.5,
|
range: 3.5,
|
||||||
angle: 50.0,
|
max_angle: 20.0,
|
||||||
base_buildup_duration: 0.4,
|
|
||||||
base_swing_duration: 0.1,
|
|
||||||
base_recover_duration: 0.25,
|
|
||||||
forward_movement: 0.0,
|
|
||||||
)],
|
|
||||||
initial_energy_gain: 50,
|
|
||||||
max_energy_gain: 150,
|
|
||||||
energy_increase: 50,
|
|
||||||
speed_increase: 0.1,
|
|
||||||
max_speed_increase: 0.4,
|
|
||||||
scales_from_combo: 2,
|
|
||||||
is_interruptible: false,
|
|
||||||
)
|
)
|
||||||
|
@ -9,8 +9,8 @@ ItemDef(
|
|||||||
power: 0.25,
|
power: 0.25,
|
||||||
poise_strength: 0.25,
|
poise_strength: 0.25,
|
||||||
speed: 0.5,
|
speed: 0.5,
|
||||||
crit_chance: 0.09375,
|
crit_chance: 0.0,
|
||||||
crit_mult: 2.2190475,
|
crit_mult: 1.0,
|
||||||
)),
|
)),
|
||||||
)),
|
)),
|
||||||
quality: Low,
|
quality: Low,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
combat::Attack,
|
combat::Attack,
|
||||||
comp::{Energy, InputKind, Ori, Pos, Vel},
|
comp::{tool::ToolKind, Energy, InputAttr, InputKind, Ori, Pos, Vel},
|
||||||
event::{LocalEvent, ServerEvent},
|
event::{LocalEvent, ServerEvent},
|
||||||
states::{behavior::JoinData, *},
|
states::{behavior::JoinData, *},
|
||||||
};
|
};
|
||||||
@ -10,11 +10,6 @@ use specs_idvs::IdvStorage;
|
|||||||
use std::collections::{BTreeMap, VecDeque};
|
use std::collections::{BTreeMap, VecDeque};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
|
|
||||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
|
||||||
pub struct InputAttr {
|
|
||||||
pub select_pos: Option<Vec3<f32>>,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Data returned from character behavior fn's to Character Behavior System.
|
/// Data returned from character behavior fn's to Character Behavior System.
|
||||||
pub struct StateUpdate {
|
pub struct StateUpdate {
|
||||||
pub character: CharacterState,
|
pub character: CharacterState,
|
||||||
@ -200,7 +195,7 @@ pub struct Melee {
|
|||||||
pub max_angle: f32,
|
pub max_angle: f32,
|
||||||
pub applied: bool,
|
pub applied: bool,
|
||||||
pub hit_count: u32,
|
pub hit_count: u32,
|
||||||
pub break_block: Option<Vec3<i32>>,
|
pub break_block: Option<(Vec3<i32>, Option<ToolKind>)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Component for Melee {
|
impl Component for Melee {
|
||||||
|
@ -2,7 +2,7 @@ use crate::{
|
|||||||
comp::{
|
comp::{
|
||||||
inventory::slot::{EquipSlot, InvSlotId, Slot},
|
inventory::slot::{EquipSlot, InvSlotId, Slot},
|
||||||
invite::{InviteKind, InviteResponse},
|
invite::{InviteKind, InviteResponse},
|
||||||
BuffKind, InputAttr,
|
BuffKind,
|
||||||
},
|
},
|
||||||
trade::{TradeAction, TradeId},
|
trade::{TradeAction, TradeId},
|
||||||
uid::Uid,
|
uid::Uid,
|
||||||
@ -118,7 +118,7 @@ pub enum ControlAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ControlAction {
|
impl ControlAction {
|
||||||
pub fn basic_start(input: InputKind) -> Self {
|
pub fn basic_input(input: InputKind) -> Self {
|
||||||
ControlAction::StartInput {
|
ControlAction::StartInput {
|
||||||
input,
|
input,
|
||||||
target: None,
|
target: None,
|
||||||
@ -144,6 +144,11 @@ impl InputKind {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
|
pub struct InputAttr {
|
||||||
|
pub select_pos: Option<Vec3<f32>>,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub enum Climb {
|
pub enum Climb {
|
||||||
Up,
|
Up,
|
||||||
|
@ -55,14 +55,14 @@ pub use self::{
|
|||||||
Buff, BuffCategory, BuffChange, BuffData, BuffEffect, BuffId, BuffKind, BuffSource, Buffs,
|
Buff, BuffCategory, BuffChange, BuffData, BuffEffect, BuffId, BuffKind, BuffSource, Buffs,
|
||||||
ModifierKind,
|
ModifierKind,
|
||||||
},
|
},
|
||||||
character_state::{CharacterState, InputAttr, Melee, StateUpdate},
|
character_state::{CharacterState, Melee, StateUpdate},
|
||||||
chat::{
|
chat::{
|
||||||
ChatMode, ChatMsg, ChatType, Faction, SpeechBubble, SpeechBubbleType, UnresolvedChatMsg,
|
ChatMode, ChatMsg, ChatType, Faction, SpeechBubble, SpeechBubbleType, UnresolvedChatMsg,
|
||||||
},
|
},
|
||||||
combo::Combo,
|
combo::Combo,
|
||||||
controller::{
|
controller::{
|
||||||
Climb, ControlAction, ControlEvent, Controller, ControllerInputs, GroupManip, InputKind,
|
Climb, ControlAction, ControlEvent, Controller, ControllerInputs, GroupManip, InputAttr,
|
||||||
InventoryAction, InventoryEvent, InventoryManip, MountState, Mounting,
|
InputKind, InventoryAction, InventoryEvent, InventoryManip, MountState, Mounting,
|
||||||
},
|
},
|
||||||
energy::{Energy, EnergyChange, EnergySource},
|
energy::{Energy, EnergyChange, EnergySource},
|
||||||
group::Group,
|
group::Group,
|
||||||
|
@ -152,6 +152,7 @@ pub enum ServerEvent {
|
|||||||
// Attempt to mine a block, turning it into an item
|
// Attempt to mine a block, turning it into an item
|
||||||
MineBlock {
|
MineBlock {
|
||||||
pos: Vec3<i32>,
|
pos: Vec3<i32>,
|
||||||
|
tool: Option<comp::tool::ToolKind>,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,10 +122,17 @@ impl CharacterBehavior for Data {
|
|||||||
max_angle: self.static_data.max_angle,
|
max_angle: self.static_data.max_angle,
|
||||||
applied: false,
|
applied: false,
|
||||||
hit_count: 0,
|
hit_count: 0,
|
||||||
break_block: update
|
break_block: self
|
||||||
|
.static_data
|
||||||
|
.ability_info
|
||||||
.select_pos
|
.select_pos
|
||||||
.filter(|_| self.static_data.ability_info.tool == Some(ToolKind::Pick))
|
.map(|p| {
|
||||||
.map(|p| p.map(|e| e.floor() as i32)),
|
(
|
||||||
|
p.map(|e| e.floor() as i32),
|
||||||
|
self.static_data.ability_info.tool,
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.filter(|(_, tool)| tool == &Some(ToolKind::Pick)),
|
||||||
});
|
});
|
||||||
} else if self.timer < self.static_data.swing_duration {
|
} else if self.timer < self.static_data.swing_duration {
|
||||||
// Swings
|
// Swings
|
||||||
|
@ -187,10 +187,17 @@ impl CharacterBehavior for Data {
|
|||||||
max_angle: self.static_data.max_angle.to_radians(),
|
max_angle: self.static_data.max_angle.to_radians(),
|
||||||
applied: false,
|
applied: false,
|
||||||
hit_count: 0,
|
hit_count: 0,
|
||||||
break_block: update
|
break_block: self
|
||||||
|
.static_data
|
||||||
|
.ability_info
|
||||||
.select_pos
|
.select_pos
|
||||||
.filter(|_| self.static_data.ability_info.tool == Some(ToolKind::Pick))
|
.map(|p| {
|
||||||
.map(|p| p.map(|e| e.floor() as i32)),
|
(
|
||||||
|
p.map(|e| e.floor() as i32),
|
||||||
|
self.static_data.ability_info.tool,
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.filter(|(_, tool)| tool == &Some(ToolKind::Pick)),
|
||||||
});
|
});
|
||||||
} else if self.timer < self.static_data.swing_duration {
|
} else if self.timer < self.static_data.swing_duration {
|
||||||
// Swings
|
// Swings
|
||||||
|
@ -217,8 +217,13 @@ impl CharacterBehavior for Data {
|
|||||||
.static_data
|
.static_data
|
||||||
.ability_info
|
.ability_info
|
||||||
.select_pos
|
.select_pos
|
||||||
.filter(|_| self.static_data.ability_info.tool == Some(ToolKind::Pick))
|
.map(|p| {
|
||||||
.map(|p| p.map(|e| e.floor() as i32)),
|
(
|
||||||
|
p.map(|e| e.floor() as i32),
|
||||||
|
self.static_data.ability_info.tool,
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.filter(|(_, tool)| tool == &Some(ToolKind::Pick)),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -164,12 +164,17 @@ impl CharacterBehavior for Data {
|
|||||||
max_angle: self.static_data.angle.to_radians(),
|
max_angle: self.static_data.angle.to_radians(),
|
||||||
applied: false,
|
applied: false,
|
||||||
hit_count: 0,
|
hit_count: 0,
|
||||||
break_block: update
|
break_block: self
|
||||||
|
.static_data
|
||||||
|
.ability_info
|
||||||
.select_pos
|
.select_pos
|
||||||
.filter(|_| {
|
.map(|p| {
|
||||||
self.static_data.ability_info.tool == Some(ToolKind::Pick)
|
(
|
||||||
|
p.map(|e| e.floor() as i32),
|
||||||
|
self.static_data.ability_info.tool,
|
||||||
|
)
|
||||||
})
|
})
|
||||||
.map(|p| p.map(|e| e.floor() as i32)),
|
.filter(|(_, tool)| tool == &Some(ToolKind::Pick)),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
update.character = CharacterState::DashMelee(Data {
|
update.character = CharacterState::DashMelee(Data {
|
||||||
|
@ -177,10 +177,17 @@ impl CharacterBehavior for Data {
|
|||||||
max_angle: self.static_data.max_angle.to_radians(),
|
max_angle: self.static_data.max_angle.to_radians(),
|
||||||
applied: false,
|
applied: false,
|
||||||
hit_count: 0,
|
hit_count: 0,
|
||||||
break_block: update
|
break_block: self
|
||||||
|
.static_data
|
||||||
|
.ability_info
|
||||||
.select_pos
|
.select_pos
|
||||||
.filter(|_| self.static_data.ability_info.tool == Some(ToolKind::Pick))
|
.map(|p| {
|
||||||
.map(|p| p.map(|e| e.floor() as i32)),
|
(
|
||||||
|
p.map(|e| e.floor() as i32),
|
||||||
|
self.static_data.ability_info.tool,
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.filter(|(_, tool)| tool == &Some(ToolKind::Pick)),
|
||||||
});
|
});
|
||||||
|
|
||||||
update.character = CharacterState::LeapMelee(Data {
|
update.character = CharacterState::LeapMelee(Data {
|
||||||
|
@ -141,10 +141,17 @@ impl CharacterBehavior for Data {
|
|||||||
max_angle: 180_f32.to_radians(),
|
max_angle: 180_f32.to_radians(),
|
||||||
applied: false,
|
applied: false,
|
||||||
hit_count: 0,
|
hit_count: 0,
|
||||||
break_block: update
|
break_block: self
|
||||||
|
.static_data
|
||||||
|
.ability_info
|
||||||
.select_pos
|
.select_pos
|
||||||
.filter(|_| self.static_data.ability_info.tool == Some(ToolKind::Pick))
|
.map(|p| {
|
||||||
.map(|p| p.map(|e| e.floor() as i32)),
|
(
|
||||||
|
p.map(|e| e.floor() as i32),
|
||||||
|
self.static_data.ability_info.tool,
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.filter(|(_, tool)| tool == &Some(ToolKind::Pick)),
|
||||||
});
|
});
|
||||||
} else if self.timer < self.static_data.swing_duration {
|
} else if self.timer < self.static_data.swing_duration {
|
||||||
if matches!(
|
if matches!(
|
||||||
|
@ -69,12 +69,15 @@ impl<'a> System<'a> for Sys {
|
|||||||
let rad = body.radius() * scale;
|
let rad = body.radius() * scale;
|
||||||
|
|
||||||
// Mine blocks broken by the attack
|
// Mine blocks broken by the attack
|
||||||
if let Some(block_pos) = melee_attack.break_block {
|
if let Some((block_pos, tool)) = melee_attack.break_block {
|
||||||
// Check distance to block
|
// Check distance to block
|
||||||
if eye_pos.distance_squared(block_pos.map(|e| e as f32 + 0.5))
|
if eye_pos.distance_squared(block_pos.map(|e| e as f32 + 0.5))
|
||||||
< (rad + scale * melee_attack.range).powi(2)
|
< (rad + scale * melee_attack.range).powi(2)
|
||||||
{
|
{
|
||||||
server_emitter.emit(ServerEvent::MineBlock { pos: block_pos });
|
server_emitter.emit(ServerEvent::MineBlock {
|
||||||
|
pos: block_pos,
|
||||||
|
tool,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,10 @@ use tracing::error;
|
|||||||
use vek::*;
|
use vek::*;
|
||||||
|
|
||||||
use common::{
|
use common::{
|
||||||
comp::{self, agent::AgentEvent, inventory::slot::EquipSlot, item, slot::Slot, Inventory, Pos},
|
comp::{
|
||||||
|
self, agent::AgentEvent, inventory::slot::EquipSlot, item, slot::Slot, tool::ToolKind,
|
||||||
|
Inventory, Pos,
|
||||||
|
},
|
||||||
consts::MAX_MOUNT_RANGE,
|
consts::MAX_MOUNT_RANGE,
|
||||||
uid::Uid,
|
uid::Uid,
|
||||||
vol::ReadVol,
|
vol::ReadVol,
|
||||||
@ -257,11 +260,11 @@ fn within_mounting_range(player_position: Option<&Pos>, mount_position: Option<&
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn handle_mine_block(server: &mut Server, pos: Vec3<i32>) {
|
pub fn handle_mine_block(server: &mut Server, pos: Vec3<i32>, tool: Option<ToolKind>) {
|
||||||
let state = server.state_mut();
|
let state = server.state_mut();
|
||||||
if state.can_set_block(pos) {
|
if state.can_set_block(pos) {
|
||||||
let block = state.terrain().get(pos).ok().copied();
|
let block = state.terrain().get(pos).ok().copied();
|
||||||
if let Some(block) = block {
|
if let Some(block) = block.filter(|b| b.mine_tool().map_or(true, |t| Some(t) == tool)) {
|
||||||
if let Some(item) = comp::Item::try_reclaim_from_block(block) {
|
if let Some(item) = comp::Item::try_reclaim_from_block(block) {
|
||||||
state
|
state
|
||||||
.create_object(Default::default(), comp::object::Body::Pouch)
|
.create_object(Default::default(), comp::object::Body::Pouch)
|
||||||
|
@ -191,7 +191,7 @@ impl Server {
|
|||||||
handle_combo_change(&self, entity, change)
|
handle_combo_change(&self, entity, change)
|
||||||
},
|
},
|
||||||
ServerEvent::RequestSiteInfo { entity, id } => handle_site_info(&self, entity, id),
|
ServerEvent::RequestSiteInfo { entity, id } => handle_site_info(&self, entity, id),
|
||||||
ServerEvent::MineBlock { pos } => handle_mine_block(self, pos),
|
ServerEvent::MineBlock { pos, tool } => handle_mine_block(self, pos, tool),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
// every frame.
|
// every frame.
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Fly));
|
.push(ControlAction::basic_input(InputKind::Fly));
|
||||||
}
|
}
|
||||||
|
|
||||||
let flees = alignment
|
let flees = alignment
|
||||||
@ -631,7 +631,7 @@ impl<'a> AgentData<'a> {
|
|||||||
{
|
{
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Fly));
|
.push(ControlAction::basic_input(InputKind::Fly));
|
||||||
} else {
|
} else {
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
@ -1136,7 +1136,7 @@ impl<'a> AgentData<'a> {
|
|||||||
if condition {
|
if condition {
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Jump));
|
.push(ControlAction::basic_input(InputKind::Jump));
|
||||||
} else {
|
} else {
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
@ -1258,7 +1258,7 @@ impl<'a> AgentData<'a> {
|
|||||||
if dist_sqrd < (min_attack_dist * self.scale).powi(2) {
|
if dist_sqrd < (min_attack_dist * self.scale).powi(2) {
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Primary));
|
.push(ControlAction::basic_input(InputKind::Primary));
|
||||||
controller.inputs.move_dir = Vec2::zero();
|
controller.inputs.move_dir = Vec2::zero();
|
||||||
} else if dist_sqrd < MAX_CHASE_DIST.powi(2) {
|
} else if dist_sqrd < MAX_CHASE_DIST.powi(2) {
|
||||||
if let Some((bearing, speed)) = agent.chaser.chase(
|
if let Some((bearing, speed)) = agent.chaser.chase(
|
||||||
@ -1283,7 +1283,7 @@ impl<'a> AgentData<'a> {
|
|||||||
{
|
{
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Roll));
|
.push(ControlAction::basic_input(InputKind::Roll));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
agent.target = None;
|
agent.target = None;
|
||||||
@ -1300,7 +1300,7 @@ impl<'a> AgentData<'a> {
|
|||||||
} else if agent.action_timer > 4.0 && self.energy.current() > 10 {
|
} else if agent.action_timer > 4.0 && self.energy.current() > 10 {
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Secondary));
|
.push(ControlAction::basic_input(InputKind::Secondary));
|
||||||
agent.action_timer += dt.0;
|
agent.action_timer += dt.0;
|
||||||
} else if self
|
} else if self
|
||||||
.stats
|
.stats
|
||||||
@ -1311,12 +1311,12 @@ impl<'a> AgentData<'a> {
|
|||||||
{
|
{
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Ability(0)));
|
.push(ControlAction::basic_input(InputKind::Ability(0)));
|
||||||
agent.action_timer += dt.0;
|
agent.action_timer += dt.0;
|
||||||
} else {
|
} else {
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Primary));
|
.push(ControlAction::basic_input(InputKind::Primary));
|
||||||
agent.action_timer += dt.0;
|
agent.action_timer += dt.0;
|
||||||
}
|
}
|
||||||
} else if dist_sqrd < MAX_CHASE_DIST.powi(2) {
|
} else if dist_sqrd < MAX_CHASE_DIST.powi(2) {
|
||||||
@ -1341,7 +1341,7 @@ impl<'a> AgentData<'a> {
|
|||||||
{
|
{
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Roll));
|
.push(ControlAction::basic_input(InputKind::Roll));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
agent.target = None;
|
agent.target = None;
|
||||||
@ -1358,7 +1358,7 @@ impl<'a> AgentData<'a> {
|
|||||||
} else if agent.action_timer > 2.0 {
|
} else if agent.action_timer > 2.0 {
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Secondary));
|
.push(ControlAction::basic_input(InputKind::Secondary));
|
||||||
agent.action_timer += dt.0;
|
agent.action_timer += dt.0;
|
||||||
} else if self
|
} else if self
|
||||||
.stats
|
.stats
|
||||||
@ -1369,12 +1369,12 @@ impl<'a> AgentData<'a> {
|
|||||||
{
|
{
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Ability(0)));
|
.push(ControlAction::basic_input(InputKind::Ability(0)));
|
||||||
agent.action_timer += dt.0;
|
agent.action_timer += dt.0;
|
||||||
} else {
|
} else {
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Primary));
|
.push(ControlAction::basic_input(InputKind::Primary));
|
||||||
agent.action_timer += dt.0;
|
agent.action_timer += dt.0;
|
||||||
}
|
}
|
||||||
} else if dist_sqrd < MAX_CHASE_DIST.powi(2) {
|
} else if dist_sqrd < MAX_CHASE_DIST.powi(2) {
|
||||||
@ -1399,7 +1399,7 @@ impl<'a> AgentData<'a> {
|
|||||||
{
|
{
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Ability(0)));
|
.push(ControlAction::basic_input(InputKind::Ability(0)));
|
||||||
agent.action_timer = 0.0;
|
agent.action_timer = 0.0;
|
||||||
} else {
|
} else {
|
||||||
agent.action_timer += dt.0;
|
agent.action_timer += dt.0;
|
||||||
@ -1417,7 +1417,7 @@ impl<'a> AgentData<'a> {
|
|||||||
{
|
{
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Roll));
|
.push(ControlAction::basic_input(InputKind::Roll));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
agent.target = None;
|
agent.target = None;
|
||||||
@ -1435,14 +1435,14 @@ impl<'a> AgentData<'a> {
|
|||||||
{
|
{
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Ability(0)));
|
.push(ControlAction::basic_input(InputKind::Ability(0)));
|
||||||
agent.action_timer += dt.0;
|
agent.action_timer += dt.0;
|
||||||
} else if agent.action_timer > 2.0 {
|
} else if agent.action_timer > 2.0 {
|
||||||
agent.action_timer = 0.0;
|
agent.action_timer = 0.0;
|
||||||
} else {
|
} else {
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Primary));
|
.push(ControlAction::basic_input(InputKind::Primary));
|
||||||
agent.action_timer += dt.0;
|
agent.action_timer += dt.0;
|
||||||
}
|
}
|
||||||
} else if dist_sqrd < MAX_CHASE_DIST.powi(2) {
|
} else if dist_sqrd < MAX_CHASE_DIST.powi(2) {
|
||||||
@ -1462,7 +1462,7 @@ impl<'a> AgentData<'a> {
|
|||||||
if agent.action_timer > 4.0 {
|
if agent.action_timer > 4.0 {
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Secondary));
|
.push(ControlAction::basic_input(InputKind::Secondary));
|
||||||
agent.action_timer = 0.0;
|
agent.action_timer = 0.0;
|
||||||
} else {
|
} else {
|
||||||
agent.action_timer += dt.0;
|
agent.action_timer += dt.0;
|
||||||
@ -1480,7 +1480,7 @@ impl<'a> AgentData<'a> {
|
|||||||
{
|
{
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Roll));
|
.push(ControlAction::basic_input(InputKind::Roll));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
agent.target = None;
|
agent.target = None;
|
||||||
@ -1492,7 +1492,7 @@ impl<'a> AgentData<'a> {
|
|||||||
{
|
{
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Roll));
|
.push(ControlAction::basic_input(InputKind::Roll));
|
||||||
} else if dist_sqrd < MAX_CHASE_DIST.powi(2) {
|
} else if dist_sqrd < MAX_CHASE_DIST.powi(2) {
|
||||||
if let Some((bearing, speed)) = agent.chaser.chase(
|
if let Some((bearing, speed)) = agent.chaser.chase(
|
||||||
&*terrain,
|
&*terrain,
|
||||||
@ -1519,7 +1519,7 @@ impl<'a> AgentData<'a> {
|
|||||||
} else if agent.action_timer > 2.0 && self.energy.current() > 300 {
|
} else if agent.action_timer > 2.0 && self.energy.current() > 300 {
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Secondary));
|
.push(ControlAction::basic_input(InputKind::Secondary));
|
||||||
agent.action_timer += dt.0;
|
agent.action_timer += dt.0;
|
||||||
} else if self
|
} else if self
|
||||||
.stats
|
.stats
|
||||||
@ -1533,7 +1533,7 @@ impl<'a> AgentData<'a> {
|
|||||||
.push(ControlAction::CancelInput(InputKind::Secondary));
|
.push(ControlAction::CancelInput(InputKind::Secondary));
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Ability(0)));
|
.push(ControlAction::basic_input(InputKind::Ability(0)));
|
||||||
agent.action_timer += dt.0;
|
agent.action_timer += dt.0;
|
||||||
} else {
|
} else {
|
||||||
controller
|
controller
|
||||||
@ -1541,7 +1541,7 @@ impl<'a> AgentData<'a> {
|
|||||||
.push(ControlAction::CancelInput(InputKind::Secondary));
|
.push(ControlAction::CancelInput(InputKind::Secondary));
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Primary));
|
.push(ControlAction::basic_input(InputKind::Primary));
|
||||||
agent.action_timer += dt.0;
|
agent.action_timer += dt.0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1557,7 +1557,7 @@ impl<'a> AgentData<'a> {
|
|||||||
{
|
{
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Roll));
|
.push(ControlAction::basic_input(InputKind::Roll));
|
||||||
}
|
}
|
||||||
} else if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) {
|
} else if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) {
|
||||||
if let Some((bearing, speed)) = agent.chaser.chase(
|
if let Some((bearing, speed)) = agent.chaser.chase(
|
||||||
@ -1585,7 +1585,7 @@ impl<'a> AgentData<'a> {
|
|||||||
{
|
{
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Roll));
|
.push(ControlAction::basic_input(InputKind::Roll));
|
||||||
} else if dist_sqrd < (5.0 * min_attack_dist * self.scale).powi(2) {
|
} else if dist_sqrd < (5.0 * min_attack_dist * self.scale).powi(2) {
|
||||||
if agent.action_timer < 1.5 {
|
if agent.action_timer < 1.5 {
|
||||||
controller.inputs.move_dir = (tgt_pos.0 - self.pos.0)
|
controller.inputs.move_dir = (tgt_pos.0 - self.pos.0)
|
||||||
@ -1613,15 +1613,15 @@ impl<'a> AgentData<'a> {
|
|||||||
{
|
{
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Ability(0)));
|
.push(ControlAction::basic_input(InputKind::Ability(0)));
|
||||||
} else if self.energy.current() > 10 {
|
} else if self.energy.current() > 10 {
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Secondary));
|
.push(ControlAction::basic_input(InputKind::Secondary));
|
||||||
} else {
|
} else {
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Primary));
|
.push(ControlAction::basic_input(InputKind::Primary));
|
||||||
}
|
}
|
||||||
} else if dist_sqrd < MAX_CHASE_DIST.powi(2) {
|
} else if dist_sqrd < MAX_CHASE_DIST.powi(2) {
|
||||||
if let Some((bearing, speed)) = agent.chaser.chase(
|
if let Some((bearing, speed)) = agent.chaser.chase(
|
||||||
@ -1643,7 +1643,7 @@ impl<'a> AgentData<'a> {
|
|||||||
* speed;
|
* speed;
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Primary));
|
.push(ControlAction::basic_input(InputKind::Primary));
|
||||||
} else {
|
} else {
|
||||||
controller.inputs.move_dir =
|
controller.inputs.move_dir =
|
||||||
bearing.xy().try_normalized().unwrap_or_else(Vec2::zero) * speed;
|
bearing.xy().try_normalized().unwrap_or_else(Vec2::zero) * speed;
|
||||||
@ -1657,7 +1657,7 @@ impl<'a> AgentData<'a> {
|
|||||||
{
|
{
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Roll));
|
.push(ControlAction::basic_input(InputKind::Roll));
|
||||||
}
|
}
|
||||||
} else if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) {
|
} else if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) {
|
||||||
if let Some((bearing, speed)) = agent.chaser.chase(
|
if let Some((bearing, speed)) = agent.chaser.chase(
|
||||||
@ -1686,13 +1686,13 @@ impl<'a> AgentData<'a> {
|
|||||||
controller.inputs.move_dir = Vec2::zero();
|
controller.inputs.move_dir = Vec2::zero();
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Primary));
|
.push(ControlAction::basic_input(InputKind::Primary));
|
||||||
//controller.inputs.primary.set_state(true);
|
//controller.inputs.primary.set_state(true);
|
||||||
} else if dist_sqrd < MAX_CHASE_DIST.powi(2) {
|
} else if dist_sqrd < MAX_CHASE_DIST.powi(2) {
|
||||||
if self.vel.0.is_approx_zero() {
|
if self.vel.0.is_approx_zero() {
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Ability(0)));
|
.push(ControlAction::basic_input(InputKind::Ability(0)));
|
||||||
}
|
}
|
||||||
if let Some((bearing, speed)) = agent.chaser.chase(
|
if let Some((bearing, speed)) = agent.chaser.chase(
|
||||||
&*terrain,
|
&*terrain,
|
||||||
@ -1710,7 +1710,7 @@ impl<'a> AgentData<'a> {
|
|||||||
if agent.action_timer > 5.0 {
|
if agent.action_timer > 5.0 {
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Secondary));
|
.push(ControlAction::basic_input(InputKind::Secondary));
|
||||||
agent.action_timer = 0.0;
|
agent.action_timer = 0.0;
|
||||||
} else {
|
} else {
|
||||||
agent.action_timer += dt.0;
|
agent.action_timer += dt.0;
|
||||||
@ -1735,7 +1735,7 @@ impl<'a> AgentData<'a> {
|
|||||||
controller.inputs.move_dir = Vec2::zero();
|
controller.inputs.move_dir = Vec2::zero();
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Primary));
|
.push(ControlAction::basic_input(InputKind::Primary));
|
||||||
} else if dist_sqrd < (radius as f32 * min_attack_dist * self.scale).powi(2) {
|
} else if dist_sqrd < (radius as f32 * min_attack_dist * self.scale).powi(2) {
|
||||||
controller.inputs.move_dir = (self.pos.0 - tgt_pos.0)
|
controller.inputs.move_dir = (self.pos.0 - tgt_pos.0)
|
||||||
.xy()
|
.xy()
|
||||||
@ -1754,7 +1754,7 @@ impl<'a> AgentData<'a> {
|
|||||||
} else if agent.action_timer < circle_time as f32 + 0.5 {
|
} else if agent.action_timer < circle_time as f32 + 0.5 {
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Secondary));
|
.push(ControlAction::basic_input(InputKind::Secondary));
|
||||||
agent.action_timer += dt.0;
|
agent.action_timer += dt.0;
|
||||||
} else if agent.action_timer < 2.0 * circle_time as f32 + 0.5 {
|
} else if agent.action_timer < 2.0 * circle_time as f32 + 0.5 {
|
||||||
controller.inputs.move_dir = (tgt_pos.0 - self.pos.0)
|
controller.inputs.move_dir = (tgt_pos.0 - self.pos.0)
|
||||||
@ -1766,7 +1766,7 @@ impl<'a> AgentData<'a> {
|
|||||||
} else if agent.action_timer < 2.0 * circle_time as f32 + 1.0 {
|
} else if agent.action_timer < 2.0 * circle_time as f32 + 1.0 {
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Secondary));
|
.push(ControlAction::basic_input(InputKind::Secondary));
|
||||||
agent.action_timer += dt.0;
|
agent.action_timer += dt.0;
|
||||||
} else {
|
} else {
|
||||||
agent.action_timer = 0.0;
|
agent.action_timer = 0.0;
|
||||||
@ -1799,7 +1799,7 @@ impl<'a> AgentData<'a> {
|
|||||||
.unwrap_or_else(Vec2::unit_y);
|
.unwrap_or_else(Vec2::unit_y);
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Primary));
|
.push(ControlAction::basic_input(InputKind::Primary));
|
||||||
} else if dist_sqrd < MAX_CHASE_DIST.powi(2) {
|
} else if dist_sqrd < MAX_CHASE_DIST.powi(2) {
|
||||||
if let Some((bearing, speed)) = agent.chaser.chase(
|
if let Some((bearing, speed)) = agent.chaser.chase(
|
||||||
&*terrain,
|
&*terrain,
|
||||||
@ -1833,7 +1833,7 @@ impl<'a> AgentData<'a> {
|
|||||||
}
|
}
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Secondary));
|
.push(ControlAction::basic_input(InputKind::Secondary));
|
||||||
self.jump_if(controller, bearing.z > 1.5);
|
self.jump_if(controller, bearing.z > 1.5);
|
||||||
controller.inputs.move_z = bearing.z;
|
controller.inputs.move_z = bearing.z;
|
||||||
} else {
|
} else {
|
||||||
@ -1859,12 +1859,12 @@ impl<'a> AgentData<'a> {
|
|||||||
} else if agent.action_timer > 1.0 {
|
} else if agent.action_timer > 1.0 {
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Primary));
|
.push(ControlAction::basic_input(InputKind::Primary));
|
||||||
agent.action_timer += dt.0;
|
agent.action_timer += dt.0;
|
||||||
} else {
|
} else {
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Secondary));
|
.push(ControlAction::basic_input(InputKind::Secondary));
|
||||||
agent.action_timer += dt.0;
|
agent.action_timer += dt.0;
|
||||||
}
|
}
|
||||||
controller.inputs.move_dir = (tgt_pos.0 - self.pos.0)
|
controller.inputs.move_dir = (tgt_pos.0 - self.pos.0)
|
||||||
@ -1897,13 +1897,13 @@ impl<'a> AgentData<'a> {
|
|||||||
controller.inputs.move_dir = Vec2::zero();
|
controller.inputs.move_dir = Vec2::zero();
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Secondary));
|
.push(ControlAction::basic_input(InputKind::Secondary));
|
||||||
} else if dist_sqrd < (3.0 * min_attack_dist * self.scale).powi(2)
|
} else if dist_sqrd < (3.0 * min_attack_dist * self.scale).powi(2)
|
||||||
&& dist_sqrd > (2.0 * min_attack_dist * self.scale).powi(2)
|
&& dist_sqrd > (2.0 * min_attack_dist * self.scale).powi(2)
|
||||||
{
|
{
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Primary));
|
.push(ControlAction::basic_input(InputKind::Primary));
|
||||||
controller.inputs.move_dir = (tgt_pos.0 - self.pos.0)
|
controller.inputs.move_dir = (tgt_pos.0 - self.pos.0)
|
||||||
.xy()
|
.xy()
|
||||||
.rotated_z(-0.47 * PI)
|
.rotated_z(-0.47 * PI)
|
||||||
@ -1937,12 +1937,12 @@ impl<'a> AgentData<'a> {
|
|||||||
} else if agent.action_timer > 2.0 {
|
} else if agent.action_timer > 2.0 {
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Secondary));
|
.push(ControlAction::basic_input(InputKind::Secondary));
|
||||||
agent.action_timer += dt.0;
|
agent.action_timer += dt.0;
|
||||||
} else {
|
} else {
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Primary));
|
.push(ControlAction::basic_input(InputKind::Primary));
|
||||||
agent.action_timer += dt.0;
|
agent.action_timer += dt.0;
|
||||||
}
|
}
|
||||||
} else if dist_sqrd < MAX_CHASE_DIST.powi(2) {
|
} else if dist_sqrd < MAX_CHASE_DIST.powi(2) {
|
||||||
@ -1970,11 +1970,11 @@ impl<'a> AgentData<'a> {
|
|||||||
controller.inputs.move_dir = Vec2::zero();
|
controller.inputs.move_dir = Vec2::zero();
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Secondary));
|
.push(ControlAction::basic_input(InputKind::Secondary));
|
||||||
} else if dist_sqrd < (5.0 * min_attack_dist * self.scale).powi(2) {
|
} else if dist_sqrd < (5.0 * min_attack_dist * self.scale).powi(2) {
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Ability(0)));
|
.push(ControlAction::basic_input(InputKind::Ability(0)));
|
||||||
} else if dist_sqrd < MAX_CHASE_DIST.powi(2) {
|
} else if dist_sqrd < MAX_CHASE_DIST.powi(2) {
|
||||||
if let Some((bearing, speed)) = agent.chaser.chase(
|
if let Some((bearing, speed)) = agent.chaser.chase(
|
||||||
&*terrain,
|
&*terrain,
|
||||||
@ -1989,7 +1989,7 @@ impl<'a> AgentData<'a> {
|
|||||||
if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) {
|
if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) {
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Primary));
|
.push(ControlAction::basic_input(InputKind::Primary));
|
||||||
controller.inputs.move_dir =
|
controller.inputs.move_dir =
|
||||||
bearing.xy().try_normalized().unwrap_or_else(Vec2::zero) * speed;
|
bearing.xy().try_normalized().unwrap_or_else(Vec2::zero) * speed;
|
||||||
} else {
|
} else {
|
||||||
@ -2009,12 +2009,12 @@ impl<'a> AgentData<'a> {
|
|||||||
if agent.action_timer < 2.0 {
|
if agent.action_timer < 2.0 {
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Secondary));
|
.push(ControlAction::basic_input(InputKind::Secondary));
|
||||||
agent.action_timer += dt.0;
|
agent.action_timer += dt.0;
|
||||||
} else if agent.action_timer < 3.0 {
|
} else if agent.action_timer < 3.0 {
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Primary));
|
.push(ControlAction::basic_input(InputKind::Primary));
|
||||||
agent.action_timer += dt.0;
|
agent.action_timer += dt.0;
|
||||||
} else {
|
} else {
|
||||||
agent.action_timer = 0.0;
|
agent.action_timer = 0.0;
|
||||||
@ -2044,7 +2044,7 @@ impl<'a> AgentData<'a> {
|
|||||||
controller.inputs.move_dir = Vec2::zero();
|
controller.inputs.move_dir = Vec2::zero();
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Secondary));
|
.push(ControlAction::basic_input(InputKind::Secondary));
|
||||||
} else if dist_sqrd < (7.0 * min_attack_dist * self.scale).powi(2) {
|
} else if dist_sqrd < (7.0 * min_attack_dist * self.scale).powi(2) {
|
||||||
if agent.action_timer < 2.0 {
|
if agent.action_timer < 2.0 {
|
||||||
controller.inputs.move_dir = (tgt_pos.0 - self.pos.0)
|
controller.inputs.move_dir = (tgt_pos.0 - self.pos.0)
|
||||||
@ -2054,7 +2054,7 @@ impl<'a> AgentData<'a> {
|
|||||||
.unwrap_or_else(Vec2::unit_y);
|
.unwrap_or_else(Vec2::unit_y);
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Primary));
|
.push(ControlAction::basic_input(InputKind::Primary));
|
||||||
agent.action_timer += dt.0;
|
agent.action_timer += dt.0;
|
||||||
} else if agent.action_timer < 4.0 {
|
} else if agent.action_timer < 4.0 {
|
||||||
controller.inputs.move_dir = (tgt_pos.0 - self.pos.0)
|
controller.inputs.move_dir = (tgt_pos.0 - self.pos.0)
|
||||||
@ -2064,12 +2064,12 @@ impl<'a> AgentData<'a> {
|
|||||||
.unwrap_or_else(Vec2::unit_y);
|
.unwrap_or_else(Vec2::unit_y);
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Primary));
|
.push(ControlAction::basic_input(InputKind::Primary));
|
||||||
agent.action_timer += dt.0;
|
agent.action_timer += dt.0;
|
||||||
} else if agent.action_timer < 6.0 {
|
} else if agent.action_timer < 6.0 {
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Ability(0)));
|
.push(ControlAction::basic_input(InputKind::Ability(0)));
|
||||||
agent.action_timer += dt.0;
|
agent.action_timer += dt.0;
|
||||||
} else {
|
} else {
|
||||||
agent.action_timer = 0.0;
|
agent.action_timer = 0.0;
|
||||||
@ -2099,7 +2099,7 @@ impl<'a> AgentData<'a> {
|
|||||||
controller.inputs.move_dir = Vec2::zero();
|
controller.inputs.move_dir = Vec2::zero();
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Primary));
|
.push(ControlAction::basic_input(InputKind::Primary));
|
||||||
} else if dist_sqrd < MAX_CHASE_DIST.powi(2) {
|
} else if dist_sqrd < MAX_CHASE_DIST.powi(2) {
|
||||||
if let Some((bearing, speed)) = agent.chaser.chase(
|
if let Some((bearing, speed)) = agent.chaser.chase(
|
||||||
&*terrain,
|
&*terrain,
|
||||||
@ -2124,7 +2124,7 @@ impl<'a> AgentData<'a> {
|
|||||||
if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) {
|
if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) {
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Primary));
|
.push(ControlAction::basic_input(InputKind::Primary));
|
||||||
} else {
|
} else {
|
||||||
agent.target = None;
|
agent.target = None;
|
||||||
}
|
}
|
||||||
@ -2134,7 +2134,7 @@ impl<'a> AgentData<'a> {
|
|||||||
if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) {
|
if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) {
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Primary));
|
.push(ControlAction::basic_input(InputKind::Primary));
|
||||||
} else {
|
} else {
|
||||||
agent.target = None;
|
agent.target = None;
|
||||||
}
|
}
|
||||||
@ -2150,7 +2150,7 @@ impl<'a> AgentData<'a> {
|
|||||||
if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) {
|
if can_see_tgt(&*terrain, self.pos, tgt_pos, dist_sqrd) {
|
||||||
controller
|
controller
|
||||||
.actions
|
.actions
|
||||||
.push(ControlAction::basic_start(InputKind::Primary));
|
.push(ControlAction::basic_input(InputKind::Primary));
|
||||||
} else {
|
} else {
|
||||||
agent.target = None;
|
agent.target = None;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user