Skip to content

A mount changes the sprite and nothing else - #2303

Merged
erwan-joly merged 1 commit into
NosCoreIO:masterfrom
denislauri1999:pr/vehicle-speed
Aug 26, 2026
Merged

A mount changes the sprite and nothing else#2303
erwan-joly merged 1 commit into
NosCoreIO:masterfrom
denislauri1999:pr/vehicle-speed

Conversation

@denislauri1999

Copy link
Copy Markdown
Contributor

cond carries Speed, and Speed is written once in CreatePlayer from the class table and never again. Mounting sets VehicleSpeed, which no packet reads — so the player rides at walking pace, and nothing in a log or a packet says so.

The service for this already exists and nobody calls it

SpeedCalculationService.CalculateSpeed(ICharacterEntity) is written to answer exactly this question. grep finds no caller anywhere in src/.

It is also wrong where it matters:

if (characterEntity.VehicleSpeed != null)   // can never be false
{
    return (byte)characterEntity.VehicleSpeed;
}

PlayerStateComponent declares VehicleSpeed as a plain byte; ICharacterEntity widens it to byte?. The null branch is unreachable, so wired as written the service would have returned 0 for everyone on foot. Nothing reported it because nothing called it.

It now keys off IsVehicled, and the mount and dismount paths call it.

The existing test was green for the wrong reason

VehicleSpeedOverridesDefaultSpeed set VehicleSpeed and left IsVehicled at its mock default of false — a state a mount never produces. The impossible null check happened to answer it correctly. It now sets both, and a second case covers being on foot with VehicleSpeed at 0.

The transformation tests assert the number the client actually receives (GenerateCond().Speed), not just VehicleSpeed: asserting only the latter is what let a mount that adds no speed look correct.

Not in this PR

CalculateSpeed's bonus is a commented-out bonusSpeed = 0 left from upstream, so the movement BCards still do nothing. That is a separate change.

`cond` carries Speed, and Speed is written once at login from the class table
and never again. Mounting sets VehicleSpeed, which no packet reads: the player
rides at walking pace, and nothing in a log or a packet says so.

SpeedCalculationService exists to answer exactly this question and **has no
callers at all**. It is also wrong where it matters: PlayerStateComponent
declares VehicleSpeed as a plain `byte` and ICharacterEntity widens it to
`byte?`, so `VehicleSpeed != null` can never be false. Wired as written it would
have returned 0 for everybody on foot.

Now it keys off IsVehicled, and the mount and dismount paths call it.

The existing test passed only because of that bug: it set VehicleSpeed without
IsVehicled, which is a state a mount never produces, and the impossible null
check happened to answer it correctly. It now sets both, and a second case
covers being on foot with VehicleSpeed at 0.

Still missing, and out of scope here: the movement BCards. CalculateSpeed's
bonus is a commented-out `bonusSpeed = 0` from upstream, so a speed buff moves
nothing.
@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 26 minutes.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: bfd1051d-3432-4757-abf4-97c890588b88

📥 Commits

Reviewing files that changed from the base of the PR and between 55dc38c and c2e6de1.

📒 Files selected for processing (5)
  • src/NosCore.GameObject/Services/SpeedCalculationService/SpeedCalculationService.cs
  • src/NosCore.GameObject/Services/TransformationService/TransformationService.cs
  • test/NosCore.GameObject.Tests/Services/SpeedCalculationService/SpeedCalculationServiceTests.cs
  • test/NosCore.GameObject.Tests/Services/TransformationService/TransformationServiceTests.cs
  • test/NosCore.PacketHandlers.Tests/Inventory/SpTransformPacketHandlerTests.cs

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@erwan-joly
erwan-joly merged commit 590ba8c into NosCoreIO:master Aug 26, 2026
2 checks passed
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.

2 participants