commit de04ba2b33e6b8041b485367cdb7d9d1b77ab3d8
parent 683f8c1e7cf6c0b4c9090cbd11e603e3ef4b8339
Author: anon <anon@example.com>
Date: Mon, 26 Oct 2026 13:30:06 +0000
Enforce native outdoor player height before physics
Controlled native actors cap outdoor Y at129 while remote actors skip that
rule. Apply the source-backed position-only placement before shared movement
and prediction, preserve intrinsic physics during loading, and anchor remote
actors with the existing native correction action. Keep initial wire positions
and dungeon/Grid exemptions intact. Share the setter with authored flight lifts.
Verify all1308 server roots (14289 results),57 focused roots,149 race roots,
data/vet and eight regressions failing against the previous implementation.
Five source ledgers and twelve paired GPU WASM states cover initialization,
falls, flight limits, held motion and both-client reloads. Remove owned fixtures
and leave one cleaned LAN HTTPS8443 preview. Document the remaining native
loading/catch-up cadence differences and asynchronous measurement bounds.
Diffstat:
7 files changed, 391 insertions(+), 26 deletions(-)
diff --git a/TODO.md b/TODO.md
@@ -1268,12 +1268,23 @@ disconnect retention and succession policy still need period corroboration.
do not accumulate height. Preserve rejected swimming transitions and keep
equipment helper events out of client movement dispatch. See
[flight movement](docs/player-movement.md#flight-transitions-and-facing).
-- [ ] Audit high-altitude owner teleport/reinitialization against the remote
- actor and server. After a same-playfield control edit to Y900, the sampled
- owner was at Y95.14, observer copy Y868.45 and server Y899.94.
- Retain the raw teleport/spawn packets and trace their native consumers before
- changing height policy; do not assume a flight ceiling. Evidence:
- `local/player-flight-movement/runtime/pair-verified-fall-start.json`.
+- [x] Apply the native controlled-player outdoor height rule. SimpleChar.Run
+ places Y>129 at129 before physics with the position-only setter; preserve
+ velocity, gravity and controls. Use the resource-backed Outdoor classification
+ so indoor/Grid maps are exempt. Keep initial spawn coordinates intact, simulate
+ intrinsic physics during loading, and correct remote actors which skip the
+ native owner rule. Y900 human/vehicle checks, held upward flight and both-client
+ reloads pass. See [controlled height](docs/player-movement.md#controlled-outdoor-height).
+- [ ] Expand loading and mid-fall observer cadence checks. Native frame timing
+ includes elapsed loading time; a new actor can immediately consume a large
+ frame with0.4s physics substeps. Matching sampled intervals reproduce the
+ Y128.94592/q-1.04 ->Y95.44576/q-32.96 catch-up exactly, while the live60Hz
+ server takes smaller steps. The repaired Y900 trace has after-Ready position
+ differences up to3.17m owner/2.82m observer in the first run and5.68m/4.61m
+ in the final concurrent-test run, before reaching the same floor; sampling gaps
+ reach74ms. This replaces the earlier hundreds-of-metres mismatch. Test cold loading, ordinary
+ falls, new observers during a fall, reconnects and slow rendering. Preserve
+ timestamps and avoid claiming exact trajectories from asynchronous samples.
- [ ] Expand flight input and trajectory checks. Distinguish native UI producer
gates from physical helper admission (the UI suppresses Space/action13 in
mode7 although the helper accepts it). Extend the verified jump-to-flight
diff --git a/docs/player-movement.md b/docs/player-movement.md
@@ -124,8 +124,8 @@ is intentionally suppressed by the native UI producer before helper dispatch.
Curved-motion samples are asynchronous: the largest raw difference was 0.846 m
with up to 57 ms between native and server reads under concurrent race testing.
The captures retain timestamps and explicit timing bounds; they do not establish
-bit-identical trajectories. High-altitude owner initialization and broader input,
-water and special-mode combinations remain separate TODOs.
+bit-identical trajectories. Broader input, water and special-mode combinations
+remain separate TODOs. The high-altitude initialization rule is described below.
The final code passes all 1,300 top-level server tests (14,271 results), 91 focused
roots (290 results), 213 race roots (808 results), the data checks and `go vet`.
@@ -135,6 +135,88 @@ All six owned test visitors and their fixture item are removed afterward;
cleanup verifies unrelated SQLite rows unchanged, foreign keys and integrity.
The single LAN HTTPS8443 preview remains available for manual play.
+## Controlled outdoor height
+
+The native controlled player's SimpleChar.Run calls CheckHeight(129) before
+Vehicle.Run. On non-dungeon tilemaps, a global Y strictly greater than129 is
+placed at129 with ordinary SetRelPos. This position-only setter preserves vector
+velocity and independent gravity, stores the requested position as history and
+runs surface alignment. The subsequent physics frame may move above129 again;
+the next outer update repeats the limit. Idle, flying and falling actors use the
+same rule. The engine-dying/deletion branch skips it; HP0 is a separate state.
+
+The predicate follows the selected playfield resource's tilemap reference.
+CHGA tilemaps are non-dungeon; GNDA/UOHA are dungeon. The existing Outdoor flag
+matches this predicate for all363 available catalog playfields. Grid152 references
+GNDA tilemap153 and is exempt, as are ordinary indoor maps. Geometry-provider
+availability and map names do not decide the height rule. Unknown/unavailable
+maps remain outside this resource verification boundary.
+
+Initial SCFU placement accepts Y900. The native controlled marker is set after
+that placement, and the next actual actor update applies the height limit.
+Neither FullCharacter nor CharacterReady gates that branch. The server keeps
+the authored initial spawn and starts intrinsic movement during loading, while
+continuing to reject loading-time client input. Position changes remain in
+memory until the ordinary checkpoint.
+
+Remote native actors skip the height helper. When the authoritative simulation
+applies it, the server sends the completed frame's position with action0x94,
+pass-on0, to initialized actors in the playfield, including loading observers.
+The owner's high-bit branch applies position only; remote actors consume the
+same packet as full-pose action20. The ordinary integrator and read-only range
+prediction share the limit and its position-only setter with flight effects.
+
+The baseline headed WASM trace first reads the same owner actor at Y900 with
+history900/q0, then36ms later at Y128.992 with history129/q-.39999998. The remote
+actor remains near900. The source rule accounts for this discrepancy directly;
+compact wire coordinates and websocket buffering are not its cause.
+Sources: KKR3606EA50/36071C20, LLR3802D200/38039DD0,
+BBR250A3DD0 and QQR420108F0. Hash-verified complete-body ledgers, resource
+classification and packet consumers are retained in
+`local/player-altitude-init/research/{owner-placement,height-callbacks,wire}/`.
+Their verifiers cover85,49 and62 complete bodies respectively. The resource
+census resolves367 catalog maps through258 selected tilemaps; all363 available
+maps have the expected Outdoor value.
+
+The loading-schedule ledger binds45 complete bodies across the frame processor,
+elapsed-time timer, external-input activation, world traversal and Ready producer.
+The frame delta is sampled before pending SCFU activation and can include loading
+time; a newly activated actor consumes that whole delta. Ready follows resource
+workload checks and a countdown. Neither packet receipt nor Ready is an exact
+actor-age clock. The fall-sync ledger checks63 complete bodies and the bounded
+vertical-velocity writer census: the inspected Ready and actor snapshot consumers
+do not provide an absolute independent-gravity reset.
+
+Two headed GPU WASM clients verify the human Y900 fall, live flight entry,
+Y900 flight initialization, both-client reloads and held pitched upward motion.
+The flying owner, observer and server settle at Y129, including after reload.
+Held forward input continues while the limit repeats; releasing it leaves all
+three at the same position. Human clients and server reach the same Y16.41 floor.
+No WASM page errors occur. The first post-Ready fall trace peaks at3.17m owner/
+2.82m observer; the final run alongside automated tests peaks at5.68m/4.61m,
+with sampling gaps up to74ms. Native gravity with52ms then1596ms frames
+reproduces sampled Y128.94592/q-1.04 and Y95.44576/q-32.96. These intervals are
+inferred from native state, not measured frame times. The live60Hz server uses
+smaller steps; matching the endpoint does not establish identical trajectories.
+Cold-loading and mid-fall late-observer cadence remain explicit TODOs.
+
+`TestPlayerAltitude*` checks the strict boundary, indoor/Grid exemptions,
+initial wire placement and simulation clock, prediction/live agreement,
+preserved falling/velocity/controls, upward-flight frame ordering, loading-time
+gravity and observer corrections, actor presence versus HP0/sitting, and deferred
+position persistence. Global engine scheduling and parented indoor coordinate
+transforms remain outside these ordinary outdoor checks.
+
+The final source passes all1,308 top-level server tests (14,289 results),57 focused
+roots (146 results),149 race roots (437 results), data checks and go vet.
+All eight new altitude regression roots fail against the previous production
+implementation; its below/equal/indoor/Grid/unknown negative boundaries pass.
+`local/player-altitude-init/verification.json` binds exact source/assets, test
+executables, source ledgers, native captures and the independently rebuilt
+preview executable. Cleanup removes four owned visitors and one vehicle item,
+checks all unrelated SQLite rows unchanged and validates foreign keys/integrity.
+The single LAN HTTPS8443 preview remains available.
+
## Cached controls and transitions
Forward/reverse start events set signed throttle and refresh speed/force before
diff --git a/server/main.go b/server/main.go
@@ -364,6 +364,8 @@ func (server *server) serveWorldClient(client *worldClient) error {
}
}
character.sitting = false
+ // Native controlled actors simulate after SCFU, before CharacterReady.
+ character.movement.prepare(character, time.Now())
client.regenerationAt = time.Now()
client.regenerationSeconds = 0
client.id = character.id
diff --git a/server/player_altitude_test.go b/server/player_altitude_test.go
@@ -0,0 +1,238 @@
+package main
+
+import (
+ "encoding/binary"
+ "math"
+ "net"
+ "testing"
+ "time"
+)
+
+func TestPlayerAltitudeUsesTheOutdoorBoundary(t *testing.T) {
+ for _, scenario := range []struct {
+ name string
+ playfield uint32
+ y, expected float32
+ }{
+ {"below", 705, 128.99, 128.99},
+ {"equal", 705, 129, 129},
+ {"above", 705, 129.01, 129},
+ {"high", 705, 900, 129},
+ {"indoor", 1001, 900, 900},
+ {"grid", 152, 900, 900},
+ {"unknown", 0, 900, 900},
+ } {
+ t.Run(scenario.name, func(t *testing.T) {
+ world, output := newEquipmentWorld(t)
+ player := world.characters[1]
+ player.playfield, player.position = scenario.playfield, [3]float32{50, scenario.y, 60}
+ player.inventory = playerInventory{}
+ started := time.Now()
+ player.movement.prepare(player, started)
+
+ world.advancePlayerMovement(started.Add(100 * time.Millisecond))
+
+ if player.position != [3]float32{50, scenario.expected, 60} {
+ t.Fatal("controlled height must use the tilemap classification and strict boundary", player.position)
+ }
+ corrections := 0
+ if scenario.y != scenario.expected {
+ corrections = 1
+ }
+ if len(output.packets) != corrections {
+ t.Fatal("unexpected correction count", output.packets)
+ }
+ })
+ }
+}
+
+func TestPlayerAltitudePrecedesPhysicsAndPreservesMotion(t *testing.T) {
+ world := newPlayerCollisionWorld(t)
+ player := world.characters[1]
+ player.position = [3]float32{961.625, 900, 510.75}
+ player.rotation = [4]float32{0, 0, 0, 1}
+ started := time.Now()
+ player.movement.prepare(player, started)
+ player.movement.components[0], player.movement.orientation = 7, 4
+ player.movement.velocity, player.movement.speed = [3]float32{.3, .4, 0}, .5
+ player.movement.falling, player.movement.verticalVelocity = true, -12
+ player.movement.fallHeight, player.movement.strafe = 1000, 2
+
+ predicted := player.predictedMovement(started.Add(100 * time.Millisecond))
+ world.advancePlayerMovement(started.Add(100 * time.Millisecond))
+
+ if math.Abs(float64(player.position[0])-961.655) > .0001 || math.Abs(float64(player.position[1])-127.64) > .0001 || math.Abs(float64(player.position[2])-510.55) > .0001 {
+ t.Fatal("position-only height placement must precede the ordinary frame", player.position)
+ }
+ if player.movement.velocity != [3]float32{.3, .4, 0} || player.movement.verticalVelocity != -14 || !player.movement.falling || player.movement.fallHeight != 1000 || player.movement.strafe != 2 {
+ t.Fatal("height placement changed velocity, controls or falling", player.movement)
+ }
+ if player.movement.previousPosition != [3]float32{961.625, 129, 510.75} || predicted.position != player.position || predicted.movement != player.movement {
+ t.Fatal("prediction and simulation must share the placement history", predicted.position, player.position, player.movement)
+ }
+}
+
+func TestPlayerAltitudeRunsBeforeCharacterReadyAndReplicatesOnce(t *testing.T) {
+ world, owner := newEquipmentWorld(t)
+ player, client := world.characters[1], world.clients[1]
+ player.playfield, player.position, player.inventory = 705, [3]float32{50, 900, 60}, playerInventory{}
+ client.loading = true
+ observer, elsewhere, unready := &combatTestConn{}, &combatTestConn{}, &combatTestConn{}
+ for id, connection := range map[uint32]*combatTestConn{2: observer, 3: elsewhere, 4: unready} {
+ world.characters[id] = &character{id: id, playfield: 705, health: 100}
+ world.clients[id] = &worldClient{id: id, ready: id != 4, loading: true, target: true, conn: connection}
+ }
+ world.characters[3].playfield = 1001
+ started := time.Now()
+ player.movement.prepare(player, started)
+ if err := world.savePosition_locked(player); err != nil {
+ t.Fatal(err)
+ }
+
+ world.advancePlayerMovement(started.Add(100 * time.Millisecond))
+ world.advancePlayerMovement(started.Add(200 * time.Millisecond))
+ db, err := world.database()
+ if err != nil {
+ t.Fatal(err)
+ }
+ var storedY float32
+ if err := db.QueryRow("SELECT position_y FROM characters WHERE id=1").Scan(&storedY); err != nil {
+ t.Fatal(err)
+ }
+
+ if player.position[1] != 129 || len(owner.packets) != 1 || len(observer.packets) != 1 || len(elsewhere.packets) != 0 || len(unready.packets) != 0 || storedY != 900 {
+ t.Fatal("height correction must reach loading actors once without a database write", player.position, owner.packets, observer.packets, elsewhere.packets, unready.packets, storedY)
+ }
+ for _, packet := range [][]byte{owner.packets[0], observer.packets[0]} {
+ body := decodeMovement1491(packet[29:])
+ if binary.BigEndian.Uint32(packet[16:20]) != 0x54111123 || packet[28] != 0 || packet[29] != 0x94 || binary.BigEndian.Uint32(body) != 20 || math.Float32frombits(binary.BigEndian.Uint32(body[8:12])) != 129 {
+ t.Fatal("use the native owner position-only correction", packet)
+ }
+ }
+}
+
+func TestPlayerAltitudeInitializationKeepsTheAuthoredSpawn(t *testing.T) {
+ world := newCheckpointWorld(t)
+ player := world.characters[1]
+ player.playfield, player.position = 705, [3]float32{50, 900, 60}
+ cookie := systemPacket(0x1b, []byte{0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0})
+ binary.BigEndian.PutUint16(cookie, 0xdfdf)
+ connection, peer := net.Pipe()
+ connection.SetDeadline(time.Now().Add(10 * time.Second))
+ done := make(chan error, 1)
+ go func() { defer peer.Close(); done <- world.serveWorldConnection(peer) }()
+ defer func() {
+ connection.Close()
+ if err := <-done; err != nil {
+ t.Error(err)
+ }
+ }()
+
+ if _, err := connection.Write(cookie); err != nil {
+ t.Fatal(err)
+ }
+ snapshots := 0
+ for {
+ packet, err := readPacket(connection)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if binary.BigEndian.Uint32(packet[16:20]) == 0x271b3a6b && binary.BigEndian.Uint32(packet[24:28]) == 1 {
+ snapshots++
+ if int16(binary.BigEndian.Uint16(packet[40:42])) != 14400 {
+ t.Fatal("SCFU must retain Y900", packet)
+ }
+ }
+ if binary.BigEndian.Uint32(packet[16:20]) == 0x5f52412e {
+ break
+ }
+ }
+
+ world.updateMutex.Lock()
+ defer world.updateMutex.Unlock()
+ if snapshots != 1 || player.position[1] != 900 || player.movement.updatedAt.IsZero() {
+ t.Fatal("initial placement must be unchanged with the simulation clock running", snapshots, player.position, player.movement)
+ }
+}
+
+func TestPlayerAltitudeSimulatesGravityDuringLoading(t *testing.T) {
+ world := newPlayerCollisionWorld(t)
+ player, client := world.characters[1], world.clients[1]
+ player.position[1], client.loading = 900, true
+ started := time.Now()
+ player.movement.prepare(player, started)
+
+ world.advancePlayerMovement(started.Add(100 * time.Millisecond))
+ first := player.position[1]
+ world.advancePlayerMovement(started.Add(200 * time.Millisecond))
+
+ if math.Abs(float64(first)-128.8) > .0001 || math.Abs(float64(player.position[1])-128.4) > .0001 || player.movement.verticalVelocity != -4 || !player.movement.falling {
+ t.Fatal("loading must not freeze intrinsic controlled-player physics", first, player.position, player.movement)
+ }
+}
+
+func TestPlayerAltitudeReproducesTheNativeLoadingCatchUpFrame(t *testing.T) {
+ world := newPlayerCollisionWorld(t)
+ player := world.characters[1]
+ player.position[1], world.clients[1].loading = 900, true
+ started := time.Now()
+ player.movement.prepare(player, started)
+
+ // These intervals reproduce the two sampled native q/position pairs.
+ world.advancePlayerMovement(started.Add(52 * time.Millisecond))
+ first, firstVelocity := player.position[1], player.movement.verticalVelocity
+ world.advancePlayerMovement(started.Add(1648 * time.Millisecond))
+
+ if math.Abs(float64(first)-128.94592) > .00002 || math.Abs(float64(firstVelocity)+1.04) > .000001 || math.Abs(float64(player.position[1])-95.44576) > .00003 || math.Abs(float64(player.movement.verticalVelocity)+32.96) > .00001 {
+ t.Fatal("loading catch-up must retain native gravity and bounded substeps", first, firstVelocity, player.position, player.movement)
+ }
+}
+
+func TestPlayerAltitudeLimitsBeforeEachFrameOfUpwardFlight(t *testing.T) {
+ world := newPlayerCollisionWorld(t)
+ player := world.characters[1]
+ player.position[1] = 900
+ started := time.Now()
+ player.movement.prepare(player, started)
+ player.movement.components[0], player.movement.orientation, player.movement.vertical = 7, 4, 6
+
+ world.advancePlayerMovement(started.Add(100 * time.Millisecond))
+ first := player.position[1]
+ world.advancePlayerMovement(started.Add(200 * time.Millisecond))
+ second := player.position[1]
+ player.movement.vertical = 0
+ world.advancePlayerMovement(started.Add(300 * time.Millisecond))
+
+ if math.Abs(float64(first)-129.6) > .0001 || second != first || player.position[1] != 129 || player.movement.falling || !player.flying() {
+ t.Fatal("the limit precedes flight physics and must repeat without cancelling the mode", first, second, player.position, player.movement)
+ }
+}
+
+func TestPlayerAltitudeUsesActorPresenceRatherThanHealth(t *testing.T) {
+ for _, scenario := range []string{"unready", "dead", "sitting"} {
+ t.Run(scenario, func(t *testing.T) {
+ world, _ := newEquipmentWorld(t)
+ player, client := world.characters[1], world.clients[1]
+ player.playfield, player.position[1] = 705, 900
+ if scenario == "unready" {
+ client.ready = false
+ }
+ if scenario == "dead" {
+ player.health = 0
+ }
+ if scenario == "sitting" {
+ player.sitting = true
+ }
+
+ world.advancePlayerMovement(time.Now())
+
+ expected := float32(129)
+ if scenario == "unready" {
+ expected = 900
+ }
+ if player.position[1] != expected {
+ t.Fatal("the owner limit is independent of HP and movement mode", player.position)
+ }
+ })
+ }
+}
diff --git a/server/player_flight.go b/server/player_flight.go
@@ -24,10 +24,9 @@ func (player *character) changeFlight(remove bool) {
// SetRelPos preserves V and q, aligns with the previous orientation mode,
// and stores the requested position as the fall-height history.
// Sources: kkr.dll 36046770/360468F0; qqr.dll 420108F0/42011D00.
- previous := player.position
- player.position[1] += lift
- movement.previousPosition = player.position
- player.alignSurface(previous, true)
+ position := player.position
+ position[1] += lift
+ player.placePosition(position)
if remove {
movement.vertical = 0
movement.orientation = uint32(player.inventory.equipmentBonus(197) + player.nanoBonus(197))
diff --git a/server/player_flight_test.go b/server/player_flight_test.go
@@ -43,7 +43,7 @@ func TestPlayerFlightEntryPreservesAnExistingFallAndPositionOnlyVelocity(t *test
t.Fatal(err)
}
finish := client.equipment.readyAt
- player.position = [3]float32{961.625, 900, 510.75}
+ player.position = [3]float32{961.625, 90, 510.75}
player.movement.updatedAt = finish
player.movement.falling, player.movement.verticalVelocity = true, -12
player.movement.velocity, player.movement.speed = [3]float32{3, 4, 0}, 5
@@ -53,10 +53,10 @@ func TestPlayerFlightEntryPreservesAnExistingFallAndPositionOnlyVelocity(t *test
entry, velocity, falling, impulse := player.position, player.movement.velocity, player.movement.falling, player.movement.verticalVelocity
world.advancePlayerMovement(finish.Add(100 * time.Millisecond))
- if entry != [3]float32{961.625, 900.5, 510.75} || velocity != [3]float32{3, 4, 0} || !falling || impulse != -12 {
+ if entry != [3]float32{961.625, 90.5, 510.75} || velocity != [3]float32{3, 4, 0} || !falling || impulse != -12 {
t.Fatal("flight entry cancelled falling or redirected the existing vector", entry, velocity, falling, impulse)
}
- if !player.movement.falling || player.movement.verticalVelocity != -14 || player.movement.fallHeight != 1000 || player.position[1] >= 900 {
+ if !player.movement.falling || player.movement.verticalVelocity != -14 || player.movement.fallHeight != 1000 || player.position[1] >= 90 {
t.Fatal("disabling new falls must preserve gravity during an existing fall", player.position, player.movement)
}
}
diff --git a/server/player_movement.go b/server/player_movement.go
@@ -105,6 +105,28 @@ func (player *character) placeMovement(position [3]float32, rotation [4]float32)
player.reorientMovement()
}
+func (player *character) placePosition(position [3]float32) {
+ // QQR SetRelPos (420108F0) preserves vector velocity and independent gravity.
+ if player.position == position {
+ return
+ }
+ previous := player.position
+ player.position, player.movement.previousPosition = position, position
+ player.alignSurface(previous, true)
+}
+
+func (player *character) limitHeight() bool {
+ // KKR SimpleChar.Run -> CheckHeight (36071C20), before Vehicle.Run.
+ // Outdoor matches !Tilemap.IsDungeon for the supported resource catalog.
+ if !gamedata.Playfields[player.playfield].Outdoor || player.position[1] <= 129 {
+ return false
+ }
+ position := player.position
+ position[1] = 129
+ player.placePosition(position)
+ return true
+}
+
func bodyAxes(rotation [4]float32) ([3]float32, [3]float32) {
x, y, z, w := rotation[0], rotation[1], rotation[2], rotation[3]
return [3]float32{2*x*z + 2*y*w, 2*y*z - 2*x*w, 1 - 2*x*x - 2*y*y}, [3]float32{1 - 2*y*y - 2*z*z, 2*x*y + 2*z*w, 2*x*z - 2*y*w}
@@ -135,22 +157,23 @@ func (movement *playerMovement) integrateForce(force [3]float32, seconds, bodyMa
return movement.speed
}
-func (player *character) advanceMovement(now time.Time, target [3]float32) {
+func (player *character) advanceMovement(now time.Time, target [3]float32) bool {
+ heightLimited := player.limitHeight()
movement := &player.movement
if movement.updatedAt.IsZero() {
- return
+ return heightLimited
}
seconds := now.Sub(movement.updatedAt).Seconds()
movement.updatedAt = now
previous := player.position
if seconds <= 0 || seconds > 4 {
- return
+ return heightLimited
}
movement.prepare(player, now)
if player.movementRestricted() || player.sitting {
movement.velocity = [3]float32{}
movement.speed = 0
- return
+ return heightLimited
}
physical := player.geometry != nil && player.geometry.terrain[player.playfield] != nil
if physical {
@@ -267,7 +290,7 @@ func (player *character) advanceMovement(now time.Time, target [3]float32) {
}
}
if !changed {
- return
+ return heightLimited
}
player.alignSurface(previous, false)
movement.previousPosition = previous
@@ -288,6 +311,7 @@ func (player *character) advanceMovement(now time.Time, target [3]float32) {
movement.action(player, 1)
}
}
+ return heightLimited
}
func (movement *playerMovement) action(player *character, action uint32) bool {
@@ -464,11 +488,20 @@ func (server *server) advancePlayerMovement_locked(now time.Time, updates map[*w
server.queueCombat_locked(updates, player, player, npcMovementPacket(player, 2), npcMovementPacket(player, 4))
}
player.followTarget = 0
- player.movement = playerMovement{}
- continue
+ if !client.ready || player.health == 0 {
+ // Engine IsDying is actor deletion, not the HP0/dead-character stat.
+ if client.ready && player.limitHeight() {
+ server.queueCombat_locked(updates, player, player, npcMovementPacket(player, 0x94))
+ }
+ player.movement = playerMovement{}
+ continue
+ }
+ player.movement.action(player, 2)
+ player.movement.action(player, 4)
}
- if player.followTarget == 0 {
- player.advanceMovement(now, [3]float32{})
+ if player.followTarget == 0 && player.advanceMovement(now, [3]float32{}) {
+ // Remote native actors skip CheckHeight; anchor them after this frame.
+ server.queueCombat_locked(updates, player, player, npcMovementPacket(player, 0x94))
}
}
targets := make(map[uint32][3]float32)
@@ -490,8 +523,8 @@ func (server *server) advancePlayerMovement_locked(now time.Time, updates map[*w
player.movement.action(player, 4)
player.movement.updatedAt = now
server.queueCombat_locked(updates, player, player, npcMovementPacket(player, 2), npcMovementPacket(player, 4))
- } else {
- player.advanceMovement(now, targets[target.id])
+ } else if player.advanceMovement(now, targets[target.id]) {
+ server.queueCombat_locked(updates, player, player, npcMovementPacket(player, 0x94))
}
}
if player.movement.active() || player.followTarget != 0 {