don't allow players to pick up items if they are too far away

This commit is contained in:
Martin Michelsen
2026-04-19 09:10:59 -07:00
parent 507fbf0451
commit 31abc24e81
2 changed files with 17 additions and 0 deletions
+9
View File
@@ -2264,6 +2264,15 @@ static asio::awaitable<void> on_pick_up_item_generic(
co_return;
}
// TODO: Figure out what the actual max range is; 30 is an overestimate
double dist2 = fi->pos.dist2(c->pos);
if (dist2 > 900.0) {
l->log.warning_f("Player {} requests to pick up {:08X}, but it is too far away (dist2={})",
client_id, item_id, dist2);
l->add_item(floor, fi);
co_return;
}
try {
p->add_item(fi->data, *s->item_stack_limits(c->version()));
} catch (const out_of_range&) {