mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
don't insert event busses on client
This commit is contained in:
parent
e651b9b2ac
commit
d75889ed75
@ -1982,13 +1982,6 @@ impl Client {
|
|||||||
&self.connected_server_constants,
|
&self.connected_server_constants,
|
||||||
|_, _| {},
|
|_, _| {},
|
||||||
);
|
);
|
||||||
// TODO: TODO
|
|
||||||
// TODO: avoid emitting these in the first place
|
|
||||||
// let _ = self
|
|
||||||
// .state
|
|
||||||
// .ecs()
|
|
||||||
// .fetch::<EventBus<common::event::ServerFrontendEvent>>()
|
|
||||||
// .recv_all();
|
|
||||||
|
|
||||||
// TODO: avoid emitting these in the first place OR actually use outcomes
|
// TODO: avoid emitting these in the first place OR actually use outcomes
|
||||||
// generated locally on the client (if they can be deduplicated from
|
// generated locally on the client (if they can be deduplicated from
|
||||||
|
@ -556,35 +556,35 @@ macro_rules! event_emitters {
|
|||||||
$(
|
$(
|
||||||
#[derive(specs::SystemData)]
|
#[derive(specs::SystemData)]
|
||||||
pub struct $read_data<'a> {
|
pub struct $read_data<'a> {
|
||||||
$($ev_ident: specs::Read<'a, $crate::event::EventBus<$ty>>),+
|
$($ev_ident: Option<specs::Read<'a, $crate::event::EventBus<$ty>>>),+
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> $read_data<'a> {
|
impl<'a> $read_data<'a> {
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
pub fn get_emitters(&self) -> $emitters {
|
pub fn get_emitters(&self) -> $emitters {
|
||||||
$emitters {
|
$emitters {
|
||||||
$($ev_ident: self.$ev_ident.emitter()),+
|
$($ev_ident: self.$ev_ident.as_ref().map(|e| e.emitter())),+
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct $emitters<'a> {
|
pub struct $emitters<'a> {
|
||||||
$($ev_ident: $crate::event::Emitter<'a, $ty>),+
|
$($ev_ident: Option<$crate::event::Emitter<'a, $ty>>),+
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> $emitters<'a> {
|
impl<'a> $emitters<'a> {
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
pub fn append(&mut self, mut other: Self) {
|
pub fn append(&mut self, mut other: Self) {
|
||||||
$(
|
$(
|
||||||
self.$ev_ident.append(&mut other.$ev_ident.events);
|
self.$ev_ident.as_mut().zip(other.$ev_ident).map(|(a, mut b)| a.append(&mut b.events));
|
||||||
)+
|
)+
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$(
|
$(
|
||||||
impl<'a> $crate::event::EmitExt<$ty> for $emitters<'a> {
|
impl<'a> $crate::event::EmitExt<$ty> for $emitters<'a> {
|
||||||
fn emit(&mut self, event: $ty) { self.$ev_ident.emit(event) }
|
fn emit(&mut self, event: $ty) { self.$ev_ident.as_mut().map(|e| e.emit(event)); }
|
||||||
fn emit_many(&mut self, events: impl IntoIterator<Item = $ty>) { self.$ev_ident.emit_many(events) }
|
fn emit_many(&mut self, events: impl IntoIterator<Item = $ty>) { self.$ev_ident.as_mut().map(|e| e.emit_many(events)); }
|
||||||
}
|
}
|
||||||
)+
|
)+
|
||||||
)+
|
)+
|
||||||
|
@ -8,7 +8,7 @@ use common::uid::IdMaps;
|
|||||||
use common::{
|
use common::{
|
||||||
calendar::Calendar,
|
calendar::Calendar,
|
||||||
comp,
|
comp,
|
||||||
event::{register_event_busses, EventBus, LocalEvent},
|
event::{EventBus, LocalEvent},
|
||||||
link::Is,
|
link::Is,
|
||||||
mounting::{Mount, Rider, VolumeRider, VolumeRiders},
|
mounting::{Mount, Rider, VolumeRider, VolumeRiders},
|
||||||
outcome::Outcome,
|
outcome::Outcome,
|
||||||
@ -331,7 +331,6 @@ impl State {
|
|||||||
ecs.insert(SlowJobPool::new(slow_limit, 10_000, thread_pool));
|
ecs.insert(SlowJobPool::new(slow_limit, 10_000, thread_pool));
|
||||||
|
|
||||||
// TODO: only register on the server
|
// TODO: only register on the server
|
||||||
register_event_busses(&mut ecs);
|
|
||||||
ecs.insert(comp::group::GroupManager::default());
|
ecs.insert(comp::group::GroupManager::default());
|
||||||
ecs.insert(SysMetrics::default());
|
ecs.insert(SysMetrics::default());
|
||||||
ecs.insert(PhysicsMetrics::default());
|
ecs.insert(PhysicsMetrics::default());
|
||||||
|
@ -7,7 +7,8 @@ use common::{
|
|||||||
PosVelOriDefer, PreviousPhysCache, Projectile, Scale, Stats, Sticky, Vel,
|
PosVelOriDefer, PreviousPhysCache, Projectile, Scale, Stats, Sticky, Vel,
|
||||||
},
|
},
|
||||||
consts::{AIR_DENSITY, FRIC_GROUND, GRAVITY},
|
consts::{AIR_DENSITY, FRIC_GROUND, GRAVITY},
|
||||||
event::{EventBus, LandOnGroundEvent},
|
event::{EmitExt, EventBus, LandOnGroundEvent},
|
||||||
|
event_emitters,
|
||||||
link::Is,
|
link::Is,
|
||||||
mounting::{Rider, VolumeRider},
|
mounting::{Rider, VolumeRider},
|
||||||
outcome::Outcome,
|
outcome::Outcome,
|
||||||
@ -123,6 +124,12 @@ fn calc_z_limit(char_state_maybe: Option<&CharacterState>, collider: &Collider)
|
|||||||
collider.get_z_limits(modifier)
|
collider.get_z_limits(modifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event_emitters! {
|
||||||
|
struct Events[Emitters] {
|
||||||
|
land_on_ground: LandOnGroundEvent,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// This system applies forces and calculates new positions and velocities.
|
/// This system applies forces and calculates new positions and velocities.
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct Sys;
|
pub struct Sys;
|
||||||
@ -130,10 +137,10 @@ pub struct Sys;
|
|||||||
#[derive(SystemData)]
|
#[derive(SystemData)]
|
||||||
pub struct PhysicsRead<'a> {
|
pub struct PhysicsRead<'a> {
|
||||||
entities: Entities<'a>,
|
entities: Entities<'a>,
|
||||||
|
events: Events<'a>,
|
||||||
uids: ReadStorage<'a, Uid>,
|
uids: ReadStorage<'a, Uid>,
|
||||||
terrain: ReadExpect<'a, TerrainGrid>,
|
terrain: ReadExpect<'a, TerrainGrid>,
|
||||||
dt: Read<'a, DeltaTime>,
|
dt: Read<'a, DeltaTime>,
|
||||||
land_on_ground_event: Read<'a, EventBus<LandOnGroundEvent>>,
|
|
||||||
game_mode: ReadExpect<'a, GameMode>,
|
game_mode: ReadExpect<'a, GameMode>,
|
||||||
scales: ReadStorage<'a, Scale>,
|
scales: ReadStorage<'a, Scale>,
|
||||||
stickies: ReadStorage<'a, Sticky>,
|
stickies: ReadStorage<'a, Sticky>,
|
||||||
@ -1364,16 +1371,16 @@ impl<'a> PhysicsData<'a> {
|
|||||||
}
|
}
|
||||||
drop(guard);
|
drop(guard);
|
||||||
|
|
||||||
let mut event_emitter = read.land_on_ground_event.emitter();
|
let mut emitters = read.events.get_emitters();
|
||||||
|
emitters.emit_many(
|
||||||
land_on_grounds
|
land_on_grounds
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.for_each(|(entity, vel, surface_normal)| {
|
.map(|(entity, vel, surface_normal)| LandOnGroundEvent {
|
||||||
event_emitter.emit(LandOnGroundEvent {
|
|
||||||
entity,
|
entity,
|
||||||
vel: vel.0,
|
vel: vel.0,
|
||||||
surface_normal,
|
surface_normal,
|
||||||
});
|
}),
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_cached_spatial_grid(&mut self) {
|
fn update_cached_spatial_grid(&mut self) {
|
||||||
|
@ -52,8 +52,8 @@ use common_state::{AreasContainer, BlockChange, NoDurabilityArea};
|
|||||||
use hashbrown::HashSet;
|
use hashbrown::HashSet;
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use specs::{
|
use specs::{
|
||||||
shred, DispatcherBuilder, Entities, Entity as EcsEntity, Entity, Join, LendJoin, ReadExpect,
|
shred, DispatcherBuilder, Entities, Entity as EcsEntity, Entity, Join, LendJoin, Read,
|
||||||
ReadStorage, SystemData, Write, WriteExpect, WriteStorage,
|
ReadExpect, ReadStorage, SystemData, Write, WriteExpect, WriteStorage,
|
||||||
};
|
};
|
||||||
use std::{collections::HashMap, iter, sync::Arc, time::Duration};
|
use std::{collections::HashMap, iter, sync::Arc, time::Duration};
|
||||||
use tracing::{debug, warn};
|
use tracing::{debug, warn};
|
||||||
@ -124,16 +124,16 @@ impl ServerEvent for PoiseChangeEvent {
|
|||||||
impl ServerEvent for HealthChangeEvent {
|
impl ServerEvent for HealthChangeEvent {
|
||||||
type SystemData<'a> = (
|
type SystemData<'a> = (
|
||||||
Entities<'a>,
|
Entities<'a>,
|
||||||
|
Read<'a, EventBus<Outcome>>,
|
||||||
ReadStorage<'a, Pos>,
|
ReadStorage<'a, Pos>,
|
||||||
ReadStorage<'a, Uid>,
|
ReadStorage<'a, Uid>,
|
||||||
WriteStorage<'a, Agent>,
|
WriteStorage<'a, Agent>,
|
||||||
WriteStorage<'a, Health>,
|
WriteStorage<'a, Health>,
|
||||||
WriteExpect<'a, EventBus<Outcome>>,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
fn handle(
|
fn handle(
|
||||||
events: impl ExactSizeIterator<Item = Self>,
|
events: impl ExactSizeIterator<Item = Self>,
|
||||||
(entities, positions, uids, mut agents, mut healths, outcomes): Self::SystemData<'_>,
|
(entities, outcomes, positions, uids, mut agents, mut healths): Self::SystemData<'_>,
|
||||||
) {
|
) {
|
||||||
let mut outcomes_emitter = outcomes.emitter();
|
let mut outcomes_emitter = outcomes.emitter();
|
||||||
for ev in events {
|
for ev in events {
|
||||||
@ -272,17 +272,17 @@ fn handle_exp_gain(
|
|||||||
pub struct DestroyEventData<'a> {
|
pub struct DestroyEventData<'a> {
|
||||||
entities: Entities<'a>,
|
entities: Entities<'a>,
|
||||||
rtsim: WriteExpect<'a, RtSim>,
|
rtsim: WriteExpect<'a, RtSim>,
|
||||||
id_maps: ReadExpect<'a, IdMaps>,
|
id_maps: Read<'a, IdMaps>,
|
||||||
msm: ReadExpect<'a, MaterialStatManifest>,
|
msm: ReadExpect<'a, MaterialStatManifest>,
|
||||||
ability_map: ReadExpect<'a, AbilityMap>,
|
ability_map: ReadExpect<'a, AbilityMap>,
|
||||||
time: ReadExpect<'a, Time>,
|
time: Read<'a, Time>,
|
||||||
world: ReadExpect<'a, Arc<World>>,
|
world: ReadExpect<'a, Arc<World>>,
|
||||||
index: ReadExpect<'a, world::IndexOwned>,
|
index: ReadExpect<'a, world::IndexOwned>,
|
||||||
areas_container: ReadExpect<'a, AreasContainer<NoDurabilityArea>>,
|
areas_container: Read<'a, AreasContainer<NoDurabilityArea>>,
|
||||||
outcomes: ReadExpect<'a, EventBus<Outcome>>,
|
outcomes: Read<'a, EventBus<Outcome>>,
|
||||||
create_item_drop: ReadExpect<'a, EventBus<CreateItemDropEvent>>,
|
create_item_drop: Read<'a, EventBus<CreateItemDropEvent>>,
|
||||||
delete_event: ReadExpect<'a, EventBus<DeleteEvent>>,
|
delete_event: Read<'a, EventBus<DeleteEvent>>,
|
||||||
chat_events: ReadExpect<'a, EventBus<ChatEvent>>,
|
chat_events: Read<'a, EventBus<ChatEvent>>,
|
||||||
melees: WriteStorage<'a, comp::Melee>,
|
melees: WriteStorage<'a, comp::Melee>,
|
||||||
beams: WriteStorage<'a, comp::Beam>,
|
beams: WriteStorage<'a, comp::Beam>,
|
||||||
skill_sets: WriteStorage<'a, SkillSet>,
|
skill_sets: WriteStorage<'a, SkillSet>,
|
||||||
@ -745,7 +745,7 @@ impl ServerEvent for DeleteEvent {
|
|||||||
Entities<'a>,
|
Entities<'a>,
|
||||||
Write<'a, comp::group::GroupManager>,
|
Write<'a, comp::group::GroupManager>,
|
||||||
Write<'a, Trades>,
|
Write<'a, Trades>,
|
||||||
ReadExpect<'a, IdMaps>,
|
Read<'a, IdMaps>,
|
||||||
WriteStorage<'a, Group>,
|
WriteStorage<'a, Group>,
|
||||||
WriteStorage<'a, Agent>,
|
WriteStorage<'a, Agent>,
|
||||||
ReadStorage<'a, Uid>,
|
ReadStorage<'a, Uid>,
|
||||||
@ -819,10 +819,10 @@ impl ServerEvent for DeleteEvent {
|
|||||||
|
|
||||||
impl ServerEvent for LandOnGroundEvent {
|
impl ServerEvent for LandOnGroundEvent {
|
||||||
type SystemData<'a> = (
|
type SystemData<'a> = (
|
||||||
ReadExpect<'a, Time>,
|
Read<'a, Time>,
|
||||||
ReadExpect<'a, MaterialStatManifest>,
|
ReadExpect<'a, MaterialStatManifest>,
|
||||||
ReadExpect<'a, EventBus<HealthChangeEvent>>,
|
Read<'a, EventBus<HealthChangeEvent>>,
|
||||||
ReadExpect<'a, EventBus<PoiseChangeEvent>>,
|
Read<'a, EventBus<PoiseChangeEvent>>,
|
||||||
ReadStorage<'a, PhysicsState>,
|
ReadStorage<'a, PhysicsState>,
|
||||||
ReadStorage<'a, CharacterState>,
|
ReadStorage<'a, CharacterState>,
|
||||||
ReadStorage<'a, comp::Mass>,
|
ReadStorage<'a, comp::Mass>,
|
||||||
@ -933,7 +933,7 @@ impl ServerEvent for LandOnGroundEvent {
|
|||||||
|
|
||||||
impl ServerEvent for RespawnEvent {
|
impl ServerEvent for RespawnEvent {
|
||||||
type SystemData<'a> = (
|
type SystemData<'a> = (
|
||||||
ReadExpect<'a, SpawnPoint>,
|
Read<'a, SpawnPoint>,
|
||||||
WriteStorage<'a, Health>,
|
WriteStorage<'a, Health>,
|
||||||
WriteStorage<'a, comp::Combo>,
|
WriteStorage<'a, comp::Combo>,
|
||||||
WriteStorage<'a, Pos>,
|
WriteStorage<'a, Pos>,
|
||||||
@ -995,15 +995,15 @@ event_emitters! {
|
|||||||
impl ServerEvent for ExplosionEvent {
|
impl ServerEvent for ExplosionEvent {
|
||||||
type SystemData<'a> = (
|
type SystemData<'a> = (
|
||||||
Entities<'a>,
|
Entities<'a>,
|
||||||
WriteExpect<'a, BlockChange>,
|
Write<'a, BlockChange>,
|
||||||
ReadExpect<'a, Settings>,
|
Read<'a, Settings>,
|
||||||
ReadExpect<'a, Time>,
|
Read<'a, Time>,
|
||||||
ReadExpect<'a, IdMaps>,
|
Read<'a, IdMaps>,
|
||||||
ReadExpect<'a, CachedSpatialGrid>,
|
Read<'a, CachedSpatialGrid>,
|
||||||
ReadExpect<'a, TerrainGrid>,
|
ReadExpect<'a, TerrainGrid>,
|
||||||
ReadExpect<'a, MaterialStatManifest>,
|
ReadExpect<'a, MaterialStatManifest>,
|
||||||
ReadExplosionEvents<'a>,
|
ReadExplosionEvents<'a>,
|
||||||
ReadExpect<'a, EventBus<Outcome>>,
|
Read<'a, EventBus<Outcome>>,
|
||||||
ReadStorage<'a, Group>,
|
ReadStorage<'a, Group>,
|
||||||
ReadStorage<'a, Auras>,
|
ReadStorage<'a, Auras>,
|
||||||
ReadStorage<'a, Pos>,
|
ReadStorage<'a, Pos>,
|
||||||
@ -1502,7 +1502,7 @@ impl ServerEvent for BonkEvent {
|
|||||||
type SystemData<'a> = (
|
type SystemData<'a> = (
|
||||||
Write<'a, BlockChange>,
|
Write<'a, BlockChange>,
|
||||||
ReadExpect<'a, TerrainGrid>,
|
ReadExpect<'a, TerrainGrid>,
|
||||||
ReadExpect<'a, EventBus<CreateObjectEvent>>,
|
Read<'a, EventBus<CreateObjectEvent>>,
|
||||||
);
|
);
|
||||||
|
|
||||||
fn handle(
|
fn handle(
|
||||||
@ -1592,7 +1592,7 @@ impl ServerEvent for AuraEvent {
|
|||||||
|
|
||||||
impl ServerEvent for BuffEvent {
|
impl ServerEvent for BuffEvent {
|
||||||
type SystemData<'a> = (
|
type SystemData<'a> = (
|
||||||
ReadExpect<'a, Time>,
|
Read<'a, Time>,
|
||||||
WriteStorage<'a, comp::Buffs>,
|
WriteStorage<'a, comp::Buffs>,
|
||||||
ReadStorage<'a, Body>,
|
ReadStorage<'a, Body>,
|
||||||
ReadStorage<'a, Health>,
|
ReadStorage<'a, Health>,
|
||||||
@ -1696,8 +1696,8 @@ impl ServerEvent for EnergyChangeEvent {
|
|||||||
|
|
||||||
impl ServerEvent for ComboChangeEvent {
|
impl ServerEvent for ComboChangeEvent {
|
||||||
type SystemData<'a> = (
|
type SystemData<'a> = (
|
||||||
ReadExpect<'a, Time>,
|
Read<'a, Time>,
|
||||||
ReadExpect<'a, EventBus<Outcome>>,
|
Read<'a, EventBus<Outcome>>,
|
||||||
WriteStorage<'a, comp::Combo>,
|
WriteStorage<'a, comp::Combo>,
|
||||||
ReadStorage<'a, Uid>,
|
ReadStorage<'a, Uid>,
|
||||||
);
|
);
|
||||||
@ -1723,9 +1723,9 @@ impl ServerEvent for ComboChangeEvent {
|
|||||||
|
|
||||||
impl ServerEvent for ParryHookEvent {
|
impl ServerEvent for ParryHookEvent {
|
||||||
type SystemData<'a> = (
|
type SystemData<'a> = (
|
||||||
ReadExpect<'a, Time>,
|
Read<'a, Time>,
|
||||||
ReadExpect<'a, EventBus<EnergyChangeEvent>>,
|
Read<'a, EventBus<EnergyChangeEvent>>,
|
||||||
ReadExpect<'a, EventBus<BuffEvent>>,
|
Read<'a, EventBus<BuffEvent>>,
|
||||||
WriteStorage<'a, CharacterState>,
|
WriteStorage<'a, CharacterState>,
|
||||||
ReadStorage<'a, Uid>,
|
ReadStorage<'a, Uid>,
|
||||||
ReadStorage<'a, Stats>,
|
ReadStorage<'a, Stats>,
|
||||||
@ -1792,7 +1792,7 @@ impl ServerEvent for ParryHookEvent {
|
|||||||
|
|
||||||
impl ServerEvent for TeleportToEvent {
|
impl ServerEvent for TeleportToEvent {
|
||||||
type SystemData<'a> = (
|
type SystemData<'a> = (
|
||||||
ReadExpect<'a, IdMaps>,
|
Read<'a, IdMaps>,
|
||||||
WriteStorage<'a, Pos>,
|
WriteStorage<'a, Pos>,
|
||||||
WriteStorage<'a, comp::ForceUpdate>,
|
WriteStorage<'a, comp::ForceUpdate>,
|
||||||
);
|
);
|
||||||
@ -1826,12 +1826,12 @@ impl ServerEvent for EntityAttackedHookEvent {
|
|||||||
type SystemData<'a> = (
|
type SystemData<'a> = (
|
||||||
Entities<'a>,
|
Entities<'a>,
|
||||||
Write<'a, Trades>,
|
Write<'a, Trades>,
|
||||||
ReadExpect<'a, IdMaps>,
|
Read<'a, IdMaps>,
|
||||||
ReadExpect<'a, Time>,
|
Read<'a, Time>,
|
||||||
ReadExpect<'a, EventBus<BuffEvent>>,
|
Read<'a, EventBus<BuffEvent>>,
|
||||||
ReadExpect<'a, EventBus<ComboChangeEvent>>,
|
Read<'a, EventBus<ComboChangeEvent>>,
|
||||||
ReadExpect<'a, EventBus<KnockbackEvent>>,
|
Read<'a, EventBus<KnockbackEvent>>,
|
||||||
ReadExpect<'a, EventBus<Outcome>>,
|
Read<'a, EventBus<Outcome>>,
|
||||||
WriteStorage<'a, CharacterState>,
|
WriteStorage<'a, CharacterState>,
|
||||||
WriteStorage<'a, Poise>,
|
WriteStorage<'a, Poise>,
|
||||||
WriteStorage<'a, Agent>,
|
WriteStorage<'a, Agent>,
|
||||||
@ -2089,7 +2089,7 @@ impl ServerEvent for RemoveLightEmitterEvent {
|
|||||||
|
|
||||||
impl ServerEvent for TeleportToPositionEvent {
|
impl ServerEvent for TeleportToPositionEvent {
|
||||||
type SystemData<'a> = (
|
type SystemData<'a> = (
|
||||||
ReadExpect<'a, IdMaps>,
|
Read<'a, IdMaps>,
|
||||||
WriteStorage<'a, Is<VolumeRider>>,
|
WriteStorage<'a, Is<VolumeRider>>,
|
||||||
WriteStorage<'a, Pos>,
|
WriteStorage<'a, Pos>,
|
||||||
WriteStorage<'a, comp::ForceUpdate>,
|
WriteStorage<'a, comp::ForceUpdate>,
|
||||||
@ -2131,7 +2131,7 @@ impl ServerEvent for TeleportToPositionEvent {
|
|||||||
|
|
||||||
impl ServerEvent for StartTeleportingEvent {
|
impl ServerEvent for StartTeleportingEvent {
|
||||||
type SystemData<'a> = (
|
type SystemData<'a> = (
|
||||||
ReadExpect<'a, Time>,
|
Read<'a, Time>,
|
||||||
WriteStorage<'a, comp::Teleporting>,
|
WriteStorage<'a, comp::Teleporting>,
|
||||||
ReadStorage<'a, Pos>,
|
ReadStorage<'a, Pos>,
|
||||||
ReadStorage<'a, comp::Object>,
|
ReadStorage<'a, comp::Object>,
|
||||||
|
@ -10,7 +10,7 @@ use common::{
|
|||||||
uid::{IdMaps, Uid},
|
uid::{IdMaps, Uid},
|
||||||
};
|
};
|
||||||
use common_net::msg::ServerGeneral;
|
use common_net::msg::ServerGeneral;
|
||||||
use specs::{world::Entity, Entities, ReadExpect, ReadStorage, WriteExpect, WriteStorage};
|
use specs::{world::Entity, Entities, Read, ReadStorage, Write, WriteStorage};
|
||||||
|
|
||||||
use super::ServerEvent;
|
use super::ServerEvent;
|
||||||
|
|
||||||
@ -111,8 +111,8 @@ pub fn update_map_markers<'a>(
|
|||||||
impl ServerEvent for GroupManipEvent {
|
impl ServerEvent for GroupManipEvent {
|
||||||
type SystemData<'a> = (
|
type SystemData<'a> = (
|
||||||
Entities<'a>,
|
Entities<'a>,
|
||||||
WriteExpect<'a, GroupManager>,
|
Write<'a, GroupManager>,
|
||||||
ReadExpect<'a, IdMaps>,
|
Read<'a, IdMaps>,
|
||||||
WriteStorage<'a, Group>,
|
WriteStorage<'a, Group>,
|
||||||
ReadStorage<'a, Client>,
|
ReadStorage<'a, Client>,
|
||||||
ReadStorage<'a, Uid>,
|
ReadStorage<'a, Uid>,
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
use hashbrown::HashSet;
|
use hashbrown::HashSet;
|
||||||
use rand::{seq::IteratorRandom, Rng};
|
use rand::{seq::IteratorRandom, Rng};
|
||||||
use specs::{
|
use specs::{
|
||||||
join::Join, shred, DispatcherBuilder, Entities, Entity as EcsEntity, ReadExpect, ReadStorage,
|
join::Join, shred, DispatcherBuilder, Entities, Entity as EcsEntity, Read, ReadExpect,
|
||||||
SystemData, WriteExpect, WriteStorage,
|
ReadStorage, SystemData, Write, WriteStorage,
|
||||||
};
|
};
|
||||||
use tracing::{debug, error, warn};
|
use tracing::{debug, error, warn};
|
||||||
use vek::{Rgb, Vec3};
|
use vek::{Rgb, Vec3};
|
||||||
@ -77,11 +77,11 @@ event_emitters! {
|
|||||||
pub struct InventoryManipData<'a> {
|
pub struct InventoryManipData<'a> {
|
||||||
entities: Entities<'a>,
|
entities: Entities<'a>,
|
||||||
events: Events<'a>,
|
events: Events<'a>,
|
||||||
block_change: WriteExpect<'a, common_state::BlockChange>,
|
block_change: Write<'a, common_state::BlockChange>,
|
||||||
trades: WriteExpect<'a, Trades>,
|
trades: Write<'a, Trades>,
|
||||||
terrain: ReadExpect<'a, common::terrain::TerrainGrid>,
|
terrain: ReadExpect<'a, common::terrain::TerrainGrid>,
|
||||||
id_maps: ReadExpect<'a, IdMaps>,
|
id_maps: Read<'a, IdMaps>,
|
||||||
time: ReadExpect<'a, Time>,
|
time: Read<'a, Time>,
|
||||||
ability_map: ReadExpect<'a, AbilityMap>,
|
ability_map: ReadExpect<'a, AbilityMap>,
|
||||||
msm: ReadExpect<'a, MaterialStatManifest>,
|
msm: ReadExpect<'a, MaterialStatManifest>,
|
||||||
inventories: WriteStorage<'a, comp::Inventory>,
|
inventories: WriteStorage<'a, comp::Inventory>,
|
||||||
|
@ -19,7 +19,7 @@ use common::{
|
|||||||
};
|
};
|
||||||
use common_net::msg::{InviteAnswer, ServerGeneral};
|
use common_net::msg::{InviteAnswer, ServerGeneral};
|
||||||
use specs::{
|
use specs::{
|
||||||
shred, DispatcherBuilder, Entities, Entity, ReadExpect, ReadStorage, SystemData, WriteExpect,
|
shred, DispatcherBuilder, Entities, Entity, Read, ReadExpect, ReadStorage, SystemData, Write,
|
||||||
WriteStorage,
|
WriteStorage,
|
||||||
};
|
};
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
@ -37,10 +37,10 @@ pub(super) fn register_event_systems(builder: &mut DispatcherBuilder) {
|
|||||||
|
|
||||||
impl ServerEvent for InitiateInviteEvent {
|
impl ServerEvent for InitiateInviteEvent {
|
||||||
type SystemData<'a> = (
|
type SystemData<'a> = (
|
||||||
WriteExpect<'a, Trades>,
|
Write<'a, Trades>,
|
||||||
ReadExpect<'a, Settings>,
|
Read<'a, Settings>,
|
||||||
ReadExpect<'a, IdMaps>,
|
Read<'a, IdMaps>,
|
||||||
ReadExpect<'a, GroupManager>,
|
Read<'a, GroupManager>,
|
||||||
WriteStorage<'a, PendingInvites>,
|
WriteStorage<'a, PendingInvites>,
|
||||||
WriteStorage<'a, Agent>,
|
WriteStorage<'a, Agent>,
|
||||||
WriteStorage<'a, Invite>,
|
WriteStorage<'a, Invite>,
|
||||||
@ -215,10 +215,10 @@ impl ServerEvent for InitiateInviteEvent {
|
|||||||
#[derive(SystemData)]
|
#[derive(SystemData)]
|
||||||
pub struct InviteResponseData<'a> {
|
pub struct InviteResponseData<'a> {
|
||||||
entities: Entities<'a>,
|
entities: Entities<'a>,
|
||||||
group_manager: WriteExpect<'a, GroupManager>,
|
group_manager: Write<'a, GroupManager>,
|
||||||
trades: WriteExpect<'a, Trades>,
|
trades: Write<'a, Trades>,
|
||||||
index: ReadExpect<'a, world::IndexOwned>,
|
index: ReadExpect<'a, world::IndexOwned>,
|
||||||
id_maps: ReadExpect<'a, IdMaps>,
|
id_maps: Read<'a, IdMaps>,
|
||||||
invites: WriteStorage<'a, Invite>,
|
invites: WriteStorage<'a, Invite>,
|
||||||
pending_invites: WriteStorage<'a, PendingInvites>,
|
pending_invites: WriteStorage<'a, PendingInvites>,
|
||||||
groups: WriteStorage<'a, Group>,
|
groups: WriteStorage<'a, Group>,
|
||||||
|
@ -328,6 +328,7 @@ impl Server {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
register_event_busses(state.ecs_mut());
|
||||||
state.ecs_mut().insert(battlemode_buffer);
|
state.ecs_mut().insert(battlemode_buffer);
|
||||||
state.ecs_mut().insert(settings.clone());
|
state.ecs_mut().insert(settings.clone());
|
||||||
state.ecs_mut().insert(editable_settings);
|
state.ecs_mut().insert(editable_settings);
|
||||||
|
@ -22,7 +22,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
type SystemData = (
|
type SystemData = (
|
||||||
Entities<'a>,
|
Entities<'a>,
|
||||||
Read<'a, EventBus<ClientDisconnectEvent>>,
|
Read<'a, EventBus<ClientDisconnectEvent>>,
|
||||||
ReadExpect<'a, EventBus<ChunkSendEntry>>,
|
Read<'a, EventBus<ChunkSendEntry>>,
|
||||||
ReadExpect<'a, TerrainGrid>,
|
ReadExpect<'a, TerrainGrid>,
|
||||||
ReadExpect<'a, Lod>,
|
ReadExpect<'a, Lod>,
|
||||||
ReadExpect<'a, NetworkRequestMetrics>,
|
ReadExpect<'a, NetworkRequestMetrics>,
|
||||||
|
@ -56,7 +56,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
Write<'a, Option<WeatherJob>>,
|
Write<'a, Option<WeatherJob>>,
|
||||||
WriteExpect<'a, WeatherGrid>,
|
WriteExpect<'a, WeatherGrid>,
|
||||||
WriteExpect<'a, SlowJobPool>,
|
WriteExpect<'a, SlowJobPool>,
|
||||||
ReadExpect<'a, EventBus<Outcome>>,
|
Read<'a, EventBus<Outcome>>,
|
||||||
ReadExpect<'a, Arc<World>>,
|
ReadExpect<'a, Arc<World>>,
|
||||||
ReadStorage<'a, Client>,
|
ReadStorage<'a, Client>,
|
||||||
ReadStorage<'a, comp::Pos>,
|
ReadStorage<'a, comp::Pos>,
|
||||||
|
Loading…
Reference in New Issue
Block a user