mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
only add RepositionOnChunkLoad to rtsim npcs and don't add Waypoint if it doesn't exist
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
client::Client, events::player::handle_exit_ingame, persistence::PersistedComponents, sys,
|
client::Client, events::player::handle_exit_ingame, persistence::PersistedComponents, sys,
|
||||||
CharacterUpdater, Server, StateExt,
|
CharacterUpdater, Server, StateExt, presence::RepositionOnChunkLoad,
|
||||||
};
|
};
|
||||||
use common::{
|
use common::{
|
||||||
character::CharacterId,
|
character::CharacterId,
|
||||||
@ -131,7 +131,7 @@ pub fn handle_create_npc(server: &mut Server, pos: Pos, mut npc: NpcBuilder) ->
|
|||||||
};
|
};
|
||||||
|
|
||||||
let entity = if let Some(rtsim_entity) = npc.rtsim_entity {
|
let entity = if let Some(rtsim_entity) = npc.rtsim_entity {
|
||||||
entity.with(rtsim_entity)
|
entity.with(rtsim_entity).with(RepositionOnChunkLoad)
|
||||||
} else {
|
} else {
|
||||||
entity
|
entity
|
||||||
};
|
};
|
||||||
|
@ -295,7 +295,6 @@ impl StateExt for State {
|
|||||||
.with(comp::Combo::default())
|
.with(comp::Combo::default())
|
||||||
.with(comp::Auras::default())
|
.with(comp::Auras::default())
|
||||||
.with(comp::Stance::default())
|
.with(comp::Stance::default())
|
||||||
.with(RepositionOnChunkLoad)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_object(&mut self, pos: comp::Pos, object: comp::object::Body) -> EcsEntityBuilder {
|
fn create_object(&mut self, pos: comp::Pos, object: comp::object::Body) -> EcsEntityBuilder {
|
||||||
|
@ -251,7 +251,9 @@ impl<'a> System<'a> for Sys {
|
|||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
for (entity, new_pos) in repositioned {
|
for (entity, new_pos) in repositioned {
|
||||||
let _ = waypoints.insert(entity, Waypoint::new(new_pos, *time));
|
if let Some(waypoint) = waypoints.get_mut(entity) {
|
||||||
|
*waypoint = Waypoint::new(new_pos, *time);
|
||||||
|
}
|
||||||
reposition_on_load.remove(entity);
|
reposition_on_load.remove(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user