#[macro_export]
macro_rules! synced_components {
($macro:ident) => {
$macro! {
body: Body,
hardcore: Hardcore,
stats: Stats,
buffs: Buffs,
auras: Auras,
energy: Energy,
health: Health,
heads: Heads,
poise: Poise,
light_emitter: LightEmitter,
loot_owner: LootOwner,
item: PickupItem,
scale: Scale,
group: Group,
is_mount: IsMount,
is_rider: IsRider,
is_volume_rider: IsVolumeRider,
volume_riders: VolumeRiders,
is_leader: IsLeader,
is_follower: IsFollower,
mass: Mass,
density: Density,
collider: Collider,
sticky: Sticky,
immovable: Immovable,
character_state: CharacterState,
character_activity: CharacterActivity,
shockwave: Shockwave,
beam: Beam,
alignment: Alignment,
stance: Stance,
object: Object,
inventory: Inventory,
skill_set: SkillSet,
admin: Admin,
combo: Combo,
active_abilities: ActiveAbilities,
can_build: CanBuild,
is_interactor: IsInteractor,
interactors: Interactors,
}
};
}
macro_rules! reexport_comps {
($($name:ident: $type:ident,)*) => {
mod inner {
pub use common::comp::*;
pub use body::parts::Heads;
pub use common::{interaction::Interactors, mounting::VolumeRiders};
use common::link::Is;
use common::{
mounting::{Mount, Rider, VolumeRider},
tether::{Leader, Follower},
interaction::{Interactor},
};
pub type IsMount = Is<Mount>;
pub type IsRider = Is<Rider>;
pub type IsVolumeRider = Is<VolumeRider>;
pub type IsLeader = Is<Leader>;
pub type IsFollower = Is<Follower>;
pub type IsInteractor = Is<Interactor>;
}
$(pub use inner::$type;)*
}
}
synced_components!(reexport_comps);
use crate::sync::{NetSync, SyncFrom};
impl NetSync for Body {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
}
impl NetSync for Hardcore {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
}
impl NetSync for Stats {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
}
impl NetSync for Buffs {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
}
impl NetSync for Auras {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
}
impl NetSync for Energy {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
}
impl NetSync for Health {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
fn pre_insert(&mut self, world: &specs::World) {
use common::resources::Time;
use specs::WorldExt;
self.last_change.time = *world.read_resource::<Time>();
}
fn pre_modify(&mut self, world: &specs::World) {
use common::resources::Time;
use specs::WorldExt;
self.last_change.time = *world.read_resource::<Time>();
}
}
impl NetSync for Heads {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
}
impl NetSync for Poise {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
}
impl NetSync for LightEmitter {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
}
impl NetSync for LootOwner {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
}
impl NetSync for PickupItem {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
}
impl NetSync for Scale {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
}
impl NetSync for Group {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
}
impl NetSync for IsMount {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
}
impl NetSync for IsRider {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
}
impl NetSync for IsVolumeRider {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
}
impl NetSync for VolumeRiders {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
}
impl NetSync for IsLeader {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
}
impl NetSync for IsFollower {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
}
impl NetSync for Mass {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
}
impl NetSync for Density {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
}
impl NetSync for Collider {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
}
impl NetSync for Sticky {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
}
impl NetSync for Immovable {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
}
impl NetSync for CharacterState {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
}
impl NetSync for CharacterActivity {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
}
impl NetSync for Shockwave {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
}
impl NetSync for Beam {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
}
impl NetSync for Alignment {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
}
impl NetSync for Inventory {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
}
impl NetSync for SkillSet {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
}
impl NetSync for Stance {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
}
impl NetSync for Object {
const SYNC_FROM: SyncFrom = SyncFrom::AnyEntity;
}
impl NetSync for Admin {
const SYNC_FROM: SyncFrom = SyncFrom::ClientEntity;
}
impl NetSync for Combo {
const SYNC_FROM: SyncFrom = SyncFrom::ClientEntity;
}
impl NetSync for ActiveAbilities {
const SYNC_FROM: SyncFrom = SyncFrom::ClientEntity;
}
impl NetSync for CanBuild {
const SYNC_FROM: SyncFrom = SyncFrom::ClientEntity;
}
impl NetSync for IsInteractor {
const SYNC_FROM: SyncFrom = SyncFrom::ClientEntity;
}
impl NetSync for Interactors {
const SYNC_FROM: SyncFrom = SyncFrom::ClientEntity;
}