djust for changes in specs safety refactor

This commit is contained in:
Imbris 2023-09-15 16:30:54 -04:00
parent 5d311e13bd
commit 9c398cb06d
41 changed files with 164 additions and 125 deletions

58
Cargo.lock generated
View File

@ -353,12 +353,6 @@ dependencies = [
"syn 2.0.29", "syn 2.0.29",
] ]
[[package]]
name = "atom"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c9ff149ed9780025acfdb36862d35b28856bb693ceb451259a7164442f22fdc3"
[[package]] [[package]]
name = "atomic-polyfill" name = "atomic-polyfill"
version = "0.1.11" version = "0.1.11"
@ -2726,11 +2720,10 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]] [[package]]
name = "hibitset" name = "hibitset"
version = "0.6.3" version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93a1bb8316a44459a7d14253c4d28dd7395cbd23cc04a68c46e851b8e46d64b1" checksum = "f3ede5cfa60c958e60330d65163adbc4211e15a2653ad80eb0cce878de120121"
dependencies = [ dependencies = [
"atom",
"rayon", "rayon",
] ]
@ -3387,6 +3380,22 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "macro_rules_attribute"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf0c9b980bf4f3a37fd7b1c066941dd1b1d0152ce6ee6e8fe8c49b9f6810d862"
dependencies = [
"macro_rules_attribute-proc_macro",
"paste",
]
[[package]]
name = "macro_rules_attribute-proc_macro"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58093314a45e00c77d5c508f76e77c3396afbbc0d01506e7fae47b018bac2b1d"
[[package]] [[package]]
name = "malloc_buf" name = "malloc_buf"
version = "0.0.6" version = "0.0.6"
@ -3814,6 +3823,27 @@ dependencies = [
"windows-sys 0.48.0", "windows-sys 0.48.0",
] ]
[[package]]
name = "nougat"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97b57b9ced431322f054fc673f1d3c7fa52d80efd9df74ad2fc759f044742510"
dependencies = [
"macro_rules_attribute",
"nougat-proc_macros",
]
[[package]]
name = "nougat-proc_macros"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c84f77a45e99a2f9b492695d99e1c23844619caa5f3e57647cffacad773ca257"
dependencies = [
"proc-macro2 1.0.66",
"quote 1.0.33",
"syn 1.0.109",
]
[[package]] [[package]]
name = "ntapi" name = "ntapi"
version = "0.3.7" version = "0.3.7"
@ -5639,12 +5669,13 @@ checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
[[package]] [[package]]
name = "shred" name = "shred"
version = "0.14.1" version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6aa4148ce950f367ede79bff6bb04bbf3c31317a1291315078ef60c080821a1" checksum = "dc6b2cd1ccb08cf2b25d75c936e0cc9c8cb93c39a83814956da32653236338c0"
dependencies = [ dependencies = [
"ahash 0.7.6", "ahash 0.7.6",
"arrayvec 0.7.4", "arrayvec 0.7.4",
"atomic_refcell",
"rayon", "rayon",
"shred-derive", "shred-derive",
"smallvec", "smallvec",
@ -5815,14 +5846,15 @@ dependencies = [
[[package]] [[package]]
name = "specs" name = "specs"
version = "0.19.0" version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad2e89cb8aba27bebf48a5a47b4889e7b317a08884d92cc36109d58992d41325" checksum = "a60eabdfd5a80e458c3e7bcc9f1076d6ce3cc8ddb71d69691f00fc0de735a635"
dependencies = [ dependencies = [
"ahash 0.7.6", "ahash 0.7.6",
"crossbeam-queue", "crossbeam-queue",
"hibitset", "hibitset",
"log", "log",
"nougat",
"rayon", "rayon",
"serde", "serde",
"shred", "shred",

View File

@ -149,7 +149,7 @@ serde = { version = "1.0.118", features = ["derive"] }
serde_json = { version = "1.0.50" } serde_json = { version = "1.0.50" }
ron = { version = "0.8", default-features = false} ron = { version = "0.8", default-features = false}
specs = { version = "0.19", features = ["nightly"] } specs = { version = "0.20", features = ["nightly"] }
image = { version = "0.24", default-features = false, features = ["png"] } image = { version = "0.24", default-features = false, features = ["png"] }
rayon = { version = "1.5" } rayon = { version = "1.5" }

View File

@ -10,7 +10,7 @@ pub use crate::error::Error;
pub use authc::AuthClientError; pub use authc::AuthClientError;
pub use common_net::msg::ServerInfo; pub use common_net::msg::ServerInfo;
pub use specs::{ pub use specs::{
join::Join, Builder, DispatcherBuilder, Entity as EcsEntity, ReadStorage, World, WorldExt, Builder, DispatcherBuilder, Entity as EcsEntity, Join, LendJoin, ReadStorage, World, WorldExt,
}; };
use crate::addr::ConnectionArgs; use crate::addr::ConnectionArgs;

View File

@ -1,7 +1,7 @@
use super::track::UpdateTracker; use super::track::UpdateTracker;
use common::{resources::Time, uid::Uid}; use common::{resources::Time, uid::Uid};
use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde::{de::DeserializeOwned, Deserialize, Serialize};
use specs::{Component, Entity, Join, ReadStorage, World, WorldExt}; use specs::{storage::AccessMut, Component, Entity, Join, ReadStorage, World, WorldExt};
use std::{ use std::{
convert::{TryFrom, TryInto}, convert::{TryFrom, TryInto},
fmt::Debug, fmt::Debug,
@ -33,7 +33,7 @@ pub fn handle_insert<C: Component>(comp: C, entity: Entity, world: &World) {
/// Useful for implementing CompPacket trait /// Useful for implementing CompPacket trait
pub fn handle_modify<C: Component + Debug>(comp: C, entity: Entity, world: &World) { pub fn handle_modify<C: Component + Debug>(comp: C, entity: Entity, world: &World) {
if let Some(mut c) = world.write_storage::<C>().get_mut(entity) { if let Some(mut c) = world.write_storage::<C>().get_mut(entity) {
*c = comp *c.access_mut() = comp
} else { } else {
error!( error!(
?comp, ?comp,
@ -77,7 +77,7 @@ pub fn handle_interp_modify<C: InterpolatableComponent + Debug>(
) { ) {
if let Some(mut interp_data) = world.write_storage::<C::InterpData>().get_mut(entity) { if let Some(mut interp_data) = world.write_storage::<C::InterpData>().get_mut(entity) {
let time = world.read_resource::<Time>().0; let time = world.read_resource::<Time>().0;
comp.update_component(&mut interp_data, time, force_update); comp.update_component(interp_data.access_mut(), time, force_update);
handle_modify(comp, entity, world); handle_modify(comp, entity, world);
} else { } else {
error!( error!(

View File

@ -2,7 +2,7 @@ use crate::{comp::Alignment, uid::Uid};
use hashbrown::HashMap; use hashbrown::HashMap;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use slab::Slab; use slab::Slab;
use specs::{Component, DerefFlaggedStorage, Join}; use specs::{Component, DerefFlaggedStorage, Join, LendJoin};
use tracing::{error, warn}; use tracing::{error, warn};
// Primitive group system // Primitive group system

View File

@ -2,7 +2,7 @@ use crate::comp::{Pos, Presence, Vel};
use common_base::span; use common_base::span;
use hashbrown::{hash_map::DefaultHashBuilder, HashSet}; use hashbrown::{hash_map::DefaultHashBuilder, HashSet};
use indexmap::IndexMap; use indexmap::IndexMap;
use specs::{hibitset::BitSetLike, BitSet, Entities, Join, ReadStorage}; use specs::{hibitset::BitSetLike, BitSet, Entities, Join, LendJoin, ReadStorage};
use vek::*; use vek::*;
pub enum Event { pub enum Event {

View File

@ -17,8 +17,8 @@ use common_ecs::{Job, Origin, ParMode, Phase, System};
use rand::Rng; use rand::Rng;
use rayon::iter::ParallelIterator; use rayon::iter::ParallelIterator;
use specs::{ use specs::{
shred::ResourceId, Entities, Join, ParJoin, Read, ReadExpect, ReadStorage, SystemData, World, shred::ResourceId, Entities, Join, LendJoin, ParJoin, Read, ReadExpect, ReadStorage,
WriteStorage, SystemData, World, WriteStorage,
}; };
use std::time::Duration; use std::time::Duration;
use vek::*; use vek::*;
@ -311,11 +311,13 @@ impl<'a> System<'a> for Sys {
// Set start time on new beams // Set start time on new beams
// This change doesn't need to be recorded as it is not sent to the client // This change doesn't need to be recorded as it is not sent to the client
beam_segments.set_event_emission(false); beam_segments.set_event_emission(false);
(&mut beam_segments).join().for_each(|mut beam_segment| { (&mut beam_segments)
if beam_segment.creation.is_none() { .lend_join()
beam_segment.creation = Some(time); .for_each(|mut beam_segment| {
} if beam_segment.creation.is_none() {
}); beam_segment.creation = Some(time);
}
});
beam_segments.set_event_emission(true); beam_segments.set_event_emission(true);
} }
} }

View File

@ -22,8 +22,8 @@ use common_base::prof_span;
use common_ecs::{Job, Origin, ParMode, Phase, System}; use common_ecs::{Job, Origin, ParMode, Phase, System};
use rayon::iter::ParallelIterator; use rayon::iter::ParallelIterator;
use specs::{ use specs::{
shred::ResourceId, Entities, Entity, Join, ParJoin, Read, ReadExpect, ReadStorage, SystemData, shred::ResourceId, Entities, Entity, LendJoin, ParJoin, Read, ReadExpect, ReadStorage,
World, WriteStorage, SystemData, World, WriteStorage,
}; };
#[derive(SystemData)] #[derive(SystemData)]
@ -120,7 +120,7 @@ impl<'a> System<'a> for Sys {
} }
} }
for (entity, buff_comp, mut stat, body, health, energy, physics_state) in ( let buff_join = (
&read_data.entities, &read_data.entities,
&read_data.buffs, &read_data.buffs,
&mut stats, &mut stats,
@ -129,8 +129,9 @@ impl<'a> System<'a> for Sys {
&read_data.energies, &read_data.energies,
read_data.physics_states.maybe(), read_data.physics_states.maybe(),
) )
.join() .lend_join();
{ buff_join.for_each(|comps| {
let (entity, buff_comp, mut stat, body, health, energy, physics_state) = comps;
// Apply buffs to entity based off of their current physics_state // Apply buffs to entity based off of their current physics_state
if let Some(physics_state) = physics_state { if let Some(physics_state) = physics_state {
if matches!( if matches!(
@ -459,7 +460,7 @@ impl<'a> System<'a> for Sys {
}, },
}); });
} }
} });
// Turned back to true // Turned back to true
stats.set_event_emission(true); stats.set_event_emission(true);
} }

View File

@ -1,5 +1,5 @@
use specs::{ use specs::{
shred::ResourceId, Entities, Join, LazyUpdate, Read, ReadExpect, ReadStorage, SystemData, shred::ResourceId, Entities, LazyUpdate, LendJoin, Read, ReadExpect, ReadStorage, SystemData,
World, WriteStorage, World, WriteStorage,
}; };
@ -105,24 +105,7 @@ impl<'a> System<'a> for Sys {
let mut server_events = Vec::new(); let mut server_events = Vec::new();
let mut output_events = OutputEvents::new(&mut local_events, &mut server_events); let mut output_events = OutputEvents::new(&mut local_events, &mut server_events);
for ( let join = (
entity,
uid,
mut char_state,
character_activity,
pos,
vel,
ori,
mass,
density,
energy,
inventory,
controller,
health,
body,
(physics, scale, stat, skill_set, active_abilities, is_rider),
combo,
) in (
&read_data.entities, &read_data.entities,
&read_data.uids, &read_data.uids,
&mut character_states, &mut character_states,
@ -147,12 +130,30 @@ impl<'a> System<'a> for Sys {
), ),
read_data.combos.maybe(), read_data.combos.maybe(),
) )
.join() .lend_join();
{ join.for_each(|comps| {
let (
entity,
uid,
mut char_state,
character_activity,
pos,
vel,
ori,
mass,
density,
energy,
inventory,
controller,
health,
body,
(physics, scale, stat, skill_set, active_abilities, is_rider),
combo,
) = comps;
// Being dead overrides all other states // Being dead overrides all other states
if health.map_or(false, |h| h.is_dead) { if health.map_or(false, |h| h.is_dead) {
// Do nothing // Do nothing
continue; return;
} }
// Enter stunned state if poise damage is enough // Enter stunned state if poise damage is enough
@ -230,7 +231,7 @@ impl<'a> System<'a> for Sys {
if is_rider.is_some() && !join_struct.char_state.can_perform_mounted() { if is_rider.is_some() && !join_struct.char_state.can_perform_mounted() {
// TODO: A better way to swap between mount inputs and rider inputs // TODO: A better way to swap between mount inputs and rider inputs
*join_struct.char_state = CharacterState::Idle(idle::Data::default()); *join_struct.char_state = CharacterState::Idle(idle::Data::default());
continue; return;
} }
let j = JoinData::new( let j = JoinData::new(
@ -244,7 +245,7 @@ impl<'a> System<'a> for Sys {
let state_update = j.character.behavior(&j, &mut output_events); let state_update = j.character.behavior(&j, &mut output_events);
Self::publish_state_update(&mut join_struct, state_update, &mut output_events); Self::publish_state_update(&mut join_struct, state_update, &mut output_events);
} });
local_emitter.append_vec(local_events); local_emitter.append_vec(local_events);
server_emitter.append_vec(server_events); server_emitter.append_vec(server_events);

View File

@ -18,7 +18,7 @@ use common::{
use common_ecs::{Job, Origin, Phase, System}; use common_ecs::{Job, Origin, Phase, System};
use itertools::Itertools; use itertools::Itertools;
use specs::{ use specs::{
shred::ResourceId, Entities, Join, Read, ReadExpect, ReadStorage, SystemData, World, shred::ResourceId, Entities, Join, LendJoin, Read, ReadExpect, ReadStorage, SystemData, World,
WriteStorage, WriteStorage,
}; };
use vek::*; use vek::*;

View File

@ -6,7 +6,7 @@ use common::{
uid::IdMaps, uid::IdMaps,
}; };
use common_ecs::{Job, Origin, Phase, System}; use common_ecs::{Job, Origin, Phase, System};
use specs::{Entities, Join, Read, ReadExpect, ReadStorage, WriteStorage}; use specs::{Entities, Join, LendJoin, Read, ReadExpect, ReadStorage, WriteStorage};
use tracing::error; use tracing::error;
use vek::*; use vek::*;

View File

@ -23,8 +23,8 @@ use common_ecs::{Job, Origin, ParMode, Phase, PhysicsMetrics, System};
use rayon::iter::ParallelIterator; use rayon::iter::ParallelIterator;
use specs::{ use specs::{
shred::{ResourceId, World}, shred::{ResourceId, World},
Entities, Entity, Join, ParJoin, Read, ReadExpect, ReadStorage, SystemData, Write, WriteExpect, Entities, Entity, Join, LendJoin, ParJoin, Read, ReadExpect, ReadStorage, SystemData, Write,
WriteStorage, WriteExpect, WriteStorage,
}; };
use std::ops::Range; use std::ops::Range;
use vek::*; use vek::*;

View File

@ -15,7 +15,7 @@ use common::{
use common_ecs::{Job, Origin, Phase, System}; use common_ecs::{Job, Origin, Phase, System};
use rand::Rng; use rand::Rng;
use specs::{ use specs::{
shred::ResourceId, Entities, Join, Read, ReadStorage, SystemData, World, WriteStorage, shred::ResourceId, Entities, Join, LendJoin, Read, ReadStorage, SystemData, World, WriteStorage,
}; };
use vek::*; use vek::*;
@ -264,7 +264,7 @@ impl<'a> System<'a> for Sys {
// Set start time on new shockwaves // Set start time on new shockwaves
// This change doesn't need to be recorded as it is not sent to the client // This change doesn't need to be recorded as it is not sent to the client
shockwaves.set_event_emission(false); shockwaves.set_event_emission(false);
(&mut shockwaves).join().for_each(|mut shockwave| { (&mut shockwaves).lend_join().for_each(|mut shockwave| {
if shockwave.creation.is_none() { if shockwave.creation.is_none() {
shockwave.creation = Some(time); shockwave.creation = Some(time);
} }

View File

@ -12,7 +12,7 @@ use common::{
}; };
use common_ecs::{Job, Origin, Phase, System}; use common_ecs::{Job, Origin, Phase, System};
use specs::{ use specs::{
shred::ResourceId, Entities, Join, Read, ReadExpect, ReadStorage, SystemData, World, Write, shred::ResourceId, Entities, LendJoin, Read, ReadExpect, ReadStorage, SystemData, World, Write,
WriteStorage, WriteStorage,
}; };
@ -70,7 +70,7 @@ impl<'a> System<'a> for Sys {
let dt = read_data.dt.0; let dt = read_data.dt.0;
// Update stats // Update stats
for (entity, stats, mut health, pos, mut energy, inventory) in ( let join = (
&read_data.entities, &read_data.entities,
&stats, &stats,
&mut healths, &mut healths,
@ -78,8 +78,8 @@ impl<'a> System<'a> for Sys {
&mut energies, &mut energies,
read_data.inventories.maybe(), read_data.inventories.maybe(),
) )
.join() .lend_join();
{ join.for_each(|(entity, stats, mut health, pos, mut energy, inventory)| {
let set_dead = { health.should_die() && !health.is_dead }; let set_dead = { health.should_die() && !health.is_dead };
if set_dead { if set_dead {
@ -112,17 +112,17 @@ impl<'a> System<'a> for Sys {
// update to the client. // update to the client.
energy.update_internal_integer_maximum(new_max); energy.update_internal_integer_maximum(new_max);
} }
} });
// Apply effects from leveling skills // Apply effects from leveling skills
for (mut skill_set, mut health, mut energy, body) in ( let join = (
&mut skill_sets, &mut skill_sets,
&mut healths, &mut healths,
&mut energies, &mut energies,
&read_data.bodies, &read_data.bodies,
) )
.join() .lend_join();
{ join.for_each(|(mut skill_set, mut health, mut energy, body)| {
if skill_set.modify_health { if skill_set.modify_health {
let health_level = skill_set let health_level = skill_set
.skill_level(Skill::General(GeneralSkill::HealthIncrease)) .skill_level(Skill::General(GeneralSkill::HealthIncrease))
@ -137,12 +137,11 @@ impl<'a> System<'a> for Sys {
energy.update_max_energy(*body, energy_level); energy.update_max_energy(*body, energy_level);
skill_set.modify_energy = false; skill_set.modify_energy = false;
} }
} });
// Update energies and poises // Update energies and poises
for (character_state, mut energy, mut poise) in let join = (&read_data.char_states, &mut energies, &mut poises).lend_join();
(&read_data.char_states, &mut energies, &mut poises).join() join.for_each(|(character_state, mut energy, mut poise)| {
{
match character_state { match character_state {
// Sitting accelerates recharging energy the most // Sitting accelerates recharging energy the most
CharacterState::Sit => { CharacterState::Sit => {
@ -207,15 +206,17 @@ impl<'a> System<'a> for Sys {
| CharacterState::UseItem(_) | CharacterState::UseItem(_)
| CharacterState::SpriteInteract(_) => {}, | CharacterState::SpriteInteract(_) => {},
} }
} });
// Decay combo // Decay combo
for (_, mut combo) in (&read_data.entities, &mut combos).join() { (&read_data.entities, &mut combos)
if combo.counter() > 0 .lend_join()
&& read_data.time.0 - combo.last_increase() > comp::combo::COMBO_DECAY_START .for_each(|(_, mut combo)| {
{ if combo.counter() > 0
combo.reset(); && read_data.time.0 - combo.last_increase() > comp::combo::COMBO_DECAY_START
} {
} combo.reset();
}
});
} }
} }

View File

@ -59,7 +59,7 @@ use core::{cmp::Ordering, convert::TryFrom};
use hashbrown::{HashMap, HashSet}; use hashbrown::{HashMap, HashSet};
use humantime::Duration as HumanDuration; use humantime::Duration as HumanDuration;
use rand::{thread_rng, Rng}; use rand::{thread_rng, Rng};
use specs::{storage::StorageEntry, Builder, Entity as EcsEntity, Join, WorldExt}; use specs::{storage::StorageEntry, Builder, Entity as EcsEntity, Join, LendJoin, WorldExt};
use std::{fmt::Write, ops::DerefMut, str::FromStr, sync::Arc}; use std::{fmt::Write, ops::DerefMut, str::FromStr, sync::Arc};
use vek::*; use vek::*;
use wiring::{Circuit, Wire, WireNode, WiringAction, WiringActionEffect, WiringElement}; use wiring::{Circuit, Wire, WireNode, WiringAction, WiringActionEffect, WiringElement};

View File

@ -42,7 +42,7 @@ use common_net::{msg::ServerGeneral, sync::WorldSyncExt};
use common_state::{AreasContainer, BlockChange, NoDurabilityArea}; use common_state::{AreasContainer, BlockChange, NoDurabilityArea};
use hashbrown::HashSet; use hashbrown::HashSet;
use rand::Rng; use rand::Rng;
use specs::{join::Join, Builder, Entity as EcsEntity, Entity, WorldExt}; use specs::{Builder, Entity as EcsEntity, Entity, Join, LendJoin, WorldExt};
use std::{collections::HashMap, iter, sync::Arc, time::Duration}; use std::{collections::HashMap, iter, sync::Arc, time::Duration};
use tracing::{debug, error, warn}; use tracing::{debug, error, warn};
use vek::{Vec2, Vec3}; use vek::{Vec2, Vec3};

View File

@ -100,7 +100,7 @@ use persistence::{
}; };
use prometheus::Registry; use prometheus::Registry;
use prometheus_hyper::Server as PrometheusServer; use prometheus_hyper::Server as PrometheusServer;
use specs::{join::Join, Builder, Entity as EcsEntity, Entity, WorldExt}; use specs::{Builder, Entity as EcsEntity, Entity, Join, LendJoin, WorldExt};
use std::{ use std::{
i32, i32,
ops::{Deref, DerefMut}, ops::{Deref, DerefMut},

View File

@ -19,7 +19,7 @@ use rtsim::data::{
npc::{Profession, SimulationMode}, npc::{Profession, SimulationMode},
Npc, Sites, Npc, Sites,
}; };
use specs::{Entities, Join, Read, ReadExpect, ReadStorage, WriteExpect, WriteStorage}; use specs::{Entities, Join, LendJoin, Read, ReadExpect, ReadStorage, WriteExpect, WriteStorage};
use std::{sync::Arc, time::Duration}; use std::{sync::Arc, time::Duration};
use tracing::error; use tracing::error;
use world::site::settlement::trader_loadout; use world::site::settlement::trader_loadout;

View File

@ -19,7 +19,7 @@ use common_base::prof_span;
use common_ecs::{Job, Origin, ParMode, Phase, System}; use common_ecs::{Job, Origin, ParMode, Phase, System};
use rand::thread_rng; use rand::thread_rng;
use rayon::iter::ParallelIterator; use rayon::iter::ParallelIterator;
use specs::{Join, ParJoin, Read, WriteStorage}; use specs::{LendJoin, ParJoin, Read, WriteStorage};
/// This system will allow NPCs to modify their controller /// This system will allow NPCs to modify their controller
#[derive(Default)] #[derive(Default)]

View File

@ -16,7 +16,7 @@ use common::{
use common_ecs::{Job, Origin, Phase, System}; use common_ecs::{Job, Origin, Phase, System};
use common_net::{msg::ServerGeneral, sync::CompSyncPackage}; use common_net::{msg::ServerGeneral, sync::CompSyncPackage};
use itertools::Either; use itertools::Either;
use specs::{Entities, Join, Read, ReadExpect, ReadStorage, Write, WriteStorage}; use specs::{Entities, Join, LendJoin, Read, ReadExpect, ReadStorage, Write, WriteStorage};
use vek::*; use vek::*;
/// This system will send physics updates to the client /// This system will send physics updates to the client
@ -347,7 +347,8 @@ impl<'a> System<'a> for Sys {
} }
// Update the last physics components for each entity // Update the last physics components for each entity
for (_, &pos, vel, ori, last_pos, last_vel, last_ori) in (
(
&entities, &entities,
&positions, &positions,
velocities.maybe(), velocities.maybe(),
@ -356,12 +357,12 @@ impl<'a> System<'a> for Sys {
last_vel.entries(), last_vel.entries(),
last_ori.entries(), last_ori.entries(),
) )
.join() .lend_join()
{ .for_each(|(_, &pos, vel, ori, last_pos, last_vel, last_ori)| {
last_pos.replace(Last(pos)); last_pos.replace(Last(pos));
vel.and_then(|&v| last_vel.replace(Last(v))); vel.and_then(|&v| last_vel.replace(Last(v)));
ori.and_then(|&o| last_ori.replace(Last(o))); ori.and_then(|&o| last_ori.replace(Last(o)));
} });
// Handle entity deletion in regions that don't exist in RegionMap // Handle entity deletion in regions that don't exist in RegionMap
// (theoretically none) // (theoretically none)

View File

@ -8,7 +8,7 @@ use common::{
use common_ecs::{Job, Origin, Phase, System}; use common_ecs::{Job, Origin, Phase, System};
use common_net::msg::{ClientGeneral, ServerGeneral}; use common_net::msg::{ClientGeneral, ServerGeneral};
use rayon::prelude::*; use rayon::prelude::*;
use specs::{Entities, Join, ParJoin, Read, ReadStorage, WriteStorage}; use specs::{Entities, LendJoin, ParJoin, Read, ReadStorage, WriteStorage};
use tracing::{debug, error, warn}; use tracing::{debug, error, warn};
impl Sys { impl Sys {

View File

@ -19,7 +19,7 @@ use common_net::msg::{ClientGeneral, ServerGeneral};
use common_state::{AreasContainer, BlockChange, BuildArea}; use common_state::{AreasContainer, BlockChange, BuildArea};
use core::mem; use core::mem;
use rayon::prelude::*; use rayon::prelude::*;
use specs::{Entities, Join, Read, ReadExpect, ReadStorage, Write, WriteStorage}; use specs::{Entities, Join, LendJoin, Read, ReadExpect, ReadStorage, Write, WriteStorage};
use std::{borrow::Cow, time::Instant}; use std::{borrow::Cow, time::Instant};
use tracing::{debug, trace, warn}; use tracing::{debug, trace, warn};
use vek::*; use vek::*;

View File

@ -24,8 +24,8 @@ use itertools::Either;
use plugin_api::Health; use plugin_api::Health;
use rayon::prelude::*; use rayon::prelude::*;
use specs::{ use specs::{
shred::ResourceId, Entities, Join, ParJoin, Read, ReadExpect, ReadStorage, SystemData, World, shred::ResourceId, Entities, Join, LendJoin, ParJoin, Read, ReadExpect, ReadStorage,
WriteStorage, SystemData, World, WriteStorage,
}; };
use tracing::{debug, info, trace, warn}; use tracing::{debug, info, trace, warn};

View File

@ -12,7 +12,7 @@ use common::{
use common_ecs::{Job, Origin, ParMode, Phase, System}; use common_ecs::{Job, Origin, ParMode, Phase, System};
use common_net::msg::{ClientGeneral, ServerGeneral}; use common_net::msg::{ClientGeneral, ServerGeneral};
use rayon::prelude::*; use rayon::prelude::*;
use specs::{Entities, Join, Read, ReadExpect, ReadStorage, Write, WriteStorage}; use specs::{Entities, Join, LendJoin, Read, ReadExpect, ReadStorage, Write, WriteStorage};
use tracing::{debug, trace}; use tracing::{debug, trace};
/// This system will handle new messages from clients /// This system will handle new messages from clients

View File

@ -8,7 +8,7 @@ use common::{
CachedSpatialGrid, Damage, DamageKind, DamageSource, Explosion, RadiusEffect, CachedSpatialGrid, Damage, DamageKind, DamageSource, Explosion, RadiusEffect,
}; };
use common_ecs::{Job, Origin, Phase, System}; use common_ecs::{Job, Origin, Phase, System};
use specs::{Entities, Join, Read, ReadStorage}; use specs::{Entities, Join, LendJoin, Read, ReadStorage};
use vek::Rgb; use vek::Rgb;
/// This system is responsible for handling misc object behaviours /// This system is responsible for handling misc object behaviours
@ -195,7 +195,7 @@ impl<'a> System<'a> for Sys {
.in_circle_aabr(pos.0.xy(), TELEPORTER_RADIUS) .in_circle_aabr(pos.0.xy(), TELEPORTER_RADIUS)
.any(|entity| { .any(|entity| {
(&positions, &teleporting) (&positions, &teleporting)
.join() .lend_join()
.get(entity, &entities) .get(entity, &entities)
.map_or(false, |(teleporter_pos, _)| { .map_or(false, |(teleporter_pos, _)| {
pos.0.distance_squared(teleporter_pos.0) pos.0.distance_squared(teleporter_pos.0)

View File

@ -8,7 +8,7 @@ use common::{
uid::Uid, uid::Uid,
}; };
use common_ecs::{Job, Origin, Phase, System}; use common_ecs::{Job, Origin, Phase, System};
use specs::{Join, ReadStorage, Write, WriteExpect}; use specs::{Join, LendJoin, ReadStorage, Write, WriteExpect};
use tracing::error; use tracing::error;
#[derive(Default)] #[derive(Default)]

View File

@ -13,7 +13,8 @@ use common::{
use common_ecs::{Job, Origin, Phase, System}; use common_ecs::{Job, Origin, Phase, System};
use common_net::msg::ServerGeneral; use common_net::msg::ServerGeneral;
use specs::{ use specs::{
Entities, Join, Read, ReadExpect, ReadStorage, SystemData, World, WorldExt, WriteStorage, Entities, Join, LendJoin, Read, ReadExpect, ReadStorage, SystemData, World, WorldExt,
WriteStorage,
}; };
use tracing::{debug, error}; use tracing::{debug, error};
use vek::*; use vek::*;

View File

@ -8,7 +8,7 @@ use common::{
CachedSpatialGrid, CachedSpatialGrid,
}; };
use common_ecs::{Origin, Phase, System}; use common_ecs::{Origin, Phase, System};
use specs::{Entities, Join, Read, ReadStorage, WriteStorage}; use specs::{Entities, Join, LendJoin, Read, ReadStorage, WriteStorage};
use vek::Vec3; use vek::Vec3;
const MAX_AGGRO_DIST: f32 = 200.; // If an entity further than this is aggroed at a player, the portal will still work const MAX_AGGRO_DIST: f32 = 200.; // If an entity further than this is aggroed at a player, the portal will still work
@ -109,7 +109,7 @@ impl<'a> System<'a> for Sys {
.in_circle_aabr(position.0.xy(), PET_TELEPORT_RADIUS) .in_circle_aabr(position.0.xy(), PET_TELEPORT_RADIUS)
.filter_map(|entity| { .filter_map(|entity| {
(&entities, &positions, &alignments) (&entities, &positions, &alignments)
.join() .lend_join()
.get(entity, &entities) .get(entity, &entities)
}) })
.filter_map(|(nearby_entity, entity_position, alignment)| { .filter_map(|(nearby_entity, entity_position, alignment)| {

View File

@ -32,8 +32,8 @@ use core::cmp::Reverse;
use itertools::Itertools; use itertools::Itertools;
use rayon::{iter::Either, prelude::*}; use rayon::{iter::Either, prelude::*};
use specs::{ use specs::{
storage::GenericReadStorage, Entities, Entity, Join, ParJoin, Read, ReadExpect, ReadStorage, storage::GenericReadStorage, Entities, Entity, Join, LendJoin, ParJoin, Read, ReadExpect,
Write, WriteExpect, WriteStorage, ReadStorage, Write, WriteExpect, WriteStorage,
}; };
use std::sync::Arc; use std::sync::Arc;
use vek::*; use vek::*;

View File

@ -5,7 +5,7 @@ use common::{
}; };
use common_ecs::{Job, Origin, Phase, System}; use common_ecs::{Job, Origin, Phase, System};
use common_net::msg::{Notification, ServerGeneral}; use common_net::msg::{Notification, ServerGeneral};
use specs::{Entities, Join, Read, ReadStorage, WriteStorage}; use specs::{Entities, Join, LendJoin, Read, ReadStorage, WriteStorage};
/// Cooldown time (in seconds) for "Waypoint Saved" notifications /// Cooldown time (in seconds) for "Waypoint Saved" notifications
const NOTIFY_TIME: f64 = 10.0; const NOTIFY_TIME: f64 = 10.0;

View File

@ -8,8 +8,8 @@ use common_ecs::{Job, Origin, Phase, System};
use common_state::BlockChange; use common_state::BlockChange;
use hashbrown::HashMap; use hashbrown::HashMap;
use specs::{ use specs::{
join::Join, shred::ResourceId, Entities, Entity, Read, ReadStorage, SystemData, World, Write, shred::ResourceId, Entities, Entity, Join, LendJoin, Read, ReadStorage, SystemData, World,
WriteStorage, Write, WriteStorage,
}; };
#[derive(SystemData)] #[derive(SystemData)]
@ -106,7 +106,7 @@ impl<'a> System<'a> for Sys {
(&mut light_emitters).maybe(), (&mut light_emitters).maybe(),
read_data.pos.maybe(), read_data.pos.maybe(),
) )
.join() .lend_join()
.for_each( .for_each(
|(entity, wiring_element, physics_state, mut light_emitter, pos)| { |(entity, wiring_element, physics_state, mut light_emitter, pos)| {
wiring_element wiring_element

View File

@ -8,7 +8,7 @@ mod character_states;
mod experimental_shaders; mod experimental_shaders;
mod widgets; mod widgets;
use client::{Client, Join, World, WorldExt}; use client::{Client, Join, LendJoin, World, WorldExt};
use common::{ use common::{
cmd::ServerChatCommand, cmd::ServerChatCommand,
comp, comp,

View File

@ -19,7 +19,7 @@ use common::{
}; };
use common_state::State; use common_state::State;
use hashbrown::HashMap; use hashbrown::HashMap;
use specs::{Entity as EcsEntity, Join, WorldExt}; use specs::{Entity as EcsEntity, Join, LendJoin, WorldExt};
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};
#[derive(Clone)] #[derive(Clone)]

View File

@ -16,7 +16,7 @@ use common::{
}; };
use common_state::State; use common_state::State;
use hashbrown::HashMap; use hashbrown::HashMap;
use specs::{Entity as EcsEntity, Join, WorldExt}; use specs::{Entity as EcsEntity, Join, LendJoin, WorldExt};
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};
use vek::*; use vek::*;

View File

@ -130,7 +130,7 @@ use conrod_core::{
use hashbrown::{HashMap, HashSet}; use hashbrown::{HashMap, HashSet};
use i18n::Localization; use i18n::Localization;
use rand::Rng; use rand::Rng;
use specs::{Entity as EcsEntity, Join, WorldExt}; use specs::{Entity as EcsEntity, Join, LendJoin, WorldExt};
use std::{ use std::{
borrow::Cow, borrow::Cow,
cmp::Ordering, cmp::Ordering,

View File

@ -62,7 +62,7 @@ use core::{
}; };
use guillotiere::AtlasAllocator; use guillotiere::AtlasAllocator;
use hashbrown::HashMap; use hashbrown::HashMap;
use specs::{Entity as EcsEntity, Join, LazyUpdate, WorldExt}; use specs::{Entity as EcsEntity, Join, LazyUpdate, LendJoin, WorldExt};
use std::sync::Arc; use std::sync::Arc;
use treeculler::{BVol, BoundingSphere}; use treeculler::{BVol, BoundingSphere};
use vek::*; use vek::*;

View File

@ -42,7 +42,7 @@ use common_state::State;
use comp::item::Reagent; use comp::item::Reagent;
use hashbrown::HashMap; use hashbrown::HashMap;
use num::traits::{Float, FloatConst}; use num::traits::{Float, FloatConst};
use specs::{Entity as EcsEntity, Join, WorldExt}; use specs::{Entity as EcsEntity, Join, LendJoin, WorldExt};
use vek::*; use vek::*;
const ZOOM_CAP_PLAYER: f32 = 1000.0; const ZOOM_CAP_PLAYER: f32 = 1000.0;

View File

@ -26,7 +26,7 @@ use common::{
use common_base::span; use common_base::span;
use hashbrown::HashMap; use hashbrown::HashMap;
use rand::prelude::*; use rand::prelude::*;
use specs::{Join, WorldExt}; use specs::{Join, LendJoin, WorldExt};
use std::{ use std::{
f32::consts::{PI, TAU}, f32::consts::{PI, TAU},
time::Duration, time::Duration,

View File

@ -1,5 +1,5 @@
use ordered_float::OrderedFloat; use ordered_float::OrderedFloat;
use specs::{Join, ReadStorage, WorldExt}; use specs::{Join, LendJoin, ReadStorage, WorldExt};
use vek::*; use vek::*;
use super::{ use super::{
@ -228,7 +228,7 @@ pub(super) fn select_interactable(
is_riders.maybe(), is_riders.maybe(),
(stats.mask() | items.mask()).maybe(), (stats.mask() | items.mask()).maybe(),
) )
.join(); .lend_join();
let closest_interactable_entity = spacial_grid.0.in_circle_aabr(player_pos.xy(), MAX_PICKUP_RANGE) let closest_interactable_entity = spacial_grid.0.in_circle_aabr(player_pos.xy(), MAX_PICKUP_RANGE)
.filter(|&e| e != player_entity) // skip the player's entity .filter(|&e| e != player_entity) // skip the player's entity
@ -279,7 +279,7 @@ pub(super) fn select_interactable(
&ecs.read_storage::<comp::Collider>(), &ecs.read_storage::<comp::Collider>(),
); );
let mut volumes_data = volumes_data.join(); let mut volumes_data = volumes_data.lend_join();
let volumes = spacial_grid.0.in_circle_aabr(player_pos.xy(), search_dist) let volumes = spacial_grid.0.in_circle_aabr(player_pos.xy(), search_dist)
.filter(|&e| e != player_entity) // skip the player's entity .filter(|&e| e != player_entity) // skip the player's entity

View File

@ -7,7 +7,7 @@ use std::{cell::RefCell, collections::HashSet, rc::Rc, result::Result, time::Dur
#[cfg(not(target_os = "macos"))] #[cfg(not(target_os = "macos"))]
use mumble_link::SharedLink; use mumble_link::SharedLink;
use ordered_float::OrderedFloat; use ordered_float::OrderedFloat;
use specs::{Join, WorldExt}; use specs::{Join, LendJoin, WorldExt};
use tracing::{error, info}; use tracing::{error, info};
use vek::*; use vek::*;

View File

@ -1,4 +1,4 @@
use specs::{Join, WorldExt}; use specs::{Join, LendJoin, WorldExt};
use vek::*; use vek::*;
use client::{self, Client}; use client::{self, Client};