mirror of
https://github.com/horizon-rust/horizon.git
synced 2026-11-07 17:21:49 -10:00
Mobs: a mob's particles reach the clients, not a headless buffer
`MobEvent::ParticleAt` was drawn with `self.particles.add` only, and a serving client has no window: the squid's 30 ink particles never left the server. Send them as packets like every other server-thread particle site; with count 0 the packet's deltas are the particle's motion. Co-Authored-By: Hermes <[email protected]>
This commit is contained in:
1 parent
61791d3e20
commit
be258bc235
1 file changed
+15
@@ -2747,6 +2747,21 @@ impl Game<'_> {
|
||||
if let Some(ty) = horizon_client::particles::ParticleType::from_name(kind) {
|
||||
let options = horizon_client::particles::ParticleOptions::simple(ty);
|
||||
self.particles.add(&options, at, velocity);
|
||||
// A serving client draws nothing on its own: the mob's
|
||||
// particles have to reach the clients as packets. With
|
||||
// count 0 the packet's deltas are the particle's motion
|
||||
// (`ServerLevel.sendParticles` with no spread), which is
|
||||
// what the event already carries.
|
||||
self.lan_send_particles(super::lan_particles::QueuedParticle {
|
||||
dimension: self.dim.id(),
|
||||
options,
|
||||
state: None,
|
||||
at,
|
||||
spread: velocity,
|
||||
speed: 0.1,
|
||||
count: 0,
|
||||
randomization: 0,
|
||||
});
|
||||
}
|
||||
}
|
||||
MobEvent::ParticleColored {
|
||||
|
||||
Reference in new issue
Block a user