mirror of
https://github.com/horizon-rust/horizon.git
synced 2026-11-08 17:19:10 -10:00
Riding: skip the extra rider pass when nothing rides the player
The second position_riders() call after the player moves rebuilt the mob index every tick for every client; run it only when the riding graph has something on this player. Also forget passengers whose vehicle is removed, and add the new field to main's second (studio) Remote initializer. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
1eb3b7f6c3
commit
9bc110bae6
1 file changed
+10
-2
@@ -1390,6 +1390,7 @@ impl Game<'_> {
|
||||
use_target: None,
|
||||
menu_extra: None,
|
||||
entities: HashMap::new(),
|
||||
passenger_vehicles: HashMap::new(),
|
||||
lerps: HashMap::new(),
|
||||
cart_lerps: HashMap::new(),
|
||||
stepped: HashMap::new(),
|
||||
@@ -3352,6 +3353,7 @@ impl Game<'_> {
|
||||
r.glowing.remove(&id);
|
||||
r.entities.remove(&id);
|
||||
r.passenger_vehicles.remove(&(id as u32));
|
||||
r.passenger_vehicles.retain(|_, v| *v != id as u32);
|
||||
r.lerps.remove(&id);
|
||||
r.cart_lerps.remove(&id);
|
||||
r.stepped.remove(&id);
|
||||
@@ -6857,8 +6859,14 @@ impl Game<'_> {
|
||||
}
|
||||
// A stand riding the player follows this move (tickPassenger).
|
||||
self.seat_own_stands();
|
||||
// Other players on this player (possibly through a plugin seat) follow this tick too.
|
||||
self.position_riders();
|
||||
// Other players on this player (possibly through a plugin seat) follow this tick too;
|
||||
// the full pass only when something rides this player.
|
||||
if self.remote.as_ref().is_some_and(|r| {
|
||||
let me = r.entity_id as u32;
|
||||
r.passenger_vehicles.values().any(|&v| v == me)
|
||||
}) {
|
||||
self.position_riders();
|
||||
}
|
||||
// The server owns health and hunger.
|
||||
self.apply_remote_health();
|
||||
self.tick_avatar(before, false);
|
||||
|
||||
Reference in new issue
Block a user