Repository navigation
feat: aim assist, session state, marker, parser and tooling improvements - #13
Merged
Merged
Conversation
- 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().
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Items 5–15 from the improvement review, one commit per item.
feat(aim-assist): validate AimAssistBuilder inputdistance()1–16, positiveviewAngle(),send()rejects unregistered presets, newclear(), PHPDocfeat(aim-assist): add actor priority builder and client toggle eventaimAssistActorPriority()wrapsCameraAimAssistActorPriorityPacket;ClientCameraAimAssistPacketis stored on the session and raisesCameraAimAssistToggleEventfeat(preset): let CameraPresetBuilder inherit the audio listener typeaudioListenerTypedefaults tonull(inherit from parent)feat(set): expose removeIgnoreStartingValuesComponentCameraSetBuilder::removeIgnoreStartingValues()feat(session): track client camera state and add reapply()getCurrent*()getters andreapply()(set/FOV/target/attach/HUD/control scheme/fog)feat(timeline): add isTimelinePlaying() ...isTimelinePlaying(),getWaitingSignal()feat(timeline): add hud/aimAssist steps ...hud,aimAssist;setacceptsviewOffset/entityOffset/default; unknown steps log a warningfeat(marker): allow restricting who can see a camera markersetViewers()andspawnMarker(..., $viewers); clear error if the skin is not setfeat(camera): let positionLocal()/facingLocal() follow the player's pitch$followPitch(default off)chore: require PocketMine-MP 5.42 and lint PHP syntax in CIplugin.ymlapi5.42.0, newlint.ymlworkflowdocs(readme)Behavior changes
CameraPresetBuilderno longer forcesAUDIO_LISTENER_TYPE_PLAYER; presets now inherit it from the parent unless set explicitly.AimAssistBuildernow throwsInvalidArgumentExceptionfor out-of-range distance/angles and unregistered presets.plugin.ymlnow requires PocketMine-MP 5.42.0 or higher.Not included
CameraSplinePacket/ named splines: PocketMine-MP's packet class differs from the Mojang schema, so this needs a custom packet. Left for a separate change.startingRotation): not in PocketMine-MP yet.php -lfor now.Testing
php -lon all sources only; no real server or client. ThepositionLocal()math was checked numerically (pitch 0 matches the old result, pitch 90 makes forward point down). The actor priority index mapping andCameraMarkerEntity::setViewers()are untested against PocketMine-MP/clients.Generated by Claude Code