mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Point to newly released vek, add todo to reconsider empty item, remove uneeded ori slerp, remove agent from character behavior, add todos to combat sys, check if entities still exist before possessing & if possessed entity has a loadout move the active item into the second item space
This commit is contained in:
parent
f515cc70be
commit
a73d010f7b
3
Cargo.lock
generated
3
Cargo.lock
generated
@ -4866,7 +4866,8 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "vek"
|
name = "vek"
|
||||||
version = "0.10.0"
|
version = "0.10.0"
|
||||||
source = "git+https://github.com/Imberflur/vek?branch=is_normalized#43bef0a9e953fbf6b00a073aef914c48b784c995"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4c98f7e1c1400d5b1704baee82cbc56a3fde406769555ead0f2306e43ebab967"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"approx 0.3.2",
|
"approx 0.3.2",
|
||||||
"num-integer",
|
"num-integer",
|
||||||
|
@ -68,6 +68,3 @@ debug = false
|
|||||||
[profile.releasedebuginfo]
|
[profile.releasedebuginfo]
|
||||||
inherits = 'release'
|
inherits = 'release'
|
||||||
debug = 1
|
debug = 1
|
||||||
|
|
||||||
[patch.crates-io]
|
|
||||||
vek = {git = "https://github.com/Imberflur/vek", branch = "is_normalized"}
|
|
||||||
|
@ -80,6 +80,8 @@ impl Asset for Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Item {
|
impl Item {
|
||||||
|
// TODO: consider alternatives such as default abilities that can be added to a
|
||||||
|
// loadout when no weapon is present
|
||||||
pub fn empty() -> Self {
|
pub fn empty() -> Self {
|
||||||
Self {
|
Self {
|
||||||
name: "Empty Item".to_owned(),
|
name: "Empty Item".to_owned(),
|
||||||
|
@ -2,7 +2,6 @@ use crate::{
|
|||||||
comp::{Attacking, CharacterState, EnergySource, StateUpdate},
|
comp::{Attacking, CharacterState, EnergySource, StateUpdate},
|
||||||
states::utils::*,
|
states::utils::*,
|
||||||
sys::character_behavior::*,
|
sys::character_behavior::*,
|
||||||
util::Dir,
|
|
||||||
};
|
};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use vek::Vec3;
|
use vek::Vec3;
|
||||||
@ -98,8 +97,6 @@ impl CharacterBehavior for Data {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
update.ori.0 = Dir::slerp_to_vec3(update.ori.0, update.vel.0, 9.0 * data.dt.0);
|
|
||||||
|
|
||||||
update
|
update
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,6 @@ use vek::vec::Vec2;
|
|||||||
pub const MOVEMENT_THRESHOLD_VEL: f32 = 3.0;
|
pub const MOVEMENT_THRESHOLD_VEL: f32 = 3.0;
|
||||||
const BASE_HUMANOID_ACCEL: f32 = 100.0;
|
const BASE_HUMANOID_ACCEL: f32 = 100.0;
|
||||||
const BASE_HUMANOID_SPEED: f32 = 170.0;
|
const BASE_HUMANOID_SPEED: f32 = 170.0;
|
||||||
const NPC_HUMANOID_SPEED: f32 = 170.0;
|
|
||||||
const BASE_HUMANOID_AIR_ACCEL: f32 = 15.0;
|
const BASE_HUMANOID_AIR_ACCEL: f32 = 15.0;
|
||||||
const BASE_HUMANOID_AIR_SPEED: f32 = 8.0;
|
const BASE_HUMANOID_AIR_SPEED: f32 = 8.0;
|
||||||
const BASE_HUMANOID_WATER_ACCEL: f32 = 70.0;
|
const BASE_HUMANOID_WATER_ACCEL: f32 = 70.0;
|
||||||
@ -43,14 +42,7 @@ pub fn handle_move(data: &JoinData, update: &mut StateUpdate, efficiency: f32) {
|
|||||||
/// Updates components to move player as if theyre on ground or in air
|
/// Updates components to move player as if theyre on ground or in air
|
||||||
fn basic_move(data: &JoinData, update: &mut StateUpdate, efficiency: f32) {
|
fn basic_move(data: &JoinData, update: &mut StateUpdate, efficiency: f32) {
|
||||||
let (accel, speed): (f32, f32) = if data.physics.on_ground {
|
let (accel, speed): (f32, f32) = if data.physics.on_ground {
|
||||||
(
|
(BASE_HUMANOID_ACCEL, BASE_HUMANOID_SPEED)
|
||||||
BASE_HUMANOID_ACCEL,
|
|
||||||
if data.agent.is_some() {
|
|
||||||
NPC_HUMANOID_SPEED
|
|
||||||
} else {
|
|
||||||
BASE_HUMANOID_SPEED
|
|
||||||
},
|
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
(BASE_HUMANOID_AIR_ACCEL, BASE_HUMANOID_AIR_SPEED)
|
(BASE_HUMANOID_AIR_ACCEL, BASE_HUMANOID_AIR_SPEED)
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
comp::{
|
comp::{
|
||||||
Agent, Attacking, Body, CharacterState, ControlAction, Controller, ControllerInputs,
|
Attacking, Body, CharacterState, ControlAction, Controller, ControllerInputs, Energy,
|
||||||
Energy, Loadout, Mounting, Ori, PhysicsState, Pos, StateUpdate, Stats, Vel,
|
Loadout, Mounting, Ori, PhysicsState, Pos, StateUpdate, Stats, Vel,
|
||||||
},
|
},
|
||||||
event::{EventBus, LocalEvent, ServerEvent},
|
event::{EventBus, LocalEvent, ServerEvent},
|
||||||
state::DeltaTime,
|
state::DeltaTime,
|
||||||
@ -50,7 +50,6 @@ pub struct JoinData<'a> {
|
|||||||
pub body: &'a Body,
|
pub body: &'a Body,
|
||||||
pub physics: &'a PhysicsState,
|
pub physics: &'a PhysicsState,
|
||||||
pub attacking: Option<&'a Attacking>,
|
pub attacking: Option<&'a Attacking>,
|
||||||
pub agent: Option<&'a Agent>,
|
|
||||||
pub updater: &'a LazyUpdate,
|
pub updater: &'a LazyUpdate,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +67,6 @@ pub type JoinTuple<'a> = (
|
|||||||
&'a Body,
|
&'a Body,
|
||||||
&'a PhysicsState,
|
&'a PhysicsState,
|
||||||
Option<&'a Attacking>,
|
Option<&'a Attacking>,
|
||||||
Option<&'a Agent>,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
fn incorporate_update(tuple: &mut JoinTuple, state_update: StateUpdate) {
|
fn incorporate_update(tuple: &mut JoinTuple, state_update: StateUpdate) {
|
||||||
@ -97,7 +95,6 @@ impl<'a> JoinData<'a> {
|
|||||||
body: j.10,
|
body: j.10,
|
||||||
physics: j.11,
|
physics: j.11,
|
||||||
attacking: j.12,
|
attacking: j.12,
|
||||||
agent: j.13,
|
|
||||||
updater,
|
updater,
|
||||||
dt,
|
dt,
|
||||||
}
|
}
|
||||||
@ -128,7 +125,6 @@ impl<'a> System<'a> for Sys {
|
|||||||
ReadStorage<'a, Body>,
|
ReadStorage<'a, Body>,
|
||||||
ReadStorage<'a, PhysicsState>,
|
ReadStorage<'a, PhysicsState>,
|
||||||
ReadStorage<'a, Attacking>,
|
ReadStorage<'a, Attacking>,
|
||||||
ReadStorage<'a, Agent>,
|
|
||||||
ReadStorage<'a, Uid>,
|
ReadStorage<'a, Uid>,
|
||||||
ReadStorage<'a, Mounting>,
|
ReadStorage<'a, Mounting>,
|
||||||
);
|
);
|
||||||
@ -153,7 +149,6 @@ impl<'a> System<'a> for Sys {
|
|||||||
bodies,
|
bodies,
|
||||||
physics_states,
|
physics_states,
|
||||||
attacking_storage,
|
attacking_storage,
|
||||||
agent_storage,
|
|
||||||
uids,
|
uids,
|
||||||
mountings,
|
mountings,
|
||||||
): Self::SystemData,
|
): Self::SystemData,
|
||||||
@ -175,7 +170,6 @@ impl<'a> System<'a> for Sys {
|
|||||||
&bodies,
|
&bodies,
|
||||||
&physics_states,
|
&physics_states,
|
||||||
attacking_storage.maybe(),
|
attacking_storage.maybe(),
|
||||||
agent_storage.maybe(),
|
|
||||||
)
|
)
|
||||||
.join();
|
.join();
|
||||||
|
|
||||||
|
@ -110,11 +110,14 @@ impl<'a> System<'a> for Sys {
|
|||||||
// Weapon gives base damage
|
// Weapon gives base damage
|
||||||
let mut healthchange = attack.base_healthchange as f32;
|
let mut healthchange = attack.base_healthchange as f32;
|
||||||
|
|
||||||
//// NPCs do less damage:
|
// TODO: remove this, either it will remain unused or be used as a temporary
|
||||||
|
// gameplay balance
|
||||||
|
//// NPCs do less damage
|
||||||
//if agent_maybe.is_some() {
|
//if agent_maybe.is_some() {
|
||||||
// healthchange = (healthchange / 1.5).min(-1.0);
|
// healthchange = (healthchange / 1.5).min(-1.0);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
// TODO: remove this when there is a better way to target healing
|
||||||
// Don't heal npc's hp
|
// Don't heal npc's hp
|
||||||
if agent_b_maybe.is_some() && healthchange > 0.0 {
|
if agent_b_maybe.is_some() && healthchange > 0.0 {
|
||||||
healthchange = 0.0;
|
healthchange = 0.0;
|
||||||
|
@ -67,6 +67,16 @@ pub fn handle_possess(server: &Server, possessor_uid: Uid, possesse_uid: Uid) {
|
|||||||
ecs.entity_from_uid(possessor_uid.into()),
|
ecs.entity_from_uid(possessor_uid.into()),
|
||||||
ecs.entity_from_uid(possesse_uid.into()),
|
ecs.entity_from_uid(possesse_uid.into()),
|
||||||
) {
|
) {
|
||||||
|
// Check that entities still exist
|
||||||
|
if !(possessor.gen().is_alive() && ecs.is_alive(possessor))
|
||||||
|
|| !(possesse.gen().is_alive() && ecs.is_alive(possesse))
|
||||||
|
{
|
||||||
|
error!(
|
||||||
|
"Error possessing! either the possessor entity or possesse entity no longer exists"
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// You can't possess other players
|
// You can't possess other players
|
||||||
let mut clients = ecs.write_storage::<Client>();
|
let mut clients = ecs.write_storage::<Client>();
|
||||||
if clients.get_mut(possesse).is_none() {
|
if clients.get_mut(possesse).is_none() {
|
||||||
@ -89,14 +99,16 @@ pub fn handle_possess(server: &Server, possessor_uid: Uid, possesse_uid: Uid) {
|
|||||||
if let item::ItemKind::Tool(tool) = item.kind {
|
if let item::ItemKind::Tool(tool) = item.kind {
|
||||||
let mut abilities = tool.get_abilities();
|
let mut abilities = tool.get_abilities();
|
||||||
let mut ability_drain = abilities.drain(..);
|
let mut ability_drain = abilities.drain(..);
|
||||||
loadout.active_item = Some(comp::ItemConfig {
|
let debug_item = comp::ItemConfig {
|
||||||
item,
|
item,
|
||||||
ability1: ability_drain.next(),
|
ability1: ability_drain.next(),
|
||||||
ability2: ability_drain.next(),
|
ability2: ability_drain.next(),
|
||||||
ability3: ability_drain.next(),
|
ability3: ability_drain.next(),
|
||||||
block_ability: None,
|
block_ability: None,
|
||||||
dodge_ability: None,
|
dodge_ability: None,
|
||||||
});
|
};
|
||||||
|
std::mem::swap(&mut loadout.active_item, &mut loadout.second_item);
|
||||||
|
loadout.active_item = Some(debug_item);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move player component
|
// Move player component
|
||||||
|
Loading…
Reference in New Issue
Block a user