Skip to content

feat: aim assist, session state, marker, parser and tooling improvements - #13

Merged
PresentKim merged 11 commits into
mainfrom
feat/camera-api-improvements
Oct 7, 2026
Merged

PresentKim merged 11 commits into
mainfrom
feat/camera-api-improvements

Conversation

@PresentKim

Copy link
Copy Markdown
Member

Summary

Items 5–15 from the improvement review, one commit per item.

Commit Change
feat(aim-assist): validate AimAssistBuilder input distance() 1–16, positive viewAngle(), send() rejects unregistered presets, new clear(), PHPDoc
feat(aim-assist): add actor priority builder and client toggle event aimAssistActorPriority() wraps CameraAimAssistActorPriorityPacket; ClientCameraAimAssistPacket is stored on the session and raises CameraAimAssistToggleEvent
feat(preset): let CameraPresetBuilder inherit the audio listener type audioListenerType defaults to null (inherit from parent)
feat(set): expose removeIgnoreStartingValuesComponent CameraSetBuilder::removeIgnoreStartingValues()
feat(session): track client camera state and add reapply() getCurrent*() getters and reapply() (set/FOV/target/attach/HUD/control scheme/fog)
feat(timeline): add isTimelinePlaying() ... isTimelinePlaying(), getWaitingSignal()
feat(timeline): add hud/aimAssist steps ... New JSON steps hud, aimAssist; set accepts viewOffset/entityOffset/default; unknown steps log a warning
feat(marker): allow restricting who can see a camera marker setViewers() and spawnMarker(..., $viewers); clear error if the skin is not set
feat(camera): let positionLocal()/facingLocal() follow the player's pitch optional $followPitch (default off)
chore: require PocketMine-MP 5.42 and lint PHP syntax in CI plugin.yml api 5.42.0, new lint.yml workflow
docs(readme) Documents the above and fixes aim-assist examples that referenced non-existent classes/methods

Behavior changes

  • CameraPresetBuilder no longer forces AUDIO_LISTENER_TYPE_PLAYER; presets now inherit it from the parent unless set explicitly.
  • AimAssistBuilder now throws InvalidArgumentException for out-of-range distance/angles and unregistered presets.
  • plugin.yml now requires PocketMine-MP 5.42.0 or higher.

Not included

  • Item 4 (spline client verification) needs a real client.
  • Item 6, CameraSplinePacket / named splines: PocketMine-MP's packet class differs from the Mojang schema, so this needs a custom packet. Left for a separate change.
  • Item 15 (startingRotation): not in PocketMine-MP yet.
  • phpstan: it cannot be set up and verified without the PocketMine-MP dev dependency, so CI only runs php -l for now.

Testing

php -l on all sources only; no real server or client. The positionLocal() math was checked numerically (pitch 0 matches the old result, pitch 90 makes forward point down). The actor priority index mapping and CameraMarkerEntity::setViewers() are untested against PocketMine-MP/clients.


Generated by Claude Code

- distance() only accepts 1-16 blocks, viewAngle() requires positive finite angles.
- send() rejects presets that are not registered in AimAssistPresetRegistry.
- Add an explicit clear() and PHPDoc for every method.
- session->aimAssistActorPriority() wraps CameraAimAssistActorPriorityPacket and resolves the
  preset/category/actor indexes from AimAssistPresetRegistry (new getPresetIndex/getCategoryIndex).
- Handle the serverbound ClientCameraAimAssistPacket: store the state on the session
  (isClientAimAssistAllowed()) and call CameraAimAssistToggleEvent.
The builder forced AUDIO_LISTENER_TYPE_PLAYER, so presets could not inherit the value of their
parent (e.g. minecraft:free expects CAMERA). Default to null and accept null in setAudioListenerType().

Behavior change: presets built with CameraPresetBuilder that relied on the implicit PLAYER default now
inherit from their parent; call setAudioListenerType(CameraPreset::AUDIO_LISTENER_TYPE_PLAYER) to keep it.
Add CameraSetBuilder::removeIgnoreStartingValues(), which maps to the protocol's
removeIgnoreStartingValuesComponent field (previously always false).
CameraSession now remembers the camera set, FOV and target instructions, the attached entity, the HUD
preset and the control scheme that were sent through it (cleared again by clear()/detach/remove target),
exposes them through getCurrent*() getters, and can send them (plus the fog stack) again with reapply(),
e.g. after a respawn or dimension change. Eases are dropped on reapply so nothing animates twice.
…eraSession

Lets callers check whether a timeline still has scheduled steps or is paused on waitUntil(), and which
signal it is waiting for, before starting another one (play() cancels the running timeline).
…SON parser

- New 'hud' (registered preset name) and 'aimAssist' (preset, viewAngle, distance, targetMode, debug, clear) steps.
- 'set' steps accept viewOffset, entityOffset and default.
- Unknown step types are still skipped, but now logged as a warning so typos are noticed.
Markers were always spawned to everyone. Add CameraMarkerEntity::setViewers() / CameraMarker::setViewers()
and an optional $viewers argument to Camera::spawnMarker() so markers can be shown only to chosen players
(e.g. admins editing a cutscene). Also fail with a clear LogicException instead of an uninitialized
property error when a marker is spawned before setSkin().
…itch

Both methods only used the yaw. Add an optional $followPitch flag that tilts the forward/up axes by the
player's pitch (default false keeps the old behavior) and document that offsets are relative to the
player's feet.
- plugin.yml api 5.0.0 -> 5.42.0: the spline instruction and rotation easing used by the builders need
  BedrockProtocol 56 (Bedrock 1.26.10), which first shipped with 5.42.
- Add a workflow that runs php -l on every source file for pushes to main and pull requests.
Cover reapply()/state getters, actor priorities and the aim assist toggle event, marker viewers,
the pitch option of the local-space helpers, new JSON steps, the audio listener default and the PocketMine-MP 5.42
requirement. The aim-assist examples referenced VanillaAimAssistPresetIds and ->action(), which do not exist;
use DefaultAimAssistPresetIds and clear().
@PresentKim
PresentKim merged commit a1d3d54 into main Oct 7, 2026
2 checks passed
@PresentKim
PresentKim deleted the feat/camera-api-improvements branch October 7, 2026 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant