This commit is contained in:
Evil Factory
2022-04-28 12:36:24 -03:00
91 changed files with 1140 additions and 491 deletions
@@ -1,17 +0,0 @@
using Barotrauma.Networking;
namespace Barotrauma.Items.Components
{
partial class OutpostTerminal : ItemComponent, IClientSerializable, IServerSerializable
{
public void ServerEventRead(IReadMessage msg, Client c)
{
}
public void ServerEventWrite(IWriteMessage msg, Client c, NetEntityEvent.IData extraData = null)
{
}
}
}
@@ -188,11 +188,10 @@ namespace Barotrauma.Items.Components
//already connected, no need to do anything
if (Connections[i].Wires.Contains(newWire)) { continue; }
Connections[i].TryAddLink(newWire);
newWire.Connect(Connections[i], true, true);
Connections[i].TryAddLink(newWire);
var otherConnection = newWire.OtherConnection(Connections[i]);
if (otherConnection == null)
{
GameServer.Log(GameServer.CharacterLogName(c.Character) + " connected a wire to " +
@@ -79,6 +79,7 @@ namespace Barotrauma
Vector2? worldPosition = applyStatusEffectEventData.WorldPosition;
Character targetCharacter = applyStatusEffectEventData.TargetCharacter;
if (targetCharacter != null && targetCharacter.Removed) { targetCharacter = null; }
byte targetLimbIndex = targetLimb != null && targetCharacter != null ? (byte)Array.IndexOf(targetCharacter.AnimController.Limbs, targetLimb) : (byte)255;
msg.WriteRangedInteger((int)actionType, 0, Enum.GetValues(typeof(ActionType)).Length - 1);
@@ -372,5 +373,20 @@ namespace Barotrauma
if (!ic.ValidateEventData(eventData)) { throw new Exception($"Component event creation failed: {typeof(T).Name}.{nameof(ItemComponent.ValidateEventData)} returned false"); }
GameMain.Server.CreateEntityEvent(this, eventData);
}
#if DEBUG
public void TryCreateServerEventSpam()
{
if (GameMain.Server == null) { return; }
foreach (ItemComponent ic in components)
{
if (!(ic is IServerSerializable)) { continue; }
var eventData = new ComponentStateEventData(ic, ic.ServerGetEventData());
if (!ic.ValidateEventData(eventData)) { continue; }
GameMain.Server.CreateEntityEvent(this, eventData);
}
}
#endif
}
}