Repository navigation
Motion: a ladder volume a first-person body climbs (volume: ladder, ladder_speed) - #132
Merged
Merged
Conversation
A new volume kind, VolumeKind::Ladder { face }: a level node with
"volume": "ladder" and "face": [x, y, z] (the way out of the ladder, toward
the side it is climbed from, in the node's space), shaped by its collider as
water and updraft are.
A body whose locomotion gives a ladder_speed (default 0: it does not climb,
so no NPC does) takes hold of a ladder when it pushes into it against
something solid, on the ground, in a fall or swimming, and when it walks off
an edge inside the volume (the way down from the top). On it there is no
gravity: into the ladder is up, away from it is down, the rest is sideways,
no input hangs. At the top it walks off level onto the floor, at the foot it
stands on the ground, and a jump lets go with a push of ladder_jump_speed
(2.5 m/s). ladder_by_look is Half-Life's rule: the forward input goes along
the look's pitch.
The state is the new MotionMode::Ladder and nothing else: the ladder is found
again each tick from what the capsule touches, so no component, resource or
field of MotionState was added, a body that does not climb moves and hashes
as it did, and the three options are left out of the written form at their
defaults. Driven by the existing Intent only.
Animation sets get the mode name and the locomotion state "ladder", the
describer shows "ladder ↑3.5m/s", the jump and glide tools answer for the
mode, physics_overlay draws the volume orange. The navmesh leaves the volume
out as it does every sensor.
Tests: tests/motion/ladder.rs (14) and shards_level's colliders.rs (the node,
a turned node, the messages). Not run here: the sandbox's tests and the
reference replays (the machine had no room for that build).
Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
A body that jumped off a ladder and went on pushing into it was back on it at once: the rule "not while it moves away" lasts only until the air control has taken the jump's speed back, which under accel: Projected is two ticks, so for a player who climbs with the key down the jump did nothing. The jump is now remembered: the controller puts the marker LadderLetGo on the body, and a body that has it takes hold of no ladder. It comes off once the body no longer pushes into a ladder it touches from the front (the input was let go, or it fell clear of the volume) or is out of the air, so the next push takes hold as ever: jump and hold the key to fall to the foot, let it go and press again to catch the ladder on the way. The marker is reflected, registered and net_predicted, and only a body that jumped off a ladder ever has it. With it a ladder_jump_speed of 0 lets go too. Tests (tests/motion/ladder.rs, now 17): the jump with the push held under both models of the air, the push let go and taken again in the fall, and a climb and a jump off put back from what a snapshot holds (Transform, MotionState, LocomotionInput, the marker) going on bit for bit. The manual also says how thick a ladder's volume may be: thinner than twice the body's radius, or a body against the wall is never in front of it. Not run here: the sandbox's tests (the state audit and the reference replays). Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
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.
What
A climbable ladder as a level volume, for a first-person body in the manner of Half-Life. The manual's new section "Ladders" has the rules, the limits and the tests.
VolumeKind::Ladder { face }. In a level file it is a node with"volume": "ladder"and"face": [x, y, z]: the way out of the ladder toward the side it is climbed from, in the node's space. It is shaped by its collider aswaterandupdraftare, and the level check names a missing or verticalface.locomotiongives aladder_speed. The default is 0, the body does not climb, so no NPC does unless its definition says so. Two more options:ladder_jump_speed(2.5 m/s) andladder_by_look(off; Half-Life's rule, the forward input goes along the look's pitch). All three are left out of the written form at their defaults.MotionMode::Ladder, driven by the existingIntentonly):ladder; the describer showsladder ↑3.5m/s; thejumpandglidetools answer for the mode;physics_overlaydraws the volume orange. The navmesh leaves the volume out, as it does every sensor.State and determinism
LadderLetGo, a reflected marker (registered,net_predicted) on a body that jumped off a ladder, until it stops pushing into it.MotionStateorLocomotionInput, and the new enum variants are the last ones.ladder_speedmoves as it did, to the bit, in a world with a ladder (a_body_with_no_ladder_speed_is_not_affected_by_a_ladder).a_climb_and_a_jump_off_go_on_the_same_from_what_a_save_holds).Checked
Run locally on Windows, after a rebase onto
mainatb7e5a0fe:cargo test -p shards_motion: 478 passed, with the 17 new tests oftests/motion/ladder.rsand the reader guard (--test readers).cargo test -p shards_level: 111 passed, one of them new (the node, a turned node, the messages).cargo test -p shards_action: 589 passed.cargo clippy -p shards_motion -p shards_level -p shards_action -p shards_npc -p sandbox --all-targets -- -D warnings: silent.Not run locally
cargo test --workspace), the template's tests,--check-contentand the worldgen report.Not built
face: Move) is not turned to the ladder.path_to,clearanceandmove_to path=truedo not know a ladder.Seen on the way, not changed here
Two
shards_actiontests (the_example_in_the_docs_is_valid_content,the_layers_example_in_the_docs_is_valid_content) fail on a Windows checkout withcore.autocrlf=true: they search their own source for\nand the file has CRLF. They pass with LF endings, which is how the count above was taken.🤖 Generated with Claude Code