space-wizards / space-station-14

A multiplayer game about paranoia and chaos on a space station. Remake of the cult-classic Space Station 13.
https://spacestation14.io
MIT License
2.54k stars 3.15k forks source link

Character Turning Sideways Repro #30135

Open Plykiya opened 1 month ago

Plykiya commented 1 month ago

Description

I don't know what causes it, I just have a reproduction for it. It happens randomly and not just in the way that I reproduced it.

Reproduction

  1. Throw a stun baton at a person until they're stunned
  2. That's all

It does not happen if you stun a person with melee attacks.

Screenshots

https://github.com/user-attachments/assets/784aec62-367f-476d-98f0-ff2808bf7f07

https://github.com/user-attachments/assets/7b891e6d-2550-4670-9074-922a11a2a789

Additional context

Plykiya commented 1 month ago

image

it is a client-side issue, it turns the character sideways in two hits even though the character isn't stunned until the third

slarticodefast commented 1 month ago

Probably the same underlying problem as #29859, which can also cause you to stay sideways. Just with soap and slipping.

Plykiya commented 1 month ago

StaminaSystem.cs relies on StaminaDamageOnHitAttemptEvent for both melee and thrown attacks to cancel the stamina damage if the event returns args.Cancelled = True

Only the server-side StunBatonSystem.cs accounts for this meaning the hit successfully deals Stamina damage on the client-side even if the event was cancelled. It tries to cancel the event if the usage of the battery fails. Because there is no check for this client-side, you end up with a situation where the client registers 35 more stamina damage than should actually be happening.

While this would normally be solved by moving OnStaminaHit() to Shared and making it predicted, everything to do with the Battery or Power system is not in Shared, so the client has no access to it.

Plykiya commented 1 month ago

we need battery preedictionnn https://github.com/space-wizards/space-station-14/pull/25887