A cast could put a character inside a wall - #2320
Conversation
WalkPacketHandler refuses a destination that is not walkable, along with four other checks - server speed, distance against speed/2, the coordinate checksum and travel time. UpdateAttackerPosition writes the same two fields from a client-supplied position with no check at all, so anything the walk path refuses can be had by sending it in a u_s packet instead. This adds back the one check that needs nothing the packet lacks: IsWalkable, exactly as WalkPacketHandler calls it. The distance and speed rules are deliberately left out - u_s carries no speed, and a per-step bound of speed/2 would refuse the teleport skills, which legitimately move a character further (Skill.dat declares them as BCard type 30 subtype 21, up to 8 fields for the Mage's Teleport). A null MapInstance still allows the move, so nothing changes for entities that have no map yet. TESTED. Builds clean. NOT covered by a unit test: reaching UpdateAttackerPosition needs a real MapInstance, whose constructor takes eleven dependencies, and the fixture for it would be larger than the fix. Saying so rather than implying otherwise. The equivalent guard was written and tested on the other code base this comes from, where the decision is a pure function. Not played - the servers were not started.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review. Walkthrough
ChangesBattle Position Validation
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The change prevents cast movement from placing a character in a non-walkable position while keeping movement validation consistent; no actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| } | ||
| } | ||
|
|
||
| // WalkPacketHandler refuses a destination that is not walkable; this path wrote the same |
There was a problem hiding this comment.
Removed in c158583 — the comment is gone, the guard itself is unchanged.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
u_scarries a position, andUpdateAttackerPositionwrote it straight intoPositionX/PositionY.WalkPacketHandlerrefuses a destination that is not walkable; this path had no such check, so the same movement was allowed by one road and refused by the other.The guard is the walk path's own
IsWalkable, so the two agree by construction rather than by two copies of a rule.Tested:
NosCore.GameObject.Tests442/442 andNosCore.PacketHandlers.Tests410/410, solution builds with zero warnings. Not played - I do not start the servers.Summary by CodeRabbit