Merge branch 'master' of https://github.com/Regalis11/Barotrauma.git
This commit is contained in:
@@ -1,19 +1,27 @@
|
||||
using Barotrauma.Networking;
|
||||
using System;
|
||||
|
||||
namespace Barotrauma.Items.Components
|
||||
{
|
||||
partial class DockingPort : ItemComponent, IDrawableComponent, IServerSerializable
|
||||
partial class DockingPort : ItemComponent, IDrawableComponent, IServerSerializable, IClientSerializable
|
||||
{
|
||||
public void ServerEventWrite(IWriteMessage msg, Client c, NetEntityEvent.IData extraData = null)
|
||||
{
|
||||
msg.Write(docked);
|
||||
|
||||
if (docked)
|
||||
{
|
||||
msg.Write(DockingTarget.item.ID);
|
||||
msg.Write(IsLocked);
|
||||
}
|
||||
}
|
||||
public void ServerEventRead(IReadMessage msg, Client c)
|
||||
{
|
||||
var allowOutpostAutoDocking = (AllowOutpostAutoDocking)msg.ReadByte();
|
||||
if (outpostAutoDockingPromptShown &&
|
||||
(GameMain.GameSession?.Campaign?.AllowedToManageCampaign(c, ClientPermissions.ManageMap) ?? false))
|
||||
{
|
||||
this.allowOutpostAutoDocking = allowOutpostAutoDocking;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Barotrauma.Items.Components
|
||||
set;
|
||||
}
|
||||
|
||||
public override void Move(Vector2 amount)
|
||||
public override void Move(Vector2 amount, bool ignoreContacts = false)
|
||||
{
|
||||
//do nothing
|
||||
}
|
||||
|
||||
@@ -1,13 +1,22 @@
|
||||
using Barotrauma.Networking;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Barotrauma.Items.Components
|
||||
{
|
||||
partial class Pump : Powered, IServerSerializable, IClientSerializable
|
||||
{
|
||||
const float NetworkUpdateInterval = 5.0f;
|
||||
private float networkUpdateTimer;
|
||||
|
||||
partial void UpdateProjSpecific(float deltaTime)
|
||||
{
|
||||
networkUpdateTimer -= deltaTime;
|
||||
if (networkUpdateTimer <= 0.0f)
|
||||
{
|
||||
item.CreateServerEvent(this);
|
||||
networkUpdateTimer = NetworkUpdateInterval;
|
||||
}
|
||||
}
|
||||
|
||||
public void ServerEventRead(IReadMessage msg, Client c)
|
||||
{
|
||||
float newFlowPercentage = msg.ReadRangedInteger(-10, 10) * 10.0f;
|
||||
|
||||
@@ -102,6 +102,7 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
msg.Write(autoPilot);
|
||||
msg.Write(TryExtractEventData<EventData>(extraData, out var eventData) && eventData.DockingButtonClicked);
|
||||
msg.Write(user?.ID ?? Entity.NullEntityID);
|
||||
|
||||
if (!autoPilot)
|
||||
{
|
||||
|
||||
@@ -15,7 +15,8 @@ namespace Barotrauma.Items.Components
|
||||
for (int i = 0; i < Connections.Count; i++)
|
||||
{
|
||||
wires[i] = new List<Wire>();
|
||||
for (int j = 0; j < Connections[i].MaxWires; j++)
|
||||
uint wireCount = msg.ReadVariableUInt32();
|
||||
for (int j = 0; j < wireCount; j++)
|
||||
{
|
||||
ushort wireId = msg.ReadUInt16();
|
||||
|
||||
@@ -91,12 +92,8 @@ namespace Barotrauma.Items.Components
|
||||
//go through existing wire links
|
||||
for (int i = 0; i < Connections.Count; i++)
|
||||
{
|
||||
int j = -1;
|
||||
foreach (Wire existingWire in Connections[i].Wires)
|
||||
foreach (Wire existingWire in Connections[i].Wires.ToArray())
|
||||
{
|
||||
j++;
|
||||
if (existingWire == null) { continue; }
|
||||
|
||||
//existing wire not in the list of new wires -> disconnect it
|
||||
if (!wires[i].Contains(existingWire))
|
||||
{
|
||||
@@ -163,7 +160,7 @@ namespace Barotrauma.Items.Components
|
||||
}*/
|
||||
}
|
||||
|
||||
Connections[i].SetWire(j, null);
|
||||
Connections[i].DisconnectWire(existingWire);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+22
-13
@@ -26,26 +26,34 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
for (int i = 0; i < customInterfaceElementList.Count; i++)
|
||||
{
|
||||
if (customInterfaceElementList[i].HasPropertyName)
|
||||
var element = customInterfaceElementList[i];
|
||||
if (element.HasPropertyName)
|
||||
{
|
||||
if (!customInterfaceElementList[i].IsIntegerInput)
|
||||
if (!element.IsNumberInput)
|
||||
{
|
||||
TextChanged(customInterfaceElementList[i], elementValues[i]);
|
||||
TextChanged(element, elementValues[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
int.TryParse(elementValues[i], out int value);
|
||||
ValueChanged(customInterfaceElementList[i], value);
|
||||
switch (element.NumberType)
|
||||
{
|
||||
case NumberType.Int when int.TryParse(elementValues[i], out int value):
|
||||
ValueChanged(element, value);
|
||||
break;
|
||||
case NumberType.Float when TryParseFloatInvariantCulture(elementValues[i], out float value):
|
||||
ValueChanged(element, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (customInterfaceElementList[i].ContinuousSignal)
|
||||
else if (element.ContinuousSignal)
|
||||
{
|
||||
TickBoxToggled(customInterfaceElementList[i], elementStates[i]);
|
||||
TickBoxToggled(element, elementStates[i]);
|
||||
}
|
||||
else if (elementStates[i])
|
||||
{
|
||||
clickedButton = customInterfaceElementList[i];
|
||||
ButtonClicked(customInterfaceElementList[i]);
|
||||
clickedButton = element;
|
||||
ButtonClicked(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,13 +69,14 @@ namespace Barotrauma.Items.Components
|
||||
//extradata contains an array of buttons clicked by a client (or nothing if nothing was clicked)
|
||||
for (int i = 0; i < customInterfaceElementList.Count; i++)
|
||||
{
|
||||
if (customInterfaceElementList[i].HasPropertyName)
|
||||
var element = customInterfaceElementList[i];
|
||||
if (element.HasPropertyName)
|
||||
{
|
||||
msg.Write(customInterfaceElementList[i].Signal);
|
||||
msg.Write(element.Signal);
|
||||
}
|
||||
else if (customInterfaceElementList[i].ContinuousSignal)
|
||||
else if(element.ContinuousSignal)
|
||||
{
|
||||
msg.Write(customInterfaceElementList[i].State);
|
||||
msg.Write(element.State);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user