mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'imbris/ecs-storage-switch' into 'master'
Convert away from IdvStorage to mixture of VecStorage and DenseVecStorage Closes #1559 See merge request veloren/veloren!3515
This commit is contained in:
commit
5258668166
12
Cargo.lock
generated
12
Cargo.lock
generated
@ -5643,14 +5643,6 @@ dependencies = [
|
||||
"syn 1.0.98",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "specs-idvs"
|
||||
version = "0.1.1"
|
||||
source = "git+https://gitlab.com/veloren/specs-idvs.git?rev=c17abc638f23ef221ce7384c7dd77eef757b82f4#c17abc638f23ef221ce7384c7dd77eef757b82f4"
|
||||
dependencies = [
|
||||
"specs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spin"
|
||||
version = "0.5.2"
|
||||
@ -6517,7 +6509,6 @@ dependencies = [
|
||||
"slab",
|
||||
"slotmap 1.0.6",
|
||||
"specs",
|
||||
"specs-idvs",
|
||||
"spin_sleep",
|
||||
"structopt",
|
||||
"strum",
|
||||
@ -6587,7 +6578,6 @@ dependencies = [
|
||||
"num-traits",
|
||||
"serde",
|
||||
"specs",
|
||||
"specs-idvs",
|
||||
"sum_type",
|
||||
"tracing",
|
||||
"vek 0.15.8",
|
||||
@ -6748,7 +6738,6 @@ dependencies = [
|
||||
"serde_json",
|
||||
"slab",
|
||||
"specs",
|
||||
"specs-idvs",
|
||||
"strum",
|
||||
"tokio",
|
||||
"tracing",
|
||||
@ -6842,7 +6831,6 @@ dependencies = [
|
||||
"shaderc",
|
||||
"slab",
|
||||
"specs",
|
||||
"specs-idvs",
|
||||
"strum",
|
||||
"tokio",
|
||||
"tracing",
|
||||
|
@ -79,7 +79,6 @@ slab = "0.4.2"
|
||||
|
||||
# ECS
|
||||
specs = { version = "0.18", features = ["serde", "storage-event-control", "nightly"] }
|
||||
specs-idvs = { git = "https://gitlab.com/veloren/specs-idvs.git", rev = "c17abc638f23ef221ce7384c7dd77eef757b82f4" }
|
||||
|
||||
[dev-dependencies]
|
||||
#bench
|
||||
|
@ -26,7 +26,6 @@ hashbrown = { version = "0.12", features = ["rayon", "serde", "nightly"] }
|
||||
|
||||
# ECS
|
||||
specs = { version = "0.18", features = ["serde", "storage-event-control"] }
|
||||
specs-idvs = { git = "https://gitlab.com/veloren/specs-idvs.git", rev = "c17abc638f23ef221ce7384c7dd77eef757b82f4" }
|
||||
|
||||
# Serde
|
||||
serde = { version = "1.0.110", features = ["derive"] }
|
||||
|
@ -4,7 +4,6 @@
|
||||
use super::InterpolatableComponent;
|
||||
use common::comp::{Ori, Pos, Vel};
|
||||
use specs::Component;
|
||||
use specs_idvs::IdvStorage;
|
||||
use tracing::warn;
|
||||
use vek::ops::{Lerp, Slerp};
|
||||
|
||||
@ -53,7 +52,7 @@ impl<T: Clone> InterpBuffer<T> {
|
||||
}
|
||||
|
||||
impl<T: 'static + Send + Sync> Component for InterpBuffer<T> {
|
||||
type Storage = IdvStorage<Self>;
|
||||
type Storage = specs::VecStorage<Self>;
|
||||
}
|
||||
|
||||
// 0 is pure physics, 1 is pure extrapolation
|
||||
|
@ -29,7 +29,6 @@ use crate::{
|
||||
use hashbrown::HashMap;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::{Component, DerefFlaggedStorage};
|
||||
use specs_idvs::IdvStorage;
|
||||
use std::{convert::TryFrom, time::Duration};
|
||||
|
||||
pub const MAX_ABILITIES: usize = 5;
|
||||
@ -48,7 +47,7 @@ pub struct ActiveAbilities {
|
||||
}
|
||||
|
||||
impl Component for ActiveAbilities {
|
||||
type Storage = DerefFlaggedStorage<Self, IdvStorage<Self>>;
|
||||
type Storage = DerefFlaggedStorage<Self, specs::VecStorage<Self>>;
|
||||
}
|
||||
|
||||
impl Default for ActiveAbilities {
|
||||
|
@ -1,6 +1,5 @@
|
||||
use clap::arg_enum;
|
||||
use specs::Component;
|
||||
use specs_idvs::IdvStorage;
|
||||
|
||||
arg_enum! {
|
||||
#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
|
||||
@ -14,5 +13,5 @@ arg_enum! {
|
||||
pub struct Admin(pub AdminRole);
|
||||
|
||||
impl Component for Admin {
|
||||
type Storage = IdvStorage<Self>;
|
||||
type Storage = specs::VecStorage<Self>;
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ use crate::{
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::{Component, DerefFlaggedStorage, Entity as EcsEntity};
|
||||
use specs_idvs::IdvStorage;
|
||||
use std::{collections::VecDeque, fmt};
|
||||
use strum::{EnumIter, IntoEnumIterator};
|
||||
use vek::*;
|
||||
@ -80,7 +79,7 @@ impl Alignment {
|
||||
}
|
||||
|
||||
impl Component for Alignment {
|
||||
type Storage = DerefFlaggedStorage<Self, IdvStorage<Self>>;
|
||||
type Storage = DerefFlaggedStorage<Self, specs::VecStorage<Self>>;
|
||||
}
|
||||
|
||||
bitflags::bitflags! {
|
||||
@ -610,7 +609,7 @@ impl Agent {
|
||||
}
|
||||
|
||||
impl Component for Agent {
|
||||
type Storage = IdvStorage<Self>;
|
||||
type Storage = specs::DenseVecStorage<Self>;
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
@ -1,5 +1,4 @@
|
||||
use specs::{Component, Entity};
|
||||
use specs_idvs::IdvStorage;
|
||||
use vek::Vec2;
|
||||
|
||||
/// This component exists in order to fix a bug that caused entities
|
||||
@ -16,5 +15,5 @@ pub enum Anchor {
|
||||
}
|
||||
|
||||
impl Component for Anchor {
|
||||
type Storage = IdvStorage<Self>;
|
||||
type Storage = specs::VecStorage<Self>;
|
||||
}
|
||||
|
@ -5,8 +5,7 @@ use crate::{
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use slotmap::{new_key_type, SlotMap};
|
||||
use specs::{Component, DerefFlaggedStorage};
|
||||
use specs_idvs::IdvStorage;
|
||||
use specs::{Component, DerefFlaggedStorage, VecStorage};
|
||||
use std::time::Duration;
|
||||
|
||||
new_key_type! { pub struct AuraKey; }
|
||||
@ -154,5 +153,5 @@ impl AuraBuffConstructor {
|
||||
}
|
||||
|
||||
impl Component for Auras {
|
||||
type Storage = DerefFlaggedStorage<Self, IdvStorage<Self>>;
|
||||
type Storage = DerefFlaggedStorage<Self, VecStorage<Self>>;
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
use crate::{combat::Attack, uid::Uid};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::{Component, DerefFlaggedStorage};
|
||||
use specs_idvs::IdvStorage;
|
||||
use std::time::Duration;
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
@ -26,7 +25,7 @@ pub struct BeamSegment {
|
||||
}
|
||||
|
||||
impl Component for BeamSegment {
|
||||
type Storage = DerefFlaggedStorage<Self, IdvStorage<Self>>;
|
||||
type Storage = DerefFlaggedStorage<Self, specs::DenseVecStorage<Self>>;
|
||||
}
|
||||
|
||||
impl std::ops::Deref for BeamSegment {
|
||||
@ -43,7 +42,7 @@ pub struct Beam {
|
||||
}
|
||||
|
||||
impl Component for Beam {
|
||||
type Storage = IdvStorage<Self>;
|
||||
type Storage = specs::DenseVecStorage<Self>;
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
|
@ -24,7 +24,6 @@ use crate::{
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::{Component, DerefFlaggedStorage};
|
||||
use specs_idvs::IdvStorage;
|
||||
use strum::Display;
|
||||
use vek::*;
|
||||
|
||||
@ -942,5 +941,5 @@ impl Body {
|
||||
}
|
||||
|
||||
impl Component for Body {
|
||||
type Storage = DerefFlaggedStorage<Self, IdvStorage<Self>>;
|
||||
type Storage = DerefFlaggedStorage<Self, specs::VecStorage<Self>>;
|
||||
}
|
||||
|
@ -5,9 +5,7 @@ use core::{cmp::Ordering, time::Duration};
|
||||
use hashbrown::HashMap;
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use specs::{Component, DerefFlaggedStorage};
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use specs_idvs::IdvStorage;
|
||||
use specs::{Component, DerefFlaggedStorage, VecStorage};
|
||||
use strum::EnumIter;
|
||||
|
||||
/// De/buff Kind.
|
||||
@ -529,5 +527,5 @@ pub type BuffId = u64;
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
impl Component for Buffs {
|
||||
type Storage = DerefFlaggedStorage<Self, IdvStorage<Self>>;
|
||||
type Storage = DerefFlaggedStorage<Self, VecStorage<Self>>;
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ use crate::{
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::{Component, DerefFlaggedStorage};
|
||||
use specs_idvs::IdvStorage;
|
||||
use std::collections::BTreeMap;
|
||||
use strum::Display;
|
||||
|
||||
@ -401,5 +400,5 @@ impl Default for CharacterState {
|
||||
}
|
||||
|
||||
impl Component for CharacterState {
|
||||
type Storage = DerefFlaggedStorage<Self, IdvStorage<Self>>;
|
||||
type Storage = DerefFlaggedStorage<Self, specs::VecStorage<Self>>;
|
||||
}
|
||||
|
@ -3,8 +3,7 @@ use crate::{
|
||||
uid::Uid,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::Component;
|
||||
use specs_idvs::IdvStorage;
|
||||
use specs::{Component, DenseVecStorage};
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
/// A player's current chat mode. These are chat types that can only be sent by
|
||||
@ -26,7 +25,7 @@ pub enum ChatMode {
|
||||
}
|
||||
|
||||
impl Component for ChatMode {
|
||||
type Storage = IdvStorage<Self>;
|
||||
type Storage = DenseVecStorage<Self>;
|
||||
}
|
||||
|
||||
impl ChatMode {
|
||||
@ -257,7 +256,7 @@ impl<G> GenericChatMsg<G> {
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Faction(pub String);
|
||||
impl Component for Faction {
|
||||
type Storage = IdvStorage<Self>;
|
||||
type Storage = DenseVecStorage<Self>;
|
||||
}
|
||||
impl From<String> for Faction {
|
||||
fn from(s: String) -> Self { Faction(s) }
|
||||
|
@ -1,6 +1,5 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::{Component, DerefFlaggedStorage};
|
||||
use specs_idvs::IdvStorage;
|
||||
use specs::{Component, DerefFlaggedStorage, VecStorage};
|
||||
|
||||
pub const COMBO_DECAY_START: f64 = 7.5; // seconds
|
||||
|
||||
@ -37,5 +36,5 @@ impl Combo {
|
||||
}
|
||||
|
||||
impl Component for Combo {
|
||||
type Storage = DerefFlaggedStorage<Self, IdvStorage<Self>>;
|
||||
type Storage = DerefFlaggedStorage<Self, VecStorage<Self>>;
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ use crate::{
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::Component;
|
||||
use specs_idvs::IdvStorage;
|
||||
use std::collections::BTreeMap;
|
||||
use vek::*;
|
||||
|
||||
@ -319,5 +318,5 @@ impl Controller {
|
||||
}
|
||||
|
||||
impl Component for Controller {
|
||||
type Storage = IdvStorage<Self>;
|
||||
type Storage = specs::VecStorage<Self>;
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
use crate::{comp, consts::ENERGY_PER_LEVEL};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::{Component, DerefFlaggedStorage};
|
||||
use specs_idvs::IdvStorage;
|
||||
use std::ops::Mul;
|
||||
|
||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq)]
|
||||
@ -125,5 +124,5 @@ impl Energy {
|
||||
}
|
||||
|
||||
impl Component for Energy {
|
||||
type Storage = DerefFlaggedStorage<Self, IdvStorage<Self>>;
|
||||
type Storage = DerefFlaggedStorage<Self, specs::VecStorage<Self>>;
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ use hashbrown::HashMap;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use slab::Slab;
|
||||
use specs::{Component, DerefFlaggedStorage, Join};
|
||||
use specs_idvs::IdvStorage;
|
||||
use tracing::{error, warn};
|
||||
|
||||
// Primitive group system
|
||||
@ -25,7 +24,7 @@ pub const ENEMY: Group = Group(u32::MAX);
|
||||
pub const NPC: Group = Group(u32::MAX - 1);
|
||||
|
||||
impl Component for Group {
|
||||
type Storage = DerefFlaggedStorage<Self, IdvStorage<Self>>;
|
||||
type Storage = DerefFlaggedStorage<Self, specs::VecStorage<Self>>;
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
|
@ -8,8 +8,6 @@ use std::convert::TryFrom;
|
||||
use crate::{combat::DamageContributor, resources::Time};
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use specs::{Component, DerefFlaggedStorage};
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use specs_idvs::IdvStorage;
|
||||
use std::ops::Mul;
|
||||
|
||||
/// Specifies what and how much changed current health
|
||||
@ -230,7 +228,7 @@ impl Health {
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
impl Component for Health {
|
||||
type Storage = DerefFlaggedStorage<Self, IdvStorage<Self>>;
|
||||
type Storage = DerefFlaggedStorage<Self, specs::VecStorage<Self>>;
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
@ -1,8 +1,7 @@
|
||||
use crate::depot::Id;
|
||||
use hashbrown::HashSet;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::{Component, DerefFlaggedStorage};
|
||||
use specs_idvs::IdvStorage;
|
||||
use specs::{Component, DenseVecStorage, DerefFlaggedStorage};
|
||||
use vek::geom::Aabb;
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
@ -11,5 +10,5 @@ pub struct CanBuild {
|
||||
pub build_areas: HashSet<Id<Aabb<i32>>>,
|
||||
}
|
||||
impl Component for CanBuild {
|
||||
type Storage = DerefFlaggedStorage<Self, IdvStorage<Self>>;
|
||||
type Storage = DerefFlaggedStorage<Self, DenseVecStorage<Self>>;
|
||||
}
|
||||
|
@ -21,8 +21,7 @@ use core::{
|
||||
};
|
||||
use crossbeam_utils::atomic::AtomicCell;
|
||||
use serde::{de, Deserialize, Serialize, Serializer};
|
||||
use specs::{Component, DerefFlaggedStorage};
|
||||
use specs_idvs::IdvStorage;
|
||||
use specs::{Component, DenseVecStorage, DerefFlaggedStorage};
|
||||
use std::{borrow::Cow, collections::hash_map::DefaultHasher, fmt, sync::Arc};
|
||||
use strum::{EnumString, IntoStaticStr};
|
||||
use tracing::error;
|
||||
@ -1211,14 +1210,14 @@ impl ItemDesc for ItemDef {
|
||||
}
|
||||
|
||||
impl Component for Item {
|
||||
type Storage = DerefFlaggedStorage<Self, IdvStorage<Self>>;
|
||||
type Storage = DerefFlaggedStorage<Self, DenseVecStorage<Self>>;
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct ItemDrop(pub Item);
|
||||
|
||||
impl Component for ItemDrop {
|
||||
type Storage = IdvStorage<Self>;
|
||||
type Storage = DenseVecStorage<Self>;
|
||||
}
|
||||
|
||||
impl<'a, T: ItemDesc + ?Sized> ItemDesc for &'a T {
|
||||
|
@ -1,7 +1,6 @@
|
||||
use core::ops::Not;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::{Component, DerefFlaggedStorage};
|
||||
use specs_idvs::IdvStorage;
|
||||
use std::{convert::TryFrom, mem, ops::Range};
|
||||
use tracing::{debug, trace, warn};
|
||||
use vek::Vec3;
|
||||
@ -820,7 +819,7 @@ impl Inventory {
|
||||
}
|
||||
|
||||
impl Component for Inventory {
|
||||
type Storage = DerefFlaggedStorage<Self, IdvStorage<Self>>;
|
||||
type Storage = DerefFlaggedStorage<Self, specs::VecStorage<Self>>;
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
|
||||
@ -871,5 +870,7 @@ impl InventoryUpdate {
|
||||
}
|
||||
|
||||
impl Component for InventoryUpdate {
|
||||
type Storage = IdvStorage<Self>;
|
||||
// TODO: This could probabably be `DenseVecStorage` (except we call clear on
|
||||
// this and that essentially leaks for `DenseVecStorage` atm afaict).
|
||||
type Storage = specs::VecStorage<Self>;
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::Component;
|
||||
use specs_idvs::IdvStorage;
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub enum InviteKind {
|
||||
@ -20,12 +19,12 @@ pub struct Invite {
|
||||
}
|
||||
|
||||
impl Component for Invite {
|
||||
type Storage = IdvStorage<Self>;
|
||||
type Storage = specs::DenseVecStorage<Self>;
|
||||
}
|
||||
|
||||
/// Pending invites that an entity currently has sent out
|
||||
/// (invited entity, instant when invite times out)
|
||||
pub struct PendingInvites(pub Vec<(specs::Entity, InviteKind, std::time::Instant)>);
|
||||
impl Component for PendingInvites {
|
||||
type Storage = IdvStorage<Self>;
|
||||
type Storage = specs::DenseVecStorage<Self>;
|
||||
}
|
||||
|
@ -1,10 +1,9 @@
|
||||
use crate::{resources::Time, uid::Uid};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::Component;
|
||||
use specs_idvs::IdvStorage;
|
||||
use vek::*;
|
||||
|
||||
#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct Waypoint {
|
||||
pos: Vec3<f32>,
|
||||
last_save: Time,
|
||||
@ -28,7 +27,7 @@ impl Waypoint {
|
||||
}
|
||||
|
||||
impl Component for Waypoint {
|
||||
type Storage = IdvStorage<Self>;
|
||||
type Storage = specs::VecStorage<Self>;
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
@ -39,7 +38,7 @@ impl WaypointArea {
|
||||
}
|
||||
|
||||
impl Component for WaypointArea {
|
||||
type Storage = IdvStorage<Self>;
|
||||
type Storage = specs::VecStorage<Self>;
|
||||
}
|
||||
|
||||
impl Default for WaypointArea {
|
||||
@ -48,11 +47,11 @@ impl Default for WaypointArea {
|
||||
|
||||
/// Marker on the map, used for sharing waypoint with group and
|
||||
/// persisting it server side.
|
||||
#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct MapMarker(pub Vec2<i32>);
|
||||
|
||||
impl Component for MapMarker {
|
||||
type Storage = IdvStorage<Self>;
|
||||
type Storage = specs::VecStorage<Self>;
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
|
||||
|
@ -4,7 +4,6 @@ use crate::{
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::{Component, DerefFlaggedStorage};
|
||||
use specs_idvs::IdvStorage;
|
||||
use std::{
|
||||
ops::Add,
|
||||
time::{Duration, Instant},
|
||||
@ -72,7 +71,7 @@ impl LootOwner {
|
||||
}
|
||||
|
||||
impl Component for LootOwner {
|
||||
type Storage = DerefFlaggedStorage<Self, IdvStorage<Self>>;
|
||||
type Storage = DerefFlaggedStorage<Self, specs::DenseVecStorage<Self>>;
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, Serialize, Deserialize)]
|
||||
|
@ -2,7 +2,6 @@ use super::item::Reagent;
|
||||
use crate::uid::Uid;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::Component;
|
||||
use specs_idvs::IdvStorage;
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub enum Object {
|
||||
@ -16,5 +15,5 @@ pub enum Object {
|
||||
}
|
||||
|
||||
impl Component for Object {
|
||||
type Storage = IdvStorage<Self>;
|
||||
type Storage = specs::VecStorage<Self>;
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ use crate::util::{Dir, Plane, Projection};
|
||||
use core::f32::consts::{FRAC_PI_2, PI, TAU};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::Component;
|
||||
use specs_idvs::IdvStorage;
|
||||
use vek::{Quaternion, Vec2, Vec3};
|
||||
|
||||
// Orientation
|
||||
@ -435,7 +434,7 @@ impl From<Ori> for SerdeOri {
|
||||
}
|
||||
|
||||
impl Component for Ori {
|
||||
type Storage = IdvStorage<Self>;
|
||||
type Storage = specs::VecStorage<Self>;
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
@ -1,15 +1,13 @@
|
||||
use crate::comp::{body::Body, phys::Mass, quadruped_low, quadruped_medium, quadruped_small};
|
||||
use crossbeam_utils::atomic::AtomicCell;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::Component;
|
||||
use specs_idvs::IdvStorage;
|
||||
use std::{num::NonZeroU64, sync::Arc};
|
||||
|
||||
pub type PetId = AtomicCell<Option<NonZeroU64>>;
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
// TODO: move to server crate
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Pet {
|
||||
#[serde(skip)]
|
||||
database_id: Arc<PetId>,
|
||||
}
|
||||
|
||||
@ -99,5 +97,8 @@ pub fn is_mountable(mount: &Body, rider: Option<&Body>) -> bool {
|
||||
}
|
||||
|
||||
impl Component for Pet {
|
||||
type Storage = IdvStorage<Self>;
|
||||
// Using `DenseVecStorage` has a u64 space overhead per entity and `Pet` just
|
||||
// has an `Arc` pointer which is the same size on 64-bit platforms. So it
|
||||
// isn't worth using `DenseVecStorage` here.
|
||||
type Storage = specs::VecStorage<Self>;
|
||||
}
|
||||
|
@ -7,8 +7,7 @@ use crate::{
|
||||
};
|
||||
use hashbrown::HashSet;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::{Component, DerefFlaggedStorage, NullStorage};
|
||||
use specs_idvs::IdvStorage;
|
||||
use specs::{Component, DerefFlaggedStorage, NullStorage, VecStorage};
|
||||
use std::sync::Arc;
|
||||
use vek::*;
|
||||
|
||||
@ -17,9 +16,7 @@ use vek::*;
|
||||
pub struct Pos(pub Vec3<f32>);
|
||||
|
||||
impl Component for Pos {
|
||||
// TODO: why not regular vec storage????
|
||||
// TODO: component occupancy metrics
|
||||
type Storage = IdvStorage<Self>;
|
||||
type Storage = VecStorage<Self>;
|
||||
}
|
||||
|
||||
/// Velocity
|
||||
@ -31,8 +28,7 @@ impl Vel {
|
||||
}
|
||||
|
||||
impl Component for Vel {
|
||||
// TODO: why not regular vec storage????
|
||||
type Storage = IdvStorage<Self>;
|
||||
type Storage = VecStorage<Self>;
|
||||
}
|
||||
|
||||
/// Used to defer writes to Pos/Vel in nested join loops
|
||||
@ -44,8 +40,7 @@ pub struct PosVelOriDefer {
|
||||
}
|
||||
|
||||
impl Component for PosVelOriDefer {
|
||||
// TODO: why not regular vec storage????
|
||||
type Storage = IdvStorage<Self>;
|
||||
type Storage = VecStorage<Self>;
|
||||
}
|
||||
|
||||
/// Cache of Velocity (of last tick) * dt (of curent tick)
|
||||
@ -71,8 +66,7 @@ pub struct PreviousPhysCache {
|
||||
}
|
||||
|
||||
impl Component for PreviousPhysCache {
|
||||
// TODO: why not regular vec storage????
|
||||
type Storage = IdvStorage<Self>;
|
||||
type Storage = VecStorage<Self>;
|
||||
}
|
||||
|
||||
// Scale
|
||||
@ -80,7 +74,7 @@ impl Component for PreviousPhysCache {
|
||||
pub struct Scale(pub f32);
|
||||
|
||||
impl Component for Scale {
|
||||
type Storage = DerefFlaggedStorage<Self, IdvStorage<Self>>;
|
||||
type Storage = DerefFlaggedStorage<Self, VecStorage<Self>>;
|
||||
}
|
||||
|
||||
// Mass
|
||||
@ -92,7 +86,7 @@ impl Default for Mass {
|
||||
}
|
||||
|
||||
impl Component for Mass {
|
||||
type Storage = DerefFlaggedStorage<Self, IdvStorage<Self>>;
|
||||
type Storage = DerefFlaggedStorage<Self, VecStorage<Self>>;
|
||||
}
|
||||
|
||||
/// The average density (specific mass) of an entity.
|
||||
@ -105,7 +99,7 @@ impl Default for Density {
|
||||
}
|
||||
|
||||
impl Component for Density {
|
||||
type Storage = DerefFlaggedStorage<Self, IdvStorage<Self>>;
|
||||
type Storage = DerefFlaggedStorage<Self, VecStorage<Self>>;
|
||||
}
|
||||
|
||||
// Collider
|
||||
@ -159,7 +153,7 @@ impl Collider {
|
||||
}
|
||||
|
||||
impl Component for Collider {
|
||||
type Storage = DerefFlaggedStorage<Self, IdvStorage<Self>>;
|
||||
type Storage = DerefFlaggedStorage<Self, VecStorage<Self>>;
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
@ -214,12 +208,12 @@ impl PhysicsState {
|
||||
}
|
||||
|
||||
impl Component for PhysicsState {
|
||||
type Storage = IdvStorage<Self>;
|
||||
type Storage = VecStorage<Self>;
|
||||
}
|
||||
|
||||
/// Used to forcefully update the position, velocity, and orientation of the
|
||||
/// client
|
||||
#[derive(Copy, Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
#[derive(Copy, Clone, Debug, Default)]
|
||||
pub struct ForceUpdate;
|
||||
|
||||
impl Component for ForceUpdate {
|
||||
|
@ -1,6 +1,5 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::{Component, DerefFlaggedStorage, NullStorage};
|
||||
use specs_idvs::IdvStorage;
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::resources::{BattleMode, Time};
|
||||
@ -74,10 +73,10 @@ impl Player {
|
||||
}
|
||||
|
||||
impl Component for Player {
|
||||
type Storage = DerefFlaggedStorage<Self, IdvStorage<Self>>;
|
||||
type Storage = DerefFlaggedStorage<Self, specs::DenseVecStorage<Self>>;
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct Respawn;
|
||||
impl Component for Respawn {
|
||||
type Storage = NullStorage<Self>;
|
||||
|
@ -10,8 +10,7 @@ use crate::{
|
||||
util::Dir,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::{Component, DerefFlaggedStorage};
|
||||
use specs_idvs::IdvStorage;
|
||||
use specs::{Component, DerefFlaggedStorage, VecStorage};
|
||||
use std::{ops::Mul, time::Duration};
|
||||
use vek::*;
|
||||
|
||||
@ -264,5 +263,5 @@ impl Poise {
|
||||
}
|
||||
|
||||
impl Component for Poise {
|
||||
type Storage = DerefFlaggedStorage<Self, IdvStorage<Self>>;
|
||||
type Storage = DerefFlaggedStorage<Self, VecStorage<Self>>;
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ use crate::{
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::Component;
|
||||
use specs_idvs::IdvStorage;
|
||||
use std::time::Duration;
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
@ -22,7 +21,7 @@ pub enum Effect {
|
||||
Bonk, // Knock/dislodge/change objects on hit
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Projectile {
|
||||
// TODO: use SmallVec for these effects
|
||||
pub hit_solid: Vec<Effect>,
|
||||
@ -40,7 +39,7 @@ pub struct Projectile {
|
||||
}
|
||||
|
||||
impl Component for Projectile {
|
||||
type Storage = IdvStorage<Self>;
|
||||
type Storage = specs::DenseVecStorage<Self>;
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)]
|
||||
|
@ -1,7 +1,6 @@
|
||||
use crate::{combat::Attack, uid::Uid};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::{Component, DerefFlaggedStorage};
|
||||
use specs_idvs::IdvStorage;
|
||||
use std::time::Duration;
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
@ -27,7 +26,7 @@ pub struct Shockwave {
|
||||
}
|
||||
|
||||
impl Component for Shockwave {
|
||||
type Storage = DerefFlaggedStorage<Self, IdvStorage<Self>>;
|
||||
type Storage = DerefFlaggedStorage<Self, specs::DenseVecStorage<Self>>;
|
||||
}
|
||||
|
||||
impl std::ops::Deref for Shockwave {
|
||||
@ -36,13 +35,13 @@ impl std::ops::Deref for Shockwave {
|
||||
fn deref(&self) -> &Properties { &self.properties }
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct ShockwaveHitEntities {
|
||||
pub hit_entities: Vec<Uid>,
|
||||
}
|
||||
|
||||
impl Component for ShockwaveHitEntities {
|
||||
type Storage = IdvStorage<Self>;
|
||||
type Storage = specs::DenseVecStorage<Self>;
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
|
@ -10,7 +10,6 @@ use lazy_static::lazy_static;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sha2::{Digest, Sha256};
|
||||
use specs::{Component, DerefFlaggedStorage};
|
||||
use specs_idvs::IdvStorage;
|
||||
use std::{collections::BTreeSet, hash::Hash};
|
||||
use tracing::{trace, warn};
|
||||
|
||||
@ -239,13 +238,14 @@ pub struct SkillSet {
|
||||
skills: HashMap<Skill, u16>,
|
||||
pub modify_health: bool,
|
||||
pub modify_energy: bool,
|
||||
// TODO: why is this part of the component?
|
||||
/// Used to indicate to the frontend that there was an error in loading the
|
||||
/// skillset from the database
|
||||
pub persistence_load_error: Option<SkillsPersistenceError>,
|
||||
}
|
||||
|
||||
impl Component for SkillSet {
|
||||
type Storage = DerefFlaggedStorage<Self, IdvStorage<Self>>;
|
||||
type Storage = DerefFlaggedStorage<Self, specs::VecStorage<Self>>;
|
||||
}
|
||||
|
||||
impl Default for SkillSet {
|
||||
|
@ -1,6 +1,5 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::{Component, DerefFlaggedStorage};
|
||||
use specs_idvs::IdvStorage;
|
||||
use std::{error::Error, fmt};
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -86,5 +85,5 @@ impl Stats {
|
||||
}
|
||||
|
||||
impl Component for Stats {
|
||||
type Storage = DerefFlaggedStorage<Self, IdvStorage<Self>>;
|
||||
type Storage = DerefFlaggedStorage<Self, specs::VecStorage<Self>>;
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::{Component, DerefFlaggedStorage};
|
||||
use specs_idvs::IdvStorage;
|
||||
use specs::{Component, DenseVecStorage, DerefFlaggedStorage};
|
||||
use vek::*;
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
@ -23,7 +22,7 @@ impl Default for LightEmitter {
|
||||
}
|
||||
|
||||
impl Component for LightEmitter {
|
||||
type Storage = DerefFlaggedStorage<Self, IdvStorage<Self>>;
|
||||
type Storage = DerefFlaggedStorage<Self, DenseVecStorage<Self>>;
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
@ -44,5 +43,5 @@ impl Default for LightAnimation {
|
||||
}
|
||||
|
||||
impl Component for LightAnimation {
|
||||
type Storage = IdvStorage<Self>;
|
||||
type Storage = DenseVecStorage<Self>;
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::{Component, DerefFlaggedStorage, SystemData};
|
||||
use specs_idvs::IdvStorage;
|
||||
use std::{ops::Deref, sync::Arc};
|
||||
|
||||
pub trait Link: Sized + Send + Sync + 'static {
|
||||
@ -49,7 +48,7 @@ impl<R: Role + 'static> Component for Is<R>
|
||||
where
|
||||
R::Link: Send + Sync + 'static,
|
||||
{
|
||||
type Storage = DerefFlaggedStorage<Self, IdvStorage<Self>>;
|
||||
type Storage = DerefFlaggedStorage<Self, specs::VecStorage<Self>>;
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
|
@ -4,7 +4,6 @@
|
||||
// module in `server`.
|
||||
|
||||
use specs::Component;
|
||||
use specs_idvs::IdvStorage;
|
||||
use vek::*;
|
||||
|
||||
use crate::comp::dialogue::MoodState;
|
||||
@ -15,7 +14,7 @@ pub type RtSimId = usize;
|
||||
pub struct RtSimEntity(pub RtSimId);
|
||||
|
||||
impl Component for RtSimEntity {
|
||||
type Storage = IdvStorage<Self>;
|
||||
type Storage = specs::VecStorage<Self>;
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
|
@ -26,7 +26,6 @@ network = { package = "veloren-network", path = "../network", features = ["metri
|
||||
#inline_tweak = "1.0.8"
|
||||
|
||||
specs = { version = "0.18", features = ["shred-derive"] }
|
||||
specs-idvs = { git = "https://gitlab.com/veloren/specs-idvs.git", rev = "c17abc638f23ef221ce7384c7dd77eef757b82f4" }
|
||||
|
||||
strum = { version = "0.24", features = ["derive"] }
|
||||
bincode = "1.3.2"
|
||||
|
@ -2,7 +2,6 @@ use common_net::msg::{ClientType, ServerGeneral, ServerMsg};
|
||||
use network::{Message, Participant, Stream, StreamError, StreamParams};
|
||||
use serde::{de::DeserializeOwned, Serialize};
|
||||
use specs::Component;
|
||||
use specs_idvs::IdvStorage;
|
||||
use std::sync::{atomic::AtomicBool, Mutex};
|
||||
|
||||
/// Client handles ALL network related information of everything that connects
|
||||
@ -40,7 +39,7 @@ pub struct PreparedMsg {
|
||||
}
|
||||
|
||||
impl Component for Client {
|
||||
type Storage = IdvStorage<Self>;
|
||||
type Storage = specs::DenseVecStorage<Self>;
|
||||
}
|
||||
|
||||
impl Client {
|
||||
|
@ -5,7 +5,6 @@ use common::comp::AdminRole;
|
||||
use common_net::msg::RegisterError;
|
||||
use hashbrown::HashMap;
|
||||
use specs::Component;
|
||||
use specs_idvs::IdvStorage;
|
||||
use std::{str::FromStr, sync::Arc};
|
||||
use tokio::{runtime::Runtime, sync::oneshot};
|
||||
use tracing::{error, info};
|
||||
@ -44,7 +43,7 @@ impl PendingLogin {
|
||||
}
|
||||
|
||||
impl Component for PendingLogin {
|
||||
type Storage = IdvStorage<Self>;
|
||||
type Storage = specs::DenseVecStorage<Self>;
|
||||
}
|
||||
|
||||
pub struct LoginProvider {
|
||||
|
@ -1,8 +1,7 @@
|
||||
use common_net::msg::PresenceKind;
|
||||
use hashbrown::HashSet;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specs::{Component, DerefFlaggedStorage, NullStorage};
|
||||
use specs_idvs::IdvStorage;
|
||||
use specs::{Component, DenseVecStorage, DerefFlaggedStorage, NullStorage, VecStorage};
|
||||
use vek::*;
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
@ -23,7 +22,8 @@ impl Presence {
|
||||
}
|
||||
|
||||
impl Component for Presence {
|
||||
type Storage = DerefFlaggedStorage<Self, IdvStorage<Self>>;
|
||||
// Presence seems <= 64 bits, so it isn't worth using DenseVecStorage.
|
||||
type Storage = DerefFlaggedStorage<Self, VecStorage<Self>>;
|
||||
}
|
||||
|
||||
// Distance from fuzzy_chunk before snapping to current chunk
|
||||
@ -38,7 +38,7 @@ pub struct RegionSubscription {
|
||||
}
|
||||
|
||||
impl Component for RegionSubscription {
|
||||
type Storage = DerefFlaggedStorage<Self, IdvStorage<Self>>;
|
||||
type Storage = DerefFlaggedStorage<Self, DenseVecStorage<Self>>;
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize)]
|
||||
|
@ -7,8 +7,7 @@ use common::{
|
||||
};
|
||||
use common_state::BlockChange;
|
||||
use hashbrown::HashMap;
|
||||
use specs::{Component, Entity};
|
||||
use specs_idvs::IdvStorage;
|
||||
use specs::{Component, DenseVecStorage, Entity};
|
||||
use tracing::warn;
|
||||
use vek::{num_traits::ToPrimitive, Rgb, Vec3};
|
||||
|
||||
@ -243,9 +242,9 @@ impl WireNode {
|
||||
}
|
||||
|
||||
impl Component for WiringElement {
|
||||
type Storage = IdvStorage<Self>;
|
||||
type Storage = DenseVecStorage<Self>;
|
||||
}
|
||||
|
||||
impl Component for Circuit {
|
||||
type Storage = IdvStorage<Self>;
|
||||
type Storage = DenseVecStorage<Self>;
|
||||
}
|
||||
|
@ -80,7 +80,6 @@ egui_winit_platform = {version = "0.8", optional = true }
|
||||
|
||||
# ECS
|
||||
specs = { version = "0.18", features = ["serde", "storage-event-control", "derive"] }
|
||||
specs-idvs = { git = "https://gitlab.com/veloren/specs-idvs.git", rev = "c17abc638f23ef221ce7384c7dd77eef757b82f4" }
|
||||
|
||||
# Mathematics
|
||||
vek = {version = "0.15.8", features = ["serde"]}
|
||||
|
@ -1,6 +1,5 @@
|
||||
use common::{comp::Ori, outcome::HealthChangeInfo};
|
||||
use specs::Component;
|
||||
use specs_idvs::IdvStorage;
|
||||
use specs::{Component, VecStorage};
|
||||
use vek::*;
|
||||
|
||||
// Floats over entity that has had a health change, rising up over time until it
|
||||
@ -24,7 +23,7 @@ pub struct HpFloaterList {
|
||||
pub time_since_last_dmg_by_me: Option<f32>,
|
||||
}
|
||||
impl Component for HpFloaterList {
|
||||
type Storage = IdvStorage<Self>;
|
||||
type Storage = VecStorage<Self>;
|
||||
}
|
||||
|
||||
// Used for smooth interpolation of visual elements that are tied to entity
|
||||
@ -35,5 +34,5 @@ pub struct Interpolated {
|
||||
pub ori: Ori,
|
||||
}
|
||||
impl Component for Interpolated {
|
||||
type Storage = IdvStorage<Self>;
|
||||
type Storage = VecStorage<Self>;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user