Player api

This commit is contained in:
2026-10-13 22:59:48 -03:00
parent b34e97e487
commit a10b15a3fd
22 changed files with 581 additions and 89 deletions
+9 -2
View File
@@ -324,8 +324,15 @@ and turned as a whole: assembled from the world and put back, saved, and synced.
into it as it moves (Create's `ContraptionCollider`, about 1000 lines, is the hardest part), and they can point at and
use its blocks. Generic: boats with decks, falling structures and elevators would all use it.
**S7. Player API additions** (P1). `sneaking` on players, placements and interactions. Reach from an attribute, for the
extendo grip. Item use events (use, release, using for some time) for the potato cannon and wands.
**S7. Player API additions** (P1, built). `player.is_sneaking()` on the server and in client scripts, and `sneaking` in
placement and interaction rules, for blocks like `DirectionalKineticBlock` that sneaking places the other way round.
Like Minecraft's secondary use, sneaking with an item in hand skips the clicked block's interactions and uses or places
the item, and an item's `on_use` gets the block it was used on, for the wrench's pickup. Reach is the
`bworld:block_interaction_range` and `bworld:entity_interaction_range` attributes, which clients aim with, so the
extendo grip is a modifier while it's held. `player.start_using(ticks)` uses an item over time, with `on_use_tick`,
`on_release_using` and `on_finish_using`, for the sand paper, builder's tea and packages. The potato cannon and wands
are plain uses, but their reload needs item cooldowns (Minecraft's `getCooldowns`, shown on the hotbar), which aren't
built.
**S8. Sound** (P3). Web Audio, positional, with sound events defined in data. bworld has no sound at all yet. Create's
whistles, presses, cranks and trains want it, but nothing breaks without it.