Disposal mailing (#2194)
* Implement device networking * Implement device configuration menu * Fix device network * Implement disposal mailing unit * Implement base network connection Implement wired and wireless network connection Implement device network metadata * Fix dereference null error * Fix wired network null checks * Change BaseNetworks enum to NetworkUtils class Add PingResponse function to NetworkUtils Change device network file structure * Add doc comments * Apply suggestions from code review Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Add tag validation to disposal mailing unit * Add tag validation to the mailing unit component * Address reviews Change WiredNetwork can connect check Change device networking string literals to constants * Address reviews Revert changes to PowerProvider and PowerReceiver Add new NodeGroup WELP * Fix recursive access to Owner property * Integrate suggested changes * Fix TryGetWireNet acting on NullPowerProvider Fix network connections not checking if their owner has been deleted * Close device network connection when the owning entity got deleted Fix mailing unit not closing the device network connection on remove * Remove GetWireNet from NullPowerProvider Co-authored-by: Julian Giebel <j.giebel@netrocks.info> Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Robust.Shared.GameObjects.Components;
|
||||
using Robust.Shared.GameObjects.Components.UserInterface;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Disposal
|
||||
{
|
||||
public abstract class SharedDisposalMailingUnitComponent : SharedDisposalUnitComponent, ICollideSpecial
|
||||
{
|
||||
public override string Name => "DisposalMailingUnit";
|
||||
|
||||
public const string TAGS_MAIL = "mail";
|
||||
|
||||
public const string NET_TAG = "tag";
|
||||
public const string NET_SRC = "src";
|
||||
public const string NET_TARGET = "target";
|
||||
public const string NET_CMD_SENT = "mail_sent";
|
||||
public const string NET_CMD_REQUEST = "get_mailer_tag";
|
||||
public const string NET_CMD_RESPONSE = "mailer_tag";
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public new enum UiButton
|
||||
{
|
||||
Eject,
|
||||
Engage,
|
||||
Power
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public class DisposalMailingUnitBoundUserInterfaceState : BoundUserInterfaceState, IEquatable<DisposalMailingUnitBoundUserInterfaceState>, ICloneable
|
||||
{
|
||||
public readonly string UnitName;
|
||||
public readonly string UnitState;
|
||||
public readonly float Pressure;
|
||||
public readonly bool Powered;
|
||||
public readonly bool Engaged;
|
||||
public readonly string Tag;
|
||||
public readonly List<string> Tags;
|
||||
public readonly string Target;
|
||||
|
||||
public DisposalMailingUnitBoundUserInterfaceState(string unitName, string unitState, float pressure, bool powered,
|
||||
bool engaged, string tag, List<string> tags, string target)
|
||||
{
|
||||
UnitName = unitName;
|
||||
UnitState = unitState;
|
||||
Pressure = pressure;
|
||||
Powered = powered;
|
||||
Engaged = engaged;
|
||||
Tag = tag;
|
||||
Tags = tags;
|
||||
Target = target;
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
return new DisposalMailingUnitBoundUserInterfaceState(UnitName, UnitState, Pressure, Powered, Engaged, Tag, (List<string>)Tags.Clone(), Target);
|
||||
}
|
||||
|
||||
public bool Equals(DisposalMailingUnitBoundUserInterfaceState other)
|
||||
{
|
||||
if (other is null) return false;
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
return UnitName == other.UnitName &&
|
||||
UnitState == other.UnitState &&
|
||||
Powered == other.Powered &&
|
||||
Engaged == other.Engaged &&
|
||||
Pressure.Equals(other.Pressure) &&
|
||||
Tag == other.Tag &&
|
||||
Target == other.Target;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Message data sent from client to server when a mailing unit ui button is pressed.
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public new class UiButtonPressedMessage : BoundUserInterfaceMessage
|
||||
{
|
||||
public readonly UiButton Button;
|
||||
|
||||
public UiButtonPressedMessage(UiButton button)
|
||||
{
|
||||
Button = button;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Message data sent from client to server when the mailing units target is updated.
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public class UiTargetUpdateMessage : BoundUserInterfaceMessage
|
||||
{
|
||||
public readonly string Target;
|
||||
|
||||
public UiTargetUpdateMessage(string target)
|
||||
{
|
||||
Target = target;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum DisposalMailingUnitUiKey
|
||||
{
|
||||
Key
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user