Give merged orbs their value once per count for LAN guests and dedicated players
This commit is contained in:
@@ -2591,7 +2591,13 @@ impl Game<'_> {
|
||||
.random
|
||||
.next_int_bound(touching.len() as i32)
|
||||
.unwrap_or(0) as usize;
|
||||
let orb = self.orbs.remove(touching[pick]);
|
||||
// A merged orb gives its value once per count and goes at zero.
|
||||
let orb = self.orbs[touching[pick]].clone();
|
||||
if orb.count <= 1 {
|
||||
self.orbs.remove(touching[pick]);
|
||||
} else {
|
||||
self.orbs[touching[pick]].count -= 1;
|
||||
}
|
||||
play.xp_delay = 2;
|
||||
host.hub.take_item(orb.id as i32, id, 1, at);
|
||||
// ClientPacketListener.handleTakeItemEntity's sound, at the orb.
|
||||
|
||||
@@ -2018,7 +2018,10 @@ impl Game<'_> {
|
||||
{
|
||||
self.add_pickup(super::pickups::Taken::Orb(Box::new(orb)), collector);
|
||||
}
|
||||
self.remove_entity(p.item);
|
||||
// An orb stays: the server may still hold merged ones in it.
|
||||
if !orb {
|
||||
self.remove_entity(p.item);
|
||||
}
|
||||
}
|
||||
// ClientPacketListener.handleSetEntityMotion: knockback on this player.
|
||||
C::SetEntityMotion(p) if self.remote.as_ref().is_some_and(|r| r.entity_id == p.id) => {
|
||||
|
||||
Reference in New Issue
Block a user