ItemComponent syncing fixes:
- Relay and lightcomponent states are synced (otherwise clients won't be notified if the state is, for example, toggled by a signal from a button). - Clients don't play door sounds if a signal attempts to set the state to the same value as the predicted state, but DO play if a correction from the server changes the state from the predicted one. - Clients are notified if a reactor receives a shutdown signal. - Powercontainer updates are sent if the charge changes by 1%, not by 1 unit.
This commit is contained in:
@@ -56,7 +56,7 @@ namespace Barotrauma.Items.Components
|
||||
if (!MathUtils.IsValid(value)) return;
|
||||
charge = MathHelper.Clamp(value, 0.0f, capacity);
|
||||
|
||||
if (Math.Abs(charge - lastSentCharge) > 1.0f)
|
||||
if (Math.Abs(charge - lastSentCharge) / capacity > 1.0f)
|
||||
{
|
||||
if (GameMain.Server != null) item.CreateServerEvent(this);
|
||||
lastSentCharge = charge;
|
||||
|
||||
Reference in New Issue
Block a user