Merge branch 'master' of https://github.com/Regalis11/Barotrauma.git
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using Barotrauma.Networking;
|
||||
using System;
|
||||
using System.Xml.Linq;
|
||||
using Barotrauma.Networking;
|
||||
|
||||
namespace Barotrauma.Items.Components
|
||||
{
|
||||
internal partial class Growable
|
||||
{
|
||||
private const int serverHealthUpdateDelay = 10;
|
||||
private int serverHealthUpdateTimer;
|
||||
|
||||
partial void LoadVines(XElement element)
|
||||
{
|
||||
foreach (XElement subElement in element.Elements())
|
||||
|
||||
@@ -50,14 +50,14 @@ namespace Barotrauma.Items.Components
|
||||
newSteeringInput = new Vector2(msg.ReadSingle(), msg.ReadSingle());
|
||||
}
|
||||
|
||||
if (!item.CanClientAccess(c)) return;
|
||||
if (!item.CanClientAccess(c)) { return; }
|
||||
|
||||
user = c.Character;
|
||||
AutoPilot = autoPilot;
|
||||
|
||||
if (dockingButtonClicked)
|
||||
{
|
||||
item.SendSignal("1", "toggle_docking");
|
||||
item.SendSignal(new Signal("1", sender: c.Character), "toggle_docking");
|
||||
GameMain.Server.CreateEntityEvent(item, new object[] { NetEntityEvent.Type.ComponentState, item.GetComponentIndex(this), true });
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace Barotrauma.Items.Components
|
||||
msg.Write(DeteriorateAlways);
|
||||
msg.Write(tinkeringDuration);
|
||||
msg.Write(tinkeringStrength);
|
||||
msg.Write(tinkeringPowersDevices);
|
||||
msg.Write(CurrentFixer == null ? (ushort)0 : CurrentFixer.ID);
|
||||
msg.WriteRangedInteger((int)currentFixerAction, 0, 2);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,26 @@ namespace Barotrauma.Items.Components
|
||||
public void ServerWrite(IWriteMessage msg, Client c, object[] extraData = null)
|
||||
{
|
||||
msg.Write(Snapped);
|
||||
|
||||
if (!Snapped)
|
||||
{
|
||||
msg.Write(target?.ID ?? Entity.NullEntityID);
|
||||
if (source is Entity entity && !entity.Removed)
|
||||
{
|
||||
msg.Write(entity?.ID ?? Entity.NullEntityID);
|
||||
msg.Write((byte)0);
|
||||
}
|
||||
else if (source is Limb limb && limb.character != null && !limb.character.Removed)
|
||||
{
|
||||
msg.Write(limb.character?.ID ?? Entity.NullEntityID);
|
||||
msg.Write((byte)limb.character.AnimController.Limbs.IndexOf(limb));
|
||||
}
|
||||
else
|
||||
{
|
||||
msg.Write(Entity.NullEntityID);
|
||||
msg.Write((byte)0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
int signalIndex = msg.ReadRangedInteger(0, Signals.Length - 1);
|
||||
if (!item.CanClientAccess(c)) { return; }
|
||||
if (!SendSignal(signalIndex)) { return; }
|
||||
if (!SendSignal(signalIndex, c.Character)) { return; }
|
||||
GameServer.Log($"{GameServer.CharacterLogName(c.Character)} sent a signal \"{Signals[signalIndex]}\" from {item.Name}", ServerLog.MessageType.ItemInteraction);
|
||||
item.CreateServerEvent(this, new object[] { signalIndex });
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
using Barotrauma.Networking;
|
||||
|
||||
namespace Barotrauma.Items.Components
|
||||
{
|
||||
partial class WifiComponent
|
||||
{
|
||||
public void ServerWrite(IWriteMessage msg, Client c, object[] extraData = null)
|
||||
{
|
||||
msg.WriteRangedInteger(Channel, MinChannel, MaxChannel);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user