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:
parent
3582d86c70
commit
6be4a2b33f
@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
client::Client, events::player::handle_exit_ingame, persistence::PersistedComponents, sys,
|
||||
CharacterUpdater, Server, StateExt,
|
||||
CharacterUpdater, Server, StateExt, presence::RepositionOnChunkLoad,
|
||||
};
|
||||
use common::{
|
||||
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 {
|
||||
entity.with(rtsim_entity)
|
||||
entity.with(rtsim_entity).with(RepositionOnChunkLoad)
|
||||
} else {
|
||||
entity
|
||||
};
|
||||
|
@ -295,7 +295,6 @@ impl StateExt for State {
|
||||
.with(comp::Combo::default())
|
||||
.with(comp::Auras::default())
|
||||
.with(comp::Stance::default())
|
||||
.with(RepositionOnChunkLoad)
|
||||
}
|
||||
|
||||
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<_>>();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user