diff --git a/Cargo.lock b/Cargo.lock index a328b4794d..c5b7100f38 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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", diff --git a/common/Cargo.toml b/common/Cargo.toml index a137a7410c..e21c7c9b6f 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -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 diff --git a/common/net/Cargo.toml b/common/net/Cargo.toml index ab9ae0dd4c..4b23bf1eaa 100644 --- a/common/net/Cargo.toml +++ b/common/net/Cargo.toml @@ -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"] } diff --git a/common/net/src/sync/interpolation.rs b/common/net/src/sync/interpolation.rs index d183573d48..bc259dfd68 100644 --- a/common/net/src/sync/interpolation.rs +++ b/common/net/src/sync/interpolation.rs @@ -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 InterpBuffer { } impl Component for InterpBuffer { - type Storage = IdvStorage; + type Storage = specs::VecStorage; } // 0 is pure physics, 1 is pure extrapolation diff --git a/common/src/comp/ability.rs b/common/src/comp/ability.rs index 4e74959cd5..2729790117 100644 --- a/common/src/comp/ability.rs +++ b/common/src/comp/ability.rs @@ -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>; + type Storage = DerefFlaggedStorage>; } impl Default for ActiveAbilities { diff --git a/common/src/comp/admin.rs b/common/src/comp/admin.rs index b92e070501..137afce083 100644 --- a/common/src/comp/admin.rs +++ b/common/src/comp/admin.rs @@ -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; + type Storage = specs::VecStorage; } diff --git a/common/src/comp/agent.rs b/common/src/comp/agent.rs index b988a8b643..02768a9a49 100644 --- a/common/src/comp/agent.rs +++ b/common/src/comp/agent.rs @@ -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>; + type Storage = DerefFlaggedStorage>; } bitflags::bitflags! { @@ -610,7 +609,7 @@ impl Agent { } impl Component for Agent { - type Storage = IdvStorage; + type Storage = specs::DenseVecStorage; } #[cfg(test)] diff --git a/common/src/comp/anchor.rs b/common/src/comp/anchor.rs index 07fc601fcf..f82b9b1881 100644 --- a/common/src/comp/anchor.rs +++ b/common/src/comp/anchor.rs @@ -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; + type Storage = specs::VecStorage; } diff --git a/common/src/comp/aura.rs b/common/src/comp/aura.rs index 447cda6090..a66f719b59 100644 --- a/common/src/comp/aura.rs +++ b/common/src/comp/aura.rs @@ -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>; + type Storage = DerefFlaggedStorage>; } diff --git a/common/src/comp/beam.rs b/common/src/comp/beam.rs index 815e2685ea..95e501938b 100644 --- a/common/src/comp/beam.rs +++ b/common/src/comp/beam.rs @@ -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>; + type Storage = DerefFlaggedStorage>; } impl std::ops::Deref for BeamSegment { @@ -43,7 +42,7 @@ pub struct Beam { } impl Component for Beam { - type Storage = IdvStorage; + type Storage = specs::DenseVecStorage; } #[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq)] diff --git a/common/src/comp/body.rs b/common/src/comp/body.rs index c46b4d3d64..53a7853fda 100644 --- a/common/src/comp/body.rs +++ b/common/src/comp/body.rs @@ -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>; + type Storage = DerefFlaggedStorage>; } diff --git a/common/src/comp/buff.rs b/common/src/comp/buff.rs index 30ad7cc247..db2b4c32dc 100644 --- a/common/src/comp/buff.rs +++ b/common/src/comp/buff.rs @@ -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>; + type Storage = DerefFlaggedStorage>; } diff --git a/common/src/comp/character_state.rs b/common/src/comp/character_state.rs index 6975bce212..0471e06687 100644 --- a/common/src/comp/character_state.rs +++ b/common/src/comp/character_state.rs @@ -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>; + type Storage = DerefFlaggedStorage>; } diff --git a/common/src/comp/chat.rs b/common/src/comp/chat.rs index 6fc3717425..b31857638b 100644 --- a/common/src/comp/chat.rs +++ b/common/src/comp/chat.rs @@ -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; + type Storage = DenseVecStorage; } impl ChatMode { @@ -257,7 +256,7 @@ impl GenericChatMsg { #[derive(Clone, Debug)] pub struct Faction(pub String); impl Component for Faction { - type Storage = IdvStorage; + type Storage = DenseVecStorage; } impl From for Faction { fn from(s: String) -> Self { Faction(s) } diff --git a/common/src/comp/combo.rs b/common/src/comp/combo.rs index bca2cc5917..982697ddb7 100644 --- a/common/src/comp/combo.rs +++ b/common/src/comp/combo.rs @@ -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>; + type Storage = DerefFlaggedStorage>; } diff --git a/common/src/comp/controller.rs b/common/src/comp/controller.rs index 0a564593fa..9ceeb62c11 100644 --- a/common/src/comp/controller.rs +++ b/common/src/comp/controller.rs @@ -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; + type Storage = specs::VecStorage; } diff --git a/common/src/comp/energy.rs b/common/src/comp/energy.rs index 037d73e416..a98a2ce544 100644 --- a/common/src/comp/energy.rs +++ b/common/src/comp/energy.rs @@ -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>; + type Storage = DerefFlaggedStorage>; } diff --git a/common/src/comp/group.rs b/common/src/comp/group.rs index b9fa5e218c..d3315b365a 100644 --- a/common/src/comp/group.rs +++ b/common/src/comp/group.rs @@ -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>; + type Storage = DerefFlaggedStorage>; } #[derive(Clone, Debug)] diff --git a/common/src/comp/health.rs b/common/src/comp/health.rs index 329b66f92f..13eac4b7eb 100644 --- a/common/src/comp/health.rs +++ b/common/src/comp/health.rs @@ -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>; + type Storage = DerefFlaggedStorage>; } #[cfg(test)] diff --git a/common/src/comp/inputs.rs b/common/src/comp/inputs.rs index 5d93e4247f..a3f93bb65e 100644 --- a/common/src/comp/inputs.rs +++ b/common/src/comp/inputs.rs @@ -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>>, } impl Component for CanBuild { - type Storage = DerefFlaggedStorage>; + type Storage = DerefFlaggedStorage>; } diff --git a/common/src/comp/inventory/item/mod.rs b/common/src/comp/inventory/item/mod.rs index 428d5e7ce4..bff26293c9 100644 --- a/common/src/comp/inventory/item/mod.rs +++ b/common/src/comp/inventory/item/mod.rs @@ -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>; + type Storage = DerefFlaggedStorage>; } #[derive(Clone, Debug, Serialize, Deserialize)] pub struct ItemDrop(pub Item); impl Component for ItemDrop { - type Storage = IdvStorage; + type Storage = DenseVecStorage; } impl<'a, T: ItemDesc + ?Sized> ItemDesc for &'a T { diff --git a/common/src/comp/inventory/mod.rs b/common/src/comp/inventory/mod.rs index e2454d763d..d08329ca11 100644 --- a/common/src/comp/inventory/mod.rs +++ b/common/src/comp/inventory/mod.rs @@ -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>; + type Storage = DerefFlaggedStorage>; } #[derive(Copy, Clone, Debug, Serialize, Deserialize)] @@ -871,5 +870,7 @@ impl InventoryUpdate { } impl Component for InventoryUpdate { - type Storage = IdvStorage; + // TODO: This could probabably be `DenseVecStorage` (except we call clear on + // this and that essentially leaks for `DenseVecStorage` atm afaict). + type Storage = specs::VecStorage; } diff --git a/common/src/comp/invite.rs b/common/src/comp/invite.rs index 049665bf10..194ec0974b 100644 --- a/common/src/comp/invite.rs +++ b/common/src/comp/invite.rs @@ -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; + type Storage = specs::DenseVecStorage; } /// 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; + type Storage = specs::DenseVecStorage; } diff --git a/common/src/comp/location.rs b/common/src/comp/location.rs index 222cc2247d..62cfe9ce41 100644 --- a/common/src/comp/location.rs +++ b/common/src/comp/location.rs @@ -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, last_save: Time, @@ -28,7 +27,7 @@ impl Waypoint { } impl Component for Waypoint { - type Storage = IdvStorage; + type Storage = specs::VecStorage; } #[derive(Copy, Clone, Debug, PartialEq)] @@ -39,7 +38,7 @@ impl WaypointArea { } impl Component for WaypointArea { - type Storage = IdvStorage; + type Storage = specs::VecStorage; } 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); impl Component for MapMarker { - type Storage = IdvStorage; + type Storage = specs::VecStorage; } #[derive(Copy, Clone, Debug, Serialize, Deserialize)] diff --git a/common/src/comp/loot_owner.rs b/common/src/comp/loot_owner.rs index 7240b5e5f8..17f0fb7500 100644 --- a/common/src/comp/loot_owner.rs +++ b/common/src/comp/loot_owner.rs @@ -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>; + type Storage = DerefFlaggedStorage>; } #[derive(Debug, Copy, Clone, Serialize, Deserialize)] diff --git a/common/src/comp/misc.rs b/common/src/comp/misc.rs index 4702f99d09..35d8981afd 100644 --- a/common/src/comp/misc.rs +++ b/common/src/comp/misc.rs @@ -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; + type Storage = specs::VecStorage; } diff --git a/common/src/comp/ori.rs b/common/src/comp/ori.rs index b06900a7cf..027be7d74c 100644 --- a/common/src/comp/ori.rs +++ b/common/src/comp/ori.rs @@ -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 for SerdeOri { } impl Component for Ori { - type Storage = IdvStorage; + type Storage = specs::VecStorage; } #[cfg(test)] diff --git a/common/src/comp/pet.rs b/common/src/comp/pet.rs index 8f56628911..63ab096063 100644 --- a/common/src/comp/pet.rs +++ b/common/src/comp/pet.rs @@ -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>; -#[derive(Clone, Debug, Serialize, Deserialize)] +// TODO: move to server crate +#[derive(Clone, Debug)] pub struct Pet { - #[serde(skip)] database_id: Arc, } @@ -99,5 +97,8 @@ pub fn is_mountable(mount: &Body, rider: Option<&Body>) -> bool { } impl Component for Pet { - type Storage = IdvStorage; + // 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; } diff --git a/common/src/comp/phys.rs b/common/src/comp/phys.rs index d020d8e089..6af6aaa929 100644 --- a/common/src/comp/phys.rs +++ b/common/src/comp/phys.rs @@ -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); impl Component for Pos { - // TODO: why not regular vec storage???? - // TODO: component occupancy metrics - type Storage = IdvStorage; + type Storage = VecStorage; } /// Velocity @@ -31,8 +28,7 @@ impl Vel { } impl Component for Vel { - // TODO: why not regular vec storage???? - type Storage = IdvStorage; + type Storage = VecStorage; } /// 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; + type Storage = VecStorage; } /// 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; + type Storage = VecStorage; } // Scale @@ -80,7 +74,7 @@ impl Component for PreviousPhysCache { pub struct Scale(pub f32); impl Component for Scale { - type Storage = DerefFlaggedStorage>; + type Storage = DerefFlaggedStorage>; } // Mass @@ -92,7 +86,7 @@ impl Default for Mass { } impl Component for Mass { - type Storage = DerefFlaggedStorage>; + type Storage = DerefFlaggedStorage>; } /// The average density (specific mass) of an entity. @@ -105,7 +99,7 @@ impl Default for Density { } impl Component for Density { - type Storage = DerefFlaggedStorage>; + type Storage = DerefFlaggedStorage>; } // Collider @@ -159,7 +153,7 @@ impl Collider { } impl Component for Collider { - type Storage = DerefFlaggedStorage>; + type Storage = DerefFlaggedStorage>; } #[derive(Copy, Clone, Default, Debug, PartialEq, Serialize, Deserialize)] @@ -214,12 +208,12 @@ impl PhysicsState { } impl Component for PhysicsState { - type Storage = IdvStorage; + type Storage = VecStorage; } /// 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 { diff --git a/common/src/comp/player.rs b/common/src/comp/player.rs index 7236096e68..93c2afcb25 100644 --- a/common/src/comp/player.rs +++ b/common/src/comp/player.rs @@ -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>; + type Storage = DerefFlaggedStorage>; } -#[derive(Clone, Debug, Default, Serialize, Deserialize)] +#[derive(Clone, Debug, Default)] pub struct Respawn; impl Component for Respawn { type Storage = NullStorage; diff --git a/common/src/comp/poise.rs b/common/src/comp/poise.rs index fa36a0e452..37aaef64ba 100644 --- a/common/src/comp/poise.rs +++ b/common/src/comp/poise.rs @@ -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>; + type Storage = DerefFlaggedStorage>; } diff --git a/common/src/comp/projectile.rs b/common/src/comp/projectile.rs index b424415841..532866b654 100644 --- a/common/src/comp/projectile.rs +++ b/common/src/comp/projectile.rs @@ -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, @@ -40,7 +39,7 @@ pub struct Projectile { } impl Component for Projectile { - type Storage = IdvStorage; + type Storage = specs::DenseVecStorage; } #[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] diff --git a/common/src/comp/shockwave.rs b/common/src/comp/shockwave.rs index df6b666c6a..d04c40c1bd 100644 --- a/common/src/comp/shockwave.rs +++ b/common/src/comp/shockwave.rs @@ -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>; + type Storage = DerefFlaggedStorage>; } 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, } impl Component for ShockwaveHitEntities { - type Storage = IdvStorage; + type Storage = specs::DenseVecStorage; } #[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq)] diff --git a/common/src/comp/skillset/mod.rs b/common/src/comp/skillset/mod.rs index aa7861620e..d5f9d65bfa 100644 --- a/common/src/comp/skillset/mod.rs +++ b/common/src/comp/skillset/mod.rs @@ -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, 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, } impl Component for SkillSet { - type Storage = DerefFlaggedStorage>; + type Storage = DerefFlaggedStorage>; } impl Default for SkillSet { diff --git a/common/src/comp/stats.rs b/common/src/comp/stats.rs index 5cc2406ed8..25b58effec 100644 --- a/common/src/comp/stats.rs +++ b/common/src/comp/stats.rs @@ -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>; + type Storage = DerefFlaggedStorage>; } diff --git a/common/src/comp/visual.rs b/common/src/comp/visual.rs index 68877bde5f..d5c6bccc56 100644 --- a/common/src/comp/visual.rs +++ b/common/src/comp/visual.rs @@ -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>; + type Storage = DerefFlaggedStorage>; } #[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)] @@ -44,5 +43,5 @@ impl Default for LightAnimation { } impl Component for LightAnimation { - type Storage = IdvStorage; + type Storage = DenseVecStorage; } diff --git a/common/src/link.rs b/common/src/link.rs index 6ef53aa4a0..2575be4973 100644 --- a/common/src/link.rs +++ b/common/src/link.rs @@ -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 Component for Is where R::Link: Send + Sync + 'static, { - type Storage = DerefFlaggedStorage>; + type Storage = DerefFlaggedStorage>; } #[derive(Serialize, Deserialize, Debug)] diff --git a/common/src/rtsim.rs b/common/src/rtsim.rs index 07c1340a00..d8ff8f0423 100644 --- a/common/src/rtsim.rs +++ b/common/src/rtsim.rs @@ -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; + type Storage = specs::VecStorage; } #[derive(Clone, Debug)] diff --git a/server/Cargo.toml b/server/Cargo.toml index 03bf506937..8b7df44dfa 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -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" diff --git a/server/src/client.rs b/server/src/client.rs index cd665dd371..e00aaca265 100644 --- a/server/src/client.rs +++ b/server/src/client.rs @@ -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; + type Storage = specs::DenseVecStorage; } impl Client { diff --git a/server/src/login_provider.rs b/server/src/login_provider.rs index b66d1481b1..96d4d8d69f 100644 --- a/server/src/login_provider.rs +++ b/server/src/login_provider.rs @@ -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; + type Storage = specs::DenseVecStorage; } pub struct LoginProvider { diff --git a/server/src/presence.rs b/server/src/presence.rs index 03a60d411d..fea7730441 100644 --- a/server/src/presence.rs +++ b/server/src/presence.rs @@ -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>; + // Presence seems <= 64 bits, so it isn't worth using DenseVecStorage. + type Storage = DerefFlaggedStorage>; } // Distance from fuzzy_chunk before snapping to current chunk @@ -38,7 +38,7 @@ pub struct RegionSubscription { } impl Component for RegionSubscription { - type Storage = DerefFlaggedStorage>; + type Storage = DerefFlaggedStorage>; } #[derive(Copy, Clone, Debug, Default, Serialize, Deserialize)] diff --git a/server/src/wiring.rs b/server/src/wiring.rs index b8999d371f..bfe901be75 100644 --- a/server/src/wiring.rs +++ b/server/src/wiring.rs @@ -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; + type Storage = DenseVecStorage; } impl Component for Circuit { - type Storage = IdvStorage; + type Storage = DenseVecStorage; } diff --git a/voxygen/Cargo.toml b/voxygen/Cargo.toml index c06c510a5c..cce9a89b39 100644 --- a/voxygen/Cargo.toml +++ b/voxygen/Cargo.toml @@ -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"]} diff --git a/voxygen/src/ecs/comp.rs b/voxygen/src/ecs/comp.rs index d0f966aa30..ecc769ca93 100644 --- a/voxygen/src/ecs/comp.rs +++ b/voxygen/src/ecs/comp.rs @@ -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, } impl Component for HpFloaterList { - type Storage = IdvStorage; + type Storage = VecStorage; } // 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; + type Storage = VecStorage; }