World item drops magnetize to the avatar #17

Closed
opened 2026-11-07 18:27:43 +00:00 by claude · 1 comment
Member

Overflow drops, and later mob or chest drops, use __builtin:item, which is picked up relative to the hidden player body (the camera). Override the item entity so it stays on the plane and flies to any avatar within ~3 blocks, then into the inventory.

Overflow drops, and later mob or chest drops, use `__builtin:item`, which is picked up relative to the hidden player body (the camera). Override the item entity so it stays on the plane and flies to any avatar within ~3 blocks, then into the inventory.
claude added this to the v0.2 Core Feel milestone 2026-11-07 18:27:43 +00:00
claude added the
type
feature
area/items-crafting
priority
medium
labels 2026-11-07 18:27:43 +00:00
eric added this to the Strata Roadmap project 2026-11-07 18:36:27 +00:00
eric moved this to To Do in Strata Roadmap on 2026-11-07 18:37:23 +00:00
eric closed this issue 2026-11-11 17:10:03 +00:00
Author
Member

Done in 25a06e8.

What changed (mods/strata_player/pickup.lua)

  • __builtin:item is re-registered with a wrapped on_step. Items are kept on the plane (drops from the wall layer or the camera land where they can be reached). The nearest avatar within 3 nodes whose inventory has room pulls the item in with physics off and takes it within 0.6 nodes, with a short pickup sound. What doesn't fit stays in the world and falls again.
  • core.item_drop now throws items out of the avatar in its facing direction instead of from the camera, and they can't be picked up for 1.5 s, so a dropped item doesn't jump straight back.

Tests: 5 selftest cases (tests/pickup.lua): items off the plane fall back onto it, magnet range and inventory-room rules, an item flies into an avatar's inventory, partial pickup leaves the rest, the drop delay. A mutation with the magnet disabled fails the pickup case. Full suite 60/60, zero ERROR lines; CI run 19864 green.

Note for tests: item entities are static-saved, so on a headless server (no players to keep blocks active) they deactivate after a moment. The test forceloads its blocks; that's documented in DESIGN.md.

Hand check: how the pull feels (acceleration 40 n/s², max 12 n/s), and Q-dropping from the hotbar.

Done in 25a06e8. **What changed** (`mods/strata_player/pickup.lua`) - `__builtin:item` is re-registered with a wrapped `on_step`. Items are kept on the plane (drops from the wall layer or the camera land where they can be reached). The nearest avatar within 3 nodes whose inventory has room pulls the item in with physics off and takes it within 0.6 nodes, with a short pickup sound. What doesn't fit stays in the world and falls again. - `core.item_drop` now throws items out of the avatar in its facing direction instead of from the camera, and they can't be picked up for 1.5 s, so a dropped item doesn't jump straight back. **Tests**: 5 selftest cases (`tests/pickup.lua`): items off the plane fall back onto it, magnet range and inventory-room rules, an item flies into an avatar's inventory, partial pickup leaves the rest, the drop delay. A mutation with the magnet disabled fails the pickup case. Full suite 60/60, zero ERROR lines; CI run 19864 green. **Note for tests**: item entities are static-saved, so on a headless server (no players to keep blocks active) they deactivate after a moment. The test forceloads its blocks; that's documented in DESIGN.md. **Hand check**: how the pull feels (acceleration 40 n/s², max 12 n/s), and Q-dropping from the hotbar.
Sign in to join this conversation.