LAN: a guest's entity id no longer takes the host's
Hub::admit read the entity counter before incrementing it, while the game increments first (the current value is the last id in use). The first guest after Open to LAN got the host's own entity id, so its client took the host's AddEntity for itself and never showed the host. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -420,8 +420,10 @@ impl Hub {
|
||||
}
|
||||
|
||||
fn admit(&mut self, j: super::Joined, ctx: &mut TickCtx) -> u32 {
|
||||
let entity_id = *ctx.next_entity as i32;
|
||||
// The game's ids are taken by incrementing first: the current value
|
||||
// is the last id in use (the host's own, right after opening to LAN).
|
||||
*ctx.next_entity += 1;
|
||||
let entity_id = *ctx.next_entity as i32;
|
||||
let conn = j.conn;
|
||||
let mut guest = Guest::new(j, entity_id, ctx.spawn, self.config.view_distance);
|
||||
guest.last_action_tick = self.ticks;
|
||||
|
||||
Reference in New Issue
Block a user