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:
Regalis
2017-04-11 20:36:52 +03:00
parent 347f549ac1
commit 9a36df0f52
5 changed files with 49 additions and 16 deletions
@@ -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;