mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Some random changes and a fmt
This commit is contained in:
@ -47,7 +47,7 @@ use common::{
|
|||||||
TerrainGrid,
|
TerrainGrid,
|
||||||
},
|
},
|
||||||
trade::{PendingTrade, SitePrices, TradeAction, TradeId, TradeResult},
|
trade::{PendingTrade, SitePrices, TradeAction, TradeId, TradeResult},
|
||||||
uid::{Uid, IdMaps},
|
uid::{IdMaps, Uid},
|
||||||
vol::RectVolSize,
|
vol::RectVolSize,
|
||||||
weather::{Weather, WeatherGrid},
|
weather::{Weather, WeatherGrid},
|
||||||
};
|
};
|
||||||
|
@ -7,7 +7,7 @@ mod sync_ext;
|
|||||||
mod track;
|
mod track;
|
||||||
|
|
||||||
// Reexports
|
// Reexports
|
||||||
pub use common::uid::{Uid, IdMaps};
|
pub use common::uid::{IdMaps, Uid};
|
||||||
pub use net_sync::{NetSync, SyncFrom};
|
pub use net_sync::{NetSync, SyncFrom};
|
||||||
pub use packet::{
|
pub use packet::{
|
||||||
handle_insert, handle_interp_insert, handle_interp_modify, handle_interp_remove, handle_modify,
|
handle_insert, handle_interp_insert, handle_interp_modify, handle_interp_remove, handle_modify,
|
||||||
|
@ -19,7 +19,7 @@ use crate::{
|
|||||||
outcome::Outcome,
|
outcome::Outcome,
|
||||||
resources::Secs,
|
resources::Secs,
|
||||||
states::utils::StageSection,
|
states::utils::StageSection,
|
||||||
uid::{Uid, IdMaps},
|
uid::{IdMaps, Uid},
|
||||||
util::Dir,
|
util::Dir,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -147,7 +147,8 @@ mod not_wasm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Only used on the client (server solely uses `Self::allocate` to
|
/// Only used on the client (server solely uses `Self::allocate` to
|
||||||
/// allocate and add Uid mappings).
|
/// allocate and add Uid mappings and `Self::remap` to move the `Uid` to
|
||||||
|
/// a different entity).
|
||||||
pub fn add_entity(&mut self, uid: Uid, entity: Entity) {
|
pub fn add_entity(&mut self, uid: Uid, entity: Entity) {
|
||||||
Self::insert(&mut self.uid_mapping, uid, entity);
|
Self::insert(&mut self.uid_mapping, uid, entity);
|
||||||
}
|
}
|
||||||
@ -171,6 +172,18 @@ mod not_wasm {
|
|||||||
uid
|
uid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Links an existing `Uid` to a new entity.
|
||||||
|
///
|
||||||
|
/// Only used on the server.
|
||||||
|
///
|
||||||
|
/// Used for `handle_exit_ingame` which moves the same `Uid` to a new
|
||||||
|
/// entity.
|
||||||
|
pub fn remap_entity(&mut self, uid: Uid, new_entity: Entity) {
|
||||||
|
if self.uid_mapping.insert(uid, new_entity).is_none() {
|
||||||
|
error!("Uid {uid:?} remaped but there was no existing entry for it!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cold]
|
#[cold]
|
||||||
#[inline(never)]
|
#[inline(never)]
|
||||||
fn already_present<ID>() {
|
fn already_present<ID>() {
|
||||||
|
@ -8,7 +8,7 @@ use wasmer::{Function, Memory, Value};
|
|||||||
|
|
||||||
use common::{
|
use common::{
|
||||||
comp::{Health, Player},
|
comp::{Health, Player},
|
||||||
uid::{Uid, IdMaps},
|
uid::{IdMaps, Uid},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::errors::{MemoryAllocationError, PluginModuleError};
|
use super::errors::{MemoryAllocationError, PluginModuleError};
|
||||||
|
@ -238,13 +238,12 @@ fn retrieve_action(
|
|||||||
EcsAccessError::EcsPointerNotAvailable,
|
EcsAccessError::EcsPointerNotAvailable,
|
||||||
))?
|
))?
|
||||||
};
|
};
|
||||||
let player =
|
let player = world
|
||||||
world
|
.id_maps
|
||||||
.id_maps
|
.uid_entity(e)
|
||||||
.uid_entity(e)
|
.ok_or(RetrieveError::EcsAccessError(
|
||||||
.ok_or(RetrieveError::EcsAccessError(
|
EcsAccessError::EcsEntityNotFound(e),
|
||||||
EcsAccessError::EcsEntityNotFound(e),
|
))?;
|
||||||
))?;
|
|
||||||
|
|
||||||
Ok(RetrieveResult::GetPlayerName(
|
Ok(RetrieveResult::GetPlayerName(
|
||||||
world
|
world
|
||||||
@ -267,13 +266,12 @@ fn retrieve_action(
|
|||||||
EcsAccessError::EcsPointerNotAvailable,
|
EcsAccessError::EcsPointerNotAvailable,
|
||||||
))?
|
))?
|
||||||
};
|
};
|
||||||
let player =
|
let player = world
|
||||||
world
|
.id_maps
|
||||||
.id_maps
|
.uid_entity(e)
|
||||||
.uid_entity(e)
|
.ok_or(RetrieveError::EcsAccessError(
|
||||||
.ok_or(RetrieveError::EcsAccessError(
|
EcsAccessError::EcsEntityNotFound(e),
|
||||||
EcsAccessError::EcsEntityNotFound(e),
|
))?;
|
||||||
))?;
|
|
||||||
Ok(RetrieveResult::GetEntityHealth(
|
Ok(RetrieveResult::GetEntityHealth(
|
||||||
world
|
world
|
||||||
.health
|
.health
|
||||||
|
@ -8,7 +8,7 @@ use common::{
|
|||||||
},
|
},
|
||||||
event::{Emitter, EventBus, ServerEvent},
|
event::{Emitter, EventBus, ServerEvent},
|
||||||
resources::Time,
|
resources::Time,
|
||||||
uid::{Uid, IdMaps},
|
uid::{IdMaps, Uid},
|
||||||
};
|
};
|
||||||
use common_ecs::{Job, Origin, Phase, System};
|
use common_ecs::{Job, Origin, Phase, System};
|
||||||
use specs::{
|
use specs::{
|
||||||
|
@ -9,7 +9,7 @@ use common::{
|
|||||||
outcome::Outcome,
|
outcome::Outcome,
|
||||||
resources::{DeltaTime, Time},
|
resources::{DeltaTime, Time},
|
||||||
terrain::TerrainGrid,
|
terrain::TerrainGrid,
|
||||||
uid::{Uid, IdMaps},
|
uid::{IdMaps, Uid},
|
||||||
vol::ReadVol,
|
vol::ReadVol,
|
||||||
GroupTarget,
|
GroupTarget,
|
||||||
};
|
};
|
||||||
|
@ -15,7 +15,7 @@ use common::{
|
|||||||
event::{Emitter, EventBus, ServerEvent},
|
event::{Emitter, EventBus, ServerEvent},
|
||||||
resources::{DeltaTime, Secs, Time},
|
resources::{DeltaTime, Secs, Time},
|
||||||
terrain::SpriteKind,
|
terrain::SpriteKind,
|
||||||
uid::{Uid, IdMaps},
|
uid::{IdMaps, Uid},
|
||||||
Damage, DamageSource,
|
Damage, DamageSource,
|
||||||
};
|
};
|
||||||
use common_base::prof_span;
|
use common_base::prof_span;
|
||||||
@ -275,27 +275,26 @@ impl<'a> System<'a> for Sys {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.for_each(|(buff_id, buff, uid, aura_key)| {
|
.for_each(|(buff_id, buff, uid, aura_key)| {
|
||||||
let replace =
|
let replace = if let Some(aura_entity) = read_data.id_maps.uid_entity(*uid) {
|
||||||
if let Some(aura_entity) = read_data.id_maps.uid_entity(*uid) {
|
if let Some(aura) = read_data
|
||||||
if let Some(aura) = read_data
|
.auras
|
||||||
.auras
|
.get(aura_entity)
|
||||||
.get(aura_entity)
|
.and_then(|auras| auras.auras.get(*aura_key))
|
||||||
.and_then(|auras| auras.auras.get(*aura_key))
|
{
|
||||||
{
|
if let (Some(pos), Some(aura_pos)) = (
|
||||||
if let (Some(pos), Some(aura_pos)) = (
|
read_data.positions.get(entity),
|
||||||
read_data.positions.get(entity),
|
read_data.positions.get(aura_entity),
|
||||||
read_data.positions.get(aura_entity),
|
) {
|
||||||
) {
|
pos.0.distance_squared(aura_pos.0) > aura.radius.powi(2)
|
||||||
pos.0.distance_squared(aura_pos.0) > aura.radius.powi(2)
|
|
||||||
} else {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
true
|
true
|
||||||
};
|
}
|
||||||
|
} else {
|
||||||
|
true
|
||||||
|
};
|
||||||
if replace {
|
if replace {
|
||||||
expired_buffs.push(*buff_id);
|
expired_buffs.push(*buff_id);
|
||||||
server_emitter.emit(ServerEvent::Buff {
|
server_emitter.emit(ServerEvent::Buff {
|
||||||
|
@ -10,7 +10,7 @@ use common::{
|
|||||||
outcome::Outcome,
|
outcome::Outcome,
|
||||||
resources::Time,
|
resources::Time,
|
||||||
terrain::TerrainGrid,
|
terrain::TerrainGrid,
|
||||||
uid::{Uid, IdMaps},
|
uid::{IdMaps, Uid},
|
||||||
util::{find_dist::Cylinder, Dir},
|
util::{find_dist::Cylinder, Dir},
|
||||||
vol::ReadVol,
|
vol::ReadVol,
|
||||||
GroupTarget,
|
GroupTarget,
|
||||||
|
@ -8,7 +8,7 @@ use common::{
|
|||||||
event::{Emitter, EventBus, ServerEvent},
|
event::{Emitter, EventBus, ServerEvent},
|
||||||
outcome::Outcome,
|
outcome::Outcome,
|
||||||
resources::{DeltaTime, Time},
|
resources::{DeltaTime, Time},
|
||||||
uid::{Uid, IdMaps},
|
uid::{IdMaps, Uid},
|
||||||
util::Dir,
|
util::Dir,
|
||||||
GroupTarget,
|
GroupTarget,
|
||||||
};
|
};
|
||||||
|
@ -8,7 +8,7 @@ use common::{
|
|||||||
event::{EventBus, ServerEvent},
|
event::{EventBus, ServerEvent},
|
||||||
outcome::Outcome,
|
outcome::Outcome,
|
||||||
resources::{DeltaTime, Time},
|
resources::{DeltaTime, Time},
|
||||||
uid::{Uid, IdMaps},
|
uid::{IdMaps, Uid},
|
||||||
util::Dir,
|
util::Dir,
|
||||||
GroupTarget,
|
GroupTarget,
|
||||||
};
|
};
|
||||||
|
@ -21,7 +21,7 @@ use common::{
|
|||||||
rtsim::{Actor, RtSimEntity},
|
rtsim::{Actor, RtSimEntity},
|
||||||
states::utils::{ForcedMovement, StageSection},
|
states::utils::{ForcedMovement, StageSection},
|
||||||
terrain::TerrainGrid,
|
terrain::TerrainGrid,
|
||||||
uid::{Uid, IdMaps},
|
uid::{IdMaps, Uid},
|
||||||
};
|
};
|
||||||
use specs::{
|
use specs::{
|
||||||
shred::ResourceId, Entities, Entity as EcsEntity, Join, Read, ReadExpect, ReadStorage,
|
shred::ResourceId, Entities, Entity as EcsEntity, Join, Read, ReadExpect, ReadStorage,
|
||||||
|
@ -47,7 +47,7 @@ use common::{
|
|||||||
resources::{BattleMode, PlayerPhysicsSettings, Secs, Time, TimeOfDay, TimeScale},
|
resources::{BattleMode, PlayerPhysicsSettings, Secs, Time, TimeOfDay, TimeScale},
|
||||||
rtsim::{Actor, Role},
|
rtsim::{Actor, Role},
|
||||||
terrain::{Block, BlockKind, CoordinateConversions, SpriteKind, TerrainChunkSize},
|
terrain::{Block, BlockKind, CoordinateConversions, SpriteKind, TerrainChunkSize},
|
||||||
uid::{Uid, IdMaps},
|
uid::{IdMaps, Uid},
|
||||||
vol::ReadVol,
|
vol::ReadVol,
|
||||||
weather, Damage, DamageKind, DamageSource, Explosion, LoadoutBuilder, RadiusEffect,
|
weather, Damage, DamageKind, DamageSource, Explosion, LoadoutBuilder, RadiusEffect,
|
||||||
};
|
};
|
||||||
|
@ -32,7 +32,7 @@ use common::{
|
|||||||
states::utils::StageSection,
|
states::utils::StageSection,
|
||||||
terrain::{Block, BlockKind, TerrainGrid},
|
terrain::{Block, BlockKind, TerrainGrid},
|
||||||
trade::{TradeResult, Trades},
|
trade::{TradeResult, Trades},
|
||||||
uid::{Uid, IdMaps},
|
uid::{IdMaps, Uid},
|
||||||
util::Dir,
|
util::Dir,
|
||||||
vol::ReadVol,
|
vol::ReadVol,
|
||||||
Damage, DamageKind, DamageSource, Explosion, GroupTarget, RadiusEffect,
|
Damage, DamageKind, DamageSource, Explosion, GroupTarget, RadiusEffect,
|
||||||
@ -1040,13 +1040,8 @@ pub fn handle_explosion(server: &Server, pos: Vec3<f32>, explosion: Explosion, o
|
|||||||
.and_then(|cs| cs.attack_immunities())
|
.and_then(|cs| cs.attack_immunities())
|
||||||
.map_or(false, |i| i.explosions);
|
.map_or(false, |i| i.explosions);
|
||||||
// PvP check
|
// PvP check
|
||||||
let may_harm = combat::may_harm(
|
let may_harm =
|
||||||
alignments,
|
combat::may_harm(alignments, players, id_maps, owner_entity, entity_b);
|
||||||
players,
|
|
||||||
id_maps,
|
|
||||||
owner_entity,
|
|
||||||
entity_b,
|
|
||||||
);
|
|
||||||
let attack_options = combat::AttackOptions {
|
let attack_options = combat::AttackOptions {
|
||||||
target_dodging,
|
target_dodging,
|
||||||
may_harm,
|
may_harm,
|
||||||
|
@ -305,7 +305,7 @@ pub fn handle_group(server: &mut Server, entity: Entity, manip: GroupManip) {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
// Tell the old leader that the transfer was succesful
|
// Tell the old leader that the transfer was succesful
|
||||||
if let Some(client) = clients.get(target) {
|
if let Some(client) = clients.get(entity) {
|
||||||
client.send_fallible(ServerGeneral::server_msg(
|
client.send_fallible(ServerGeneral::server_msg(
|
||||||
ChatType::Meta,
|
ChatType::Meta,
|
||||||
"You are no longer the group leader.",
|
"You are no longer the group leader.",
|
||||||
|
@ -8,7 +8,7 @@ use common::{
|
|||||||
comp,
|
comp,
|
||||||
comp::{group, pet::is_tameable, Presence, PresenceKind},
|
comp::{group, pet::is_tameable, Presence, PresenceKind},
|
||||||
resources::Time,
|
resources::Time,
|
||||||
uid::{Uid, IdMaps},
|
uid::{IdMaps, Uid},
|
||||||
};
|
};
|
||||||
use common_base::span;
|
use common_base::span;
|
||||||
use common_net::msg::{PlayerListUpdate, ServerGeneral};
|
use common_net::msg::{PlayerListUpdate, ServerGeneral};
|
||||||
@ -61,6 +61,10 @@ pub fn handle_exit_ingame(server: &mut Server, entity: EcsEntity, skip_persisten
|
|||||||
//
|
//
|
||||||
// Easier than checking and removing all other known components.
|
// Easier than checking and removing all other known components.
|
||||||
//
|
//
|
||||||
|
// Also, allows clients to not update their Uid based references to this
|
||||||
|
// client (e.g. for this specific client's knowledge of its own Uid and for
|
||||||
|
// groups since exiting in-game does not affect group membership)
|
||||||
|
//
|
||||||
// Note: If other `ServerEvent`s are referring to this entity they will be
|
// Note: If other `ServerEvent`s are referring to this entity they will be
|
||||||
// disrupted.
|
// disrupted.
|
||||||
|
|
||||||
@ -89,30 +93,24 @@ pub fn handle_exit_ingame(server: &mut Server, entity: EcsEntity, skip_persisten
|
|||||||
// Tell client its request was successful
|
// Tell client its request was successful
|
||||||
client.send_fallible(ServerGeneral::ExitInGameSuccess);
|
client.send_fallible(ServerGeneral::ExitInGameSuccess);
|
||||||
|
|
||||||
let entity_builder = state.ecs_mut().create_entity().with(client).with(player);
|
let new_entity = state
|
||||||
|
.ecs_mut()
|
||||||
// Preserve group component if present
|
.create_entity()
|
||||||
let entity_builder = match maybe_group {
|
.with(client)
|
||||||
Some(group) => entity_builder.with(group),
|
.with(player)
|
||||||
None => entity_builder,
|
// Preserve group component if present
|
||||||
};
|
.maybe_with(maybe_group)
|
||||||
|
// Preserve admin component if present
|
||||||
// Preserve admin component if present
|
.maybe_with(maybe_admin)
|
||||||
let entity_builder = match maybe_admin {
|
.with(uid)
|
||||||
Some(admin) => entity_builder.with(admin),
|
.build();
|
||||||
None => entity_builder,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Ensure IdMaps maps this uid to the new entity
|
// Ensure IdMaps maps this uid to the new entity
|
||||||
let uid = entity_builder
|
ecs.write_resource::<IdMaps>().remap_entity(uid, new_entity);
|
||||||
.world
|
|
||||||
.write_resource::<IdMaps>()
|
|
||||||
.allocate(entity_builder.entity, Some(uid.into()));
|
|
||||||
let new_entity = entity_builder.with(uid).build();
|
|
||||||
|
|
||||||
// Note, since the Uid has been removed from the old entity, that prevents
|
// Note, since the Uid has been removed from the old entity and the
|
||||||
// `delete_entity_recorded` from making any changes to the group (TODO double check this
|
// Group component will be removed below, that prevents
|
||||||
// logic)
|
// `delete_entity_recorded` from making any changes to the group.
|
||||||
if let Some(group) = maybe_group {
|
if let Some(group) = maybe_group {
|
||||||
let mut group_manager = state.ecs().write_resource::<group::GroupManager>();
|
let mut group_manager = state.ecs().write_resource::<group::GroupManager>();
|
||||||
if group_manager
|
if group_manager
|
||||||
@ -131,10 +129,10 @@ pub fn handle_exit_ingame(server: &mut Server, entity: EcsEntity, skip_persisten
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// Erase group component to avoid group restructure when deleting the entity
|
|
||||||
state.ecs().write_storage::<group::Group>().remove(entity);
|
|
||||||
|
|
||||||
|
// Erase group component to avoid group restructure when deleting the entity
|
||||||
|
state.ecs().write_storage::<group::Group>().remove(entity);
|
||||||
|
}
|
||||||
// Delete old entity
|
// Delete old entity
|
||||||
if let Err(e) = state.delete_entity_recorded(entity) {
|
if let Err(e) = state.delete_entity_recorded(entity) {
|
||||||
error!(
|
error!(
|
||||||
|
@ -1212,7 +1212,11 @@ impl StateExt for State {
|
|||||||
if res.is_ok() {
|
if res.is_ok() {
|
||||||
if let (Some(uid), Some(pos)) = (maybe_uid, maybe_pos) {
|
if let (Some(uid), Some(pos)) = (maybe_uid, maybe_pos) {
|
||||||
// TODO: exit_ingame for player doesn't hit this path since Uid is removed, not
|
// TODO: exit_ingame for player doesn't hit this path since Uid is removed, not
|
||||||
// sure if that is correct.
|
// sure if that is correct. However, we don't want recording the UID in deleted
|
||||||
|
// entities to end up overwriting the rejoined client with that UID...
|
||||||
|
//
|
||||||
|
// What is the difference between leaving a region and the deleted entities
|
||||||
|
// list?
|
||||||
if let Some(region_key) = self
|
if let Some(region_key) = self
|
||||||
.ecs()
|
.ecs()
|
||||||
.read_resource::<common::region::RegionMap>()
|
.read_resource::<common::region::RegionMap>()
|
||||||
|
@ -191,6 +191,8 @@ impl<'a> System<'a> for Sys {
|
|||||||
.map(|key| !regions.contains(key))
|
.map(|key| !regions.contains(key))
|
||||||
.unwrap_or(true)
|
.unwrap_or(true)
|
||||||
{
|
{
|
||||||
|
// TODO: I suspect it would be more efficient (in terms of
|
||||||
|
// bandwidth) to batch messages like this.
|
||||||
client.send_fallible(ServerGeneral::DeleteEntity(uid));
|
client.send_fallible(ServerGeneral::DeleteEntity(uid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ use common::{
|
|||||||
recipe::{default_component_recipe_book, default_recipe_book, default_repair_recipe_book},
|
recipe::{default_component_recipe_book, default_recipe_book, default_repair_recipe_book},
|
||||||
resources::TimeOfDay,
|
resources::TimeOfDay,
|
||||||
shared_server_config::ServerConstants,
|
shared_server_config::ServerConstants,
|
||||||
uid::{Uid, IdMaps},
|
uid::{IdMaps, Uid},
|
||||||
};
|
};
|
||||||
use common_base::prof_span;
|
use common_base::prof_span;
|
||||||
use common_ecs::{Job, Origin, Phase, System};
|
use common_ecs::{Job, Origin, Phase, System};
|
||||||
@ -54,7 +54,7 @@ pub struct ReadData<'a> {
|
|||||||
trackers: TrackedStorages<'a>,
|
trackers: TrackedStorages<'a>,
|
||||||
_healths: ReadStorage<'a, Health>, // used by plugin feature
|
_healths: ReadStorage<'a, Health>, // used by plugin feature
|
||||||
_plugin_mgr: ReadPlugin<'a>, // used by plugin feature
|
_plugin_mgr: ReadPlugin<'a>, // used by plugin feature
|
||||||
_id_maps: Read<'a, IdMaps>, // used by plugin feature
|
_id_maps: Read<'a, IdMaps>, // used by plugin feature
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This system will handle new messages from clients
|
/// This system will handle new messages from clients
|
||||||
|
@ -38,16 +38,14 @@ impl<'a> System<'a> for Sys {
|
|||||||
_ => None,
|
_ => None,
|
||||||
})
|
})
|
||||||
.filter_map(|(pet_entity, pet_pos, owner_uid)| {
|
.filter_map(|(pet_entity, pet_pos, owner_uid)| {
|
||||||
id_maps
|
id_maps.uid_entity(owner_uid).and_then(|owner_entity| {
|
||||||
.uid_entity(owner_uid)
|
match (positions.get(owner_entity), physics.get(owner_entity)) {
|
||||||
.and_then(|owner_entity| {
|
(Some(position), Some(physics)) => {
|
||||||
match (positions.get(owner_entity), physics.get(owner_entity)) {
|
Some((pet_entity, position, physics, pet_pos))
|
||||||
(Some(position), Some(physics)) => {
|
},
|
||||||
Some((pet_entity, position, physics, pet_pos))
|
_ => None,
|
||||||
},
|
}
|
||||||
_ => None,
|
})
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
.filter(|(_, owner_pos, owner_physics, pet_pos)| {
|
.filter(|(_, owner_pos, owner_physics, pet_pos)| {
|
||||||
// Don't teleport pets to the player if they're in the air, nobody wants
|
// Don't teleport pets to the player if they're in the air, nobody wants
|
||||||
|
@ -18,7 +18,7 @@ use common::{
|
|||||||
combat,
|
combat,
|
||||||
comp::{group::Role, inventory::item::MaterialStatManifest, invite::InviteKind, Stats},
|
comp::{group::Role, inventory::item::MaterialStatManifest, invite::InviteKind, Stats},
|
||||||
resources::Time,
|
resources::Time,
|
||||||
uid::{Uid, IdMaps},
|
uid::{IdMaps, Uid},
|
||||||
};
|
};
|
||||||
use common_net::sync::WorldSyncExt;
|
use common_net::sync::WorldSyncExt;
|
||||||
use conrod_core::{
|
use conrod_core::{
|
||||||
|
@ -287,9 +287,7 @@ impl ParticleMgr {
|
|||||||
if target.is_some() {
|
if target.is_some() {
|
||||||
let ecs = scene_data.state.ecs();
|
let ecs = scene_data.state.ecs();
|
||||||
if target
|
if target
|
||||||
.and_then(|target| {
|
.and_then(|target| ecs.read_resource::<IdMaps>().uid_entity(target))
|
||||||
ecs.read_resource::<IdMaps>().uid_entity(target)
|
|
||||||
})
|
|
||||||
.and_then(|entity| {
|
.and_then(|entity| {
|
||||||
ecs.read_storage::<Body>()
|
ecs.read_storage::<Body>()
|
||||||
.get(entity)
|
.get(entity)
|
||||||
|
Reference in New Issue
Block a user