(965c31410a) Unstable v0.10.4.0

This commit is contained in:
Juan Pablo Arce
2020-07-21 08:57:50 -03:00
parent 4f8bd39789
commit 33d3a41104
546 changed files with 45952 additions and 25762 deletions
@@ -5,21 +5,21 @@ namespace Barotrauma.Items.Components
{
partial class ItemLabel : ItemComponent, IDrawableComponent
{
[Serialize("", true, description: "The text to display on the label."), Editable(100)]
[Serialize("", true, description: "The text to display on the label.", alwaysUseInstanceValues: true), Editable(100)]
public string Text
{
get;
set;
}
[Editable, Serialize("0,0,0,255", true, description: "The color of the text displayed on the label.")]
[Editable, Serialize("0,0,0,255", true, description: "The color of the text displayed on the label.", alwaysUseInstanceValues: true)]
public Color TextColor
{
get;
set;
}
[Editable, Serialize(1.0f, true, description: "The scale of the text displayed on the label.")]
[Editable, Serialize(1.0f, true, description: "The scale of the text displayed on the label.", alwaysUseInstanceValues: true)]
public float TextScale
{
get;
@@ -0,0 +1,17 @@
using Barotrauma.Networking;
namespace Barotrauma.Items.Components
{
partial class OutpostTerminal : ItemComponent, IClientSerializable, IServerSerializable
{
public void ServerRead(ClientNetObject type, IReadMessage msg, Client c)
{
}
public void ServerWrite(IWriteMessage msg, Client c, object[] extraData = null)
{
}
}
}
@@ -136,6 +136,7 @@ namespace Barotrauma
{
if (Owner == c.Character)
{
HumanAIController.ItemTaken(item, c.Character);
GameServer.Log(GameServer.CharacterLogName(c.Character) + " picked up " + item.Name, ServerLog.MessageType.Inventory);
}
else
@@ -138,6 +138,32 @@ namespace Barotrauma
errorMsg = "Failed to write a ChangeProperty network event for the item \"" + Name + "\" (" + e.Message + ")";
}
break;
case NetEntityEvent.Type.Upgrade:
{
if (extraData.Length > 0 && extraData[1] is Upgrade upgrade)
{
var upgradeTargets = upgrade.TargetComponents;
msg.Write(upgrade.Identifier);
msg.Write((byte)upgrade.Level);
msg.Write((byte)upgradeTargets.Count);
foreach (var (_, value) in upgrade.TargetComponents)
{
msg.Write((byte)value.Length);
foreach (var propertyReference in value)
{
object originalValue = propertyReference.OriginalValue;
msg.Write((float)(originalValue ?? -1));
}
}
}
else
{
errorMsg = extraData.Length > 0
? $"Failed to write a network event for the item \"{Name}\" - \"{extraData[1].GetType()}\" is not a valid upgrade."
: $"Failed to write a network event for the item \"{Name}\". No upgrade specified.";
}
break;
}
default:
errorMsg = "Failed to write a network event for the item \"" + Name + "\" - \"" + eventType + "\" is not a valid entity event type for items.";
break;
@@ -152,7 +178,6 @@ namespace Barotrauma
DebugConsole.Log(errorMsg);
GameAnalyticsManager.AddErrorEventOnce("Item.ServerWrite:" + errorMsg, GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
}
}
public void ServerRead(ClientNetObject type, IReadMessage msg, Client c)
@@ -213,7 +238,7 @@ namespace Barotrauma
}
}
public void WriteSpawnData(IWriteMessage msg, UInt16 entityID, UInt16 originalInventoryID)
public void WriteSpawnData(IWriteMessage msg, UInt16 entityID, UInt16 originalInventoryID, byte originalItemContainerIndex)
{
if (GameMain.Server == null) return;
@@ -238,29 +263,14 @@ namespace Barotrauma
else
{
msg.Write(originalInventoryID);
//find the index of the ItemContainer this item is inside to get the item to
//spawn in the correct inventory in multi-inventory items like fabricators
byte containerIndex = 0;
if (Container != null)
{
for (int i = 0; i < Container.components.Count; i++)
{
if (Container.components[i] is ItemContainer container &&
container.Inventory == ParentInventory)
{
containerIndex = (byte)i;
break;
}
}
}
msg.Write(containerIndex);
msg.Write(originalItemContainerIndex);
int slotIndex = ParentInventory.FindIndex(this);
msg.Write(slotIndex < 0 ? (byte)255 : (byte)slotIndex);
}
msg.Write(body == null ? (byte)0 : (byte)body.BodyType);
msg.Write(SpawnedInOutpost);
byte teamID = 0;
foreach (WifiComponent wifiComponent in GetComponents<WifiComponent>())