mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 19:03:43 +00:00
fix(physics): write the construction cheat block only when changed
Live wrote the controllable-physics cheat block (gravity scale, speed multiplier) in a construction only when one of them differed from 1: 216 of 20,617 constructions had it (players at run speed 1.05 / 1.5 / 2.0 / 0.5, enemies with gravity 0), never 1 and 1. DLU wrote it in every construction. Serializations are unchanged. Test: ReplicaConstructionTest.ControllablePhysicsConstructionWritesCheatsOnlyWhenChanged. Check in game: with a second player watching, use a speed boost (or /setspeed) and zone in while boosted; the other player sees you move at the right speed. Enemies with gravity 0 (e.g. Sentinel Turret 6254) behave as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -97,8 +97,10 @@ void ControllablePhysicsComponent::Serialize(RakNet::BitStream& outBitStream, bo
|
||||
outBitStream.Write(m_ImmuneToStunInteractCount);
|
||||
}
|
||||
|
||||
outBitStream.Write(m_DirtyCheats || bIsInitialUpdate);
|
||||
if (m_DirtyCheats || bIsInitialUpdate) {
|
||||
// Live wrote the cheat block on construction only when the gravity or speed was changed from 1.
|
||||
const bool writeCheats = bIsInitialUpdate ? (m_GravityScale != 1.0f || m_SpeedMultiplier != 1.0f) : m_DirtyCheats;
|
||||
outBitStream.Write(writeCheats);
|
||||
if (writeCheats) {
|
||||
outBitStream.Write(m_GravityScale);
|
||||
outBitStream.Write(m_SpeedMultiplier);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user