Trait veloren_server::state_ext::StateExt

source ·
pub trait StateExt {
Show 23 methods // Required methods fn create_npc( &mut self, pos: Pos, ori: Ori, stats: Stats, skill_set: SkillSet, health: Option<Health>, poise: Poise, inventory: Inventory, body: Body, ) -> EcsEntityBuilder<'_>; fn create_empty(&mut self, pos: Pos) -> EcsEntityBuilder<'_>; fn create_object(&mut self, pos: Pos, object: Body) -> EcsEntityBuilder<'_>; fn create_item_drop( &mut self, pos: Pos, ori: Ori, vel: Vel, item: PickupItem, loot_owner: Option<LootOwner>, ) -> Option<EcsEntity>; fn create_ship<F: FnOnce(Body) -> Collider>( &mut self, pos: Pos, ori: Ori, ship: Body, make_collider: F, ) -> EcsEntityBuilder<'_>; fn create_projectile( &mut self, pos: Pos, vel: Vel, body: Body, projectile: Projectile, ) -> EcsEntityBuilder<'_>; fn create_shockwave( &mut self, properties: Properties, pos: Pos, ori: Ori, ) -> EcsEntityBuilder<'_>; fn create_safezone( &mut self, range: Option<f32>, pos: Pos, ) -> EcsEntityBuilder<'_>; fn create_wiring( &mut self, pos: Pos, object: Body, wiring_element: WiringElement, ) -> EcsEntityBuilder<'_>; fn create_persister( &mut self, pos: Pos, view_distance: u32, world: &Arc<World>, index: &IndexOwned, ) -> EcsEntityBuilder<'_>; fn create_teleporter( &mut self, pos: Pos, portal: PortalData, ) -> EcsEntityBuilder<'_>; fn initialize_character_data( &mut self, entity: EcsEntity, character_id: CharacterId, view_distances: ViewDistances, ); fn initialize_spectator_data( &mut self, entity: EcsEntity, view_distances: ViewDistances, ); fn update_character_data( &mut self, entity: EcsEntity, components: PersistedComponents, ) -> Result<(), String>; fn validate_chat_msg( &self, player: EcsEntity, chat_type: &ChatType<Group>, msg: &str, ) -> bool; fn send_chat(&self, msg: UnresolvedChatMsg); fn notify_players(&self, msg: ServerGeneral); fn notify_in_game_clients(&self, msg: ServerGeneral); fn link<L: Link>(&mut self, link: L) -> Result<(), L::Error>; fn maintain_links(&mut self); fn delete_entity_recorded( &mut self, entity: EcsEntity, ) -> Result<(), WrongGeneration>; fn entity_as_actor(&self, entity: EcsEntity) -> Option<Actor>; fn position_mut<T>( &mut self, entity: EcsEntity, dismount_volume: bool, f: impl for<'a> FnOnce(&'a mut Pos) -> T, ) -> Result<T, Content>;
}

Required Methods§

source

fn create_npc( &mut self, pos: Pos, ori: Ori, stats: Stats, skill_set: SkillSet, health: Option<Health>, poise: Poise, inventory: Inventory, body: Body, ) -> EcsEntityBuilder<'_>

Build a non-player character

source

fn create_empty(&mut self, pos: Pos) -> EcsEntityBuilder<'_>

Create an entity with only a position

source

fn create_object(&mut self, pos: Pos, object: Body) -> EcsEntityBuilder<'_>

Build a static object entity

source

fn create_item_drop( &mut self, pos: Pos, ori: Ori, vel: Vel, item: PickupItem, loot_owner: Option<LootOwner>, ) -> Option<EcsEntity>

Create an item drop or merge the item with an existing drop, if a suitable candidate exists.

source

fn create_ship<F: FnOnce(Body) -> Collider>( &mut self, pos: Pos, ori: Ori, ship: Body, make_collider: F, ) -> EcsEntityBuilder<'_>

source

fn create_projectile( &mut self, pos: Pos, vel: Vel, body: Body, projectile: Projectile, ) -> EcsEntityBuilder<'_>

Build a projectile

source

fn create_shockwave( &mut self, properties: Properties, pos: Pos, ori: Ori, ) -> EcsEntityBuilder<'_>

Build a shockwave entity

source

fn create_safezone( &mut self, range: Option<f32>, pos: Pos, ) -> EcsEntityBuilder<'_>

Creates a safezone

source

fn create_wiring( &mut self, pos: Pos, object: Body, wiring_element: WiringElement, ) -> EcsEntityBuilder<'_>

source

fn create_persister( &mut self, pos: Pos, view_distance: u32, world: &Arc<World>, index: &IndexOwned, ) -> EcsEntityBuilder<'_>

Queues chunk generation in the view distance of the persister, this entity must be built before those chunks are received (the builder borrows the ecs world so that is kind of impossible in practice)

source

fn create_teleporter( &mut self, pos: Pos, portal: PortalData, ) -> EcsEntityBuilder<'_>

Creates a teleporter entity, which allows players to teleport to the target position. You might want to require the teleporting entity to not have agro for teleporting.

source

fn initialize_character_data( &mut self, entity: EcsEntity, character_id: CharacterId, view_distances: ViewDistances, )

Insert common/default components for a new character joining the server

source

fn initialize_spectator_data( &mut self, entity: EcsEntity, view_distances: ViewDistances, )

Insert common/default components for a new spectator joining the server

source

fn update_character_data( &mut self, entity: EcsEntity, components: PersistedComponents, ) -> Result<(), String>

Update the components associated with the entity’s current character. Performed after loading component data from the database

source

fn validate_chat_msg( &self, player: EcsEntity, chat_type: &ChatType<Group>, msg: &str, ) -> bool

Iterates over registered clients and send each ServerMsg

source

fn send_chat(&self, msg: UnresolvedChatMsg)

source

fn notify_players(&self, msg: ServerGeneral)

source

fn notify_in_game_clients(&self, msg: ServerGeneral)

Create a new link between entities (see [common::mounting] for an example).

Maintain active links between entities

source

fn delete_entity_recorded( &mut self, entity: EcsEntity, ) -> Result<(), WrongGeneration>

Delete an entity, recording the deletion in DeletedEntities

source

fn entity_as_actor(&self, entity: EcsEntity) -> Option<Actor>

Get the given entity as an [Actor], if it is one.

source

fn position_mut<T>( &mut self, entity: EcsEntity, dismount_volume: bool, f: impl for<'a> FnOnce(&'a mut Pos) -> T, ) -> Result<T, Content>

Mutate the position of an entity or, if the entity is mounted, the mount.

If dismount_volume is true, an entity mounted on a volume entity (such as an airship) will be dismounted to avoid teleporting the volume entity.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl StateExt for State

source§

fn create_persister( &mut self, pos: Pos, view_distance: u32, world: &Arc<World>, index: &IndexOwned, ) -> EcsEntityBuilder<'_>

Queues chunk generation in the view distance of the persister, this entity must be built before those chunks are received (the builder borrows the ecs world so that is kind of impossible in practice)

source§

fn update_character_data( &mut self, entity: EcsEntity, components: PersistedComponents, ) -> Result<(), String>

Returned error intended to be sent to the client.

source§

fn send_chat(&self, msg: UnresolvedChatMsg)

Send the chat message to the proper players. Say and region are limited by location. Faction and group are limited by component.

source§

fn notify_players(&self, msg: ServerGeneral)

Sends the message to all connected clients

source§

fn notify_in_game_clients(&self, msg: ServerGeneral)

Sends the message to all clients playing in game

source§

fn create_npc( &mut self, pos: Pos, ori: Ori, stats: Stats, skill_set: SkillSet, health: Option<Health>, poise: Poise, inventory: Inventory, body: Body, ) -> EcsEntityBuilder<'_>

source§

fn create_empty(&mut self, pos: Pos) -> EcsEntityBuilder<'_>

source§

fn create_object(&mut self, pos: Pos, object: Body) -> EcsEntityBuilder<'_>

source§

fn create_item_drop( &mut self, pos: Pos, ori: Ori, vel: Vel, world_item: PickupItem, loot_owner: Option<LootOwner>, ) -> Option<EcsEntity>

source§

fn create_ship<F: FnOnce(Body) -> Collider>( &mut self, pos: Pos, ori: Ori, ship: Body, make_collider: F, ) -> EcsEntityBuilder<'_>

source§

fn create_projectile( &mut self, pos: Pos, vel: Vel, body: Body, projectile: Projectile, ) -> EcsEntityBuilder<'_>

source§

fn create_shockwave( &mut self, properties: Properties, pos: Pos, ori: Ori, ) -> EcsEntityBuilder<'_>

source§

fn create_safezone( &mut self, range: Option<f32>, pos: Pos, ) -> EcsEntityBuilder<'_>

source§

fn create_wiring( &mut self, pos: Pos, object: Body, wiring_element: WiringElement, ) -> EcsEntityBuilder<'_>

source§

fn create_teleporter( &mut self, pos: Pos, portal: PortalData, ) -> EcsEntityBuilder<'_>

source§

fn initialize_character_data( &mut self, entity: EcsEntity, character_id: CharacterId, view_distances: ViewDistances, )

source§

fn initialize_spectator_data( &mut self, entity: EcsEntity, view_distances: ViewDistances, )

source§

fn validate_chat_msg( &self, entity: EcsEntity, chat_type: &ChatType<Group>, msg: &str, ) -> bool

source§

fn delete_entity_recorded( &mut self, entity: EcsEntity, ) -> Result<(), WrongGeneration>

source§

fn entity_as_actor(&self, entity: EcsEntity) -> Option<Actor>

source§

fn position_mut<T>( &mut self, entity: EcsEntity, dismount_volume: bool, f: impl for<'a> FnOnce(&'a mut Pos) -> T, ) -> Result<T, Content>

Implementors§