Patch for the position de-synchronization by imbris

See https://discordapp.com/channels/449602562165833758/449650240350453760/774724295452393522
This commit is contained in:
Christof Petig 2020-11-08 18:37:23 +01:00
parent 8cab21d44c
commit b11da85ff9
2 changed files with 14 additions and 2 deletions

View File

@ -7,7 +7,7 @@ rustflags = [
generate = "run --package tools --" generate = "run --package tools --"
test-server = "-Zpackage-features run --bin veloren-server-cli --no-default-features" test-server = "-Zpackage-features run --bin veloren-server-cli --no-default-features"
tracy-server = "-Zunstable-options -Zpackage-features run --bin veloren-server-cli --no-default-features --features tracy --profile dev" tracy-server = "-Zunstable-options -Zpackage-features run --bin veloren-server-cli --no-default-features --features tracy --profile dev"
test-voxygen = "-Zpackage-features run --bin veloren-voxygen --no-default-features --features gl" test-voxygen = "-Zpackage-features run --bin veloren-voxygen --no-default-features --features gl,simd"
tracy-voxygen = "-Zunstable-options -Zpackage-features run --bin veloren-voxygen --no-default-features --features tracy,gl --profile dev" tracy-voxygen = "-Zunstable-options -Zpackage-features run --bin veloren-voxygen --no-default-features --features tracy,gl,simd --profile dev"
server = "run --bin veloren-server-cli" server = "run --bin veloren-server-cli"

View File

@ -242,6 +242,8 @@ pub fn initialize_region_subscription(world: &World, entity: specs::Entity) {
&world.entities(), &world.entities(),
) )
.join() .join()
// Don't send client its own components because we do that below
.filter(|t| t.4 != entity)
{ {
// Send message to create entity and tracked components and physics components // Send message to create entity and tracked components and physics components
client.send_fallible(ServerGeneral::CreateEntity( client.send_fallible(ServerGeneral::CreateEntity(
@ -255,6 +257,16 @@ pub fn initialize_region_subscription(world: &World, entity: specs::Entity) {
} }
} }
} }
// If client position was modified it might not be updated in the region system
// so we send its components here
client.send_fallible(ServerGeneral::CreateEntity(
tracked_comps.create_entity_package(
entity,
Some(*client_pos),
world.read_storage().get(entity).copied(),
world.read_storage().get(entity).copied(),
),
));
if let Err(e) = world.write_storage().insert(entity, RegionSubscription { if let Err(e) = world.write_storage().insert(entity, RegionSubscription {
fuzzy_chunk, fuzzy_chunk,