Content update for NetEntities (#18935)

This commit is contained in:
metalgearsloth
2023-09-11 09:42:41 +10:00
committed by GitHub
parent 389c8d1a2c
commit 5a0fc68be2
526 changed files with 3058 additions and 2215 deletions

View File

@@ -61,9 +61,9 @@ public sealed class AccessReaderComponentState : ComponentState
public List<HashSet<string>> AccessLists;
public HashSet<StationRecordKey> AccessKeys;
public List<(NetEntity, uint)> AccessKeys;
public AccessReaderComponentState(bool enabled, HashSet<string> denyTags, List<HashSet<string>> accessLists, HashSet<StationRecordKey> accessKeys)
public AccessReaderComponentState(bool enabled, HashSet<string> denyTags, List<HashSet<string>> accessLists, List<(NetEntity, uint)> accessKeys)
{
Enabled = enabled;
DenyTags = denyTags;

View File

@@ -21,6 +21,7 @@ public sealed class AccessReaderSystem : EntitySystem
[Dependency] private readonly InventorySystem _inventorySystem = default!;
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
[Dependency] private readonly SharedStationRecordsSystem _records = default!;
public override void Initialize()
{
@@ -36,7 +37,7 @@ public sealed class AccessReaderSystem : EntitySystem
private void OnGetState(EntityUid uid, AccessReaderComponent component, ref ComponentGetState args)
{
args.State = new AccessReaderComponentState(component.Enabled, component.DenyTags, component.AccessLists,
component.AccessKeys);
_records.Convert(component.AccessKeys));
}
private void OnHandleState(EntityUid uid, AccessReaderComponent component, ref ComponentHandleState args)
@@ -44,7 +45,16 @@ public sealed class AccessReaderSystem : EntitySystem
if (args.Current is not AccessReaderComponentState state)
return;
component.Enabled = state.Enabled;
component.AccessKeys = new(state.AccessKeys);
component.AccessKeys.Clear();
foreach (var key in state.AccessKeys)
{
var id = EnsureEntity<AccessReaderComponent>(key.Item1, uid);
if (!id.IsValid())
continue;
component.AccessKeys.Add(new StationRecordKey(key.Item2, id));
}
component.AccessLists = new(state.AccessLists);
component.DenyTags = new(state.DenyTags);
}

View File

@@ -65,22 +65,22 @@ public sealed class GetItemActionsEvent : EntityEventArgs
[Serializable, NetSerializable]
public sealed class RequestPerformActionEvent : EntityEventArgs
{
public readonly EntityUid Action;
public readonly EntityUid? EntityTarget;
public readonly EntityCoordinates? EntityCoordinatesTarget;
public readonly NetEntity Action;
public readonly NetEntity? EntityTarget;
public readonly NetCoordinates? EntityCoordinatesTarget;
public RequestPerformActionEvent(EntityUid action)
public RequestPerformActionEvent(NetEntity action)
{
Action = action;
}
public RequestPerformActionEvent(EntityUid action, EntityUid entityTarget)
public RequestPerformActionEvent(NetEntity action, NetEntity entityTarget)
{
Action = action;
EntityTarget = entityTarget;
}
public RequestPerformActionEvent(EntityUid action, EntityCoordinates entityCoordinatesTarget)
public RequestPerformActionEvent(NetEntity action, NetCoordinates entityCoordinatesTarget)
{
Action = action;
EntityCoordinatesTarget = entityCoordinatesTarget;

View File

@@ -21,9 +21,9 @@ public sealed partial class ActionsComponent : Component
[Serializable, NetSerializable]
public sealed class ActionsComponentState : ComponentState
{
public readonly HashSet<EntityUid> Actions;
public readonly HashSet<NetEntity> Actions;
public ActionsComponentState(HashSet<EntityUid> actions)
public ActionsComponentState(HashSet<NetEntity> actions)
{
Actions = actions;
}

View File

@@ -149,19 +149,19 @@ public abstract class BaseActionComponentState : ComponentState
public (TimeSpan Start, TimeSpan End)? Cooldown;
public TimeSpan? UseDelay;
public int? Charges;
public EntityUid? Provider;
public EntityUid? EntityIcon;
public NetEntity? Provider;
public NetEntity? EntityIcon;
public bool CheckCanInteract;
public bool ClientExclusive;
public int Priority;
public EntityUid? AttachedEntity;
public NetEntity? AttachedEntity;
public bool AutoPopulate;
public bool AutoRemove;
public bool Temporary;
public ItemActionIconStyle ItemIconStyle;
public SoundSpecifier? Sound;
protected BaseActionComponentState(BaseActionComponent component)
protected BaseActionComponentState(BaseActionComponent component, IEntityManager entManager)
{
Icon = component.Icon;
IconOn = component.IconOn;
@@ -172,12 +172,18 @@ public abstract class BaseActionComponentState : ComponentState
Cooldown = component.Cooldown;
UseDelay = component.UseDelay;
Charges = component.Charges;
Provider = component.Provider;
EntityIcon = component.EntityIcon;
// TODO ACTION REFACTOR fix bugs
if (entManager.TryGetNetEntity(component.Provider, out var provider))
Provider = provider;
if (entManager.TryGetNetEntity(component.EntityIcon, out var icon))
EntityIcon = icon;
if (entManager.TryGetNetEntity(component.AttachedEntity, out var attached))
AttachedEntity = attached;
CheckCanInteract = component.CheckCanInteract;
ClientExclusive = component.ClientExclusive;
Priority = component.Priority;
AttachedEntity = component.AttachedEntity;
AutoPopulate = component.AutoPopulate;
AutoRemove = component.AutoRemove;
Temporary = component.Temporary;

View File

@@ -27,7 +27,7 @@ public sealed class EntityTargetActionComponentState : BaseActionComponentState
public EntityWhitelist? Whitelist;
public bool CanTargetSelf;
public EntityTargetActionComponentState(EntityTargetActionComponent component) : base(component)
public EntityTargetActionComponentState(EntityTargetActionComponent component, IEntityManager entManager) : base(component, entManager)
{
Whitelist = component.Whitelist;
CanTargetSelf = component.CanTargetSelf;

View File

@@ -19,7 +19,7 @@ public sealed partial class InstantActionComponent : BaseActionComponent
[Serializable, NetSerializable]
public sealed class InstantActionComponentState : BaseActionComponentState
{
public InstantActionComponentState(InstantActionComponent component) : base(component)
public InstantActionComponentState(InstantActionComponent component, IEntityManager entManager) : base(component, entManager)
{
}
}

View File

@@ -65,20 +65,20 @@ public abstract class SharedActionsSystem : EntitySystem
private void OnInstantGetState(EntityUid uid, InstantActionComponent component, ref ComponentGetState args)
{
args.State = new InstantActionComponentState(component);
args.State = new InstantActionComponentState(component, EntityManager);
}
private void OnEntityTargetGetState(EntityUid uid, EntityTargetActionComponent component, ref ComponentGetState args)
{
args.State = new EntityTargetActionComponentState(component);
args.State = new EntityTargetActionComponentState(component, EntityManager);
}
private void OnWorldTargetGetState(EntityUid uid, WorldTargetActionComponent component, ref ComponentGetState args)
{
args.State = new WorldTargetActionComponentState(component);
args.State = new WorldTargetActionComponentState(component, EntityManager);
}
private void BaseHandleState(BaseActionComponent component, BaseActionComponentState state)
private void BaseHandleState<T>(EntityUid uid, BaseActionComponent component, BaseActionComponentState state) where T : BaseActionComponent
{
component.Icon = state.Icon;
component.IconOn = state.IconOn;
@@ -89,12 +89,12 @@ public abstract class SharedActionsSystem : EntitySystem
component.Cooldown = state.Cooldown;
component.UseDelay = state.UseDelay;
component.Charges = state.Charges;
component.Provider = state.Provider;
component.EntityIcon = state.EntityIcon;
component.Provider = EnsureEntity<T>(state.Provider, uid);
component.EntityIcon = EnsureEntity<T>(state.EntityIcon, uid);
component.CheckCanInteract = state.CheckCanInteract;
component.ClientExclusive = state.ClientExclusive;
component.Priority = state.Priority;
component.AttachedEntity = state.AttachedEntity;
component.AttachedEntity = EnsureEntity<T>(state.AttachedEntity, uid);
component.AutoPopulate = state.AutoPopulate;
component.AutoRemove = state.AutoRemove;
component.Temporary = state.Temporary;
@@ -107,7 +107,7 @@ public abstract class SharedActionsSystem : EntitySystem
if (args.Current is not InstantActionComponentState state)
return;
BaseHandleState(component, state);
BaseHandleState<InstantActionComponent>(uid, component, state);
}
private void OnEntityTargetHandleState(EntityUid uid, EntityTargetActionComponent component, ref ComponentHandleState args)
@@ -115,7 +115,7 @@ public abstract class SharedActionsSystem : EntitySystem
if (args.Current is not EntityTargetActionComponentState state)
return;
BaseHandleState(component, state);
BaseHandleState<EntityTargetActionComponent>(uid, component, state);
component.Whitelist = state.Whitelist;
component.CanTargetSelf = state.CanTargetSelf;
}
@@ -125,7 +125,7 @@ public abstract class SharedActionsSystem : EntitySystem
if (args.Current is not WorldTargetActionComponentState state)
return;
BaseHandleState(component, state);
BaseHandleState<WorldTargetActionComponent>(uid, component, state);
}
private void OnGetActionData<T>(EntityUid uid, T component, ref GetActionDataEvent args) where T : BaseActionComponent
@@ -177,7 +177,7 @@ public abstract class SharedActionsSystem : EntitySystem
protected bool TryGetContainer(
EntityUid holderId,
[NotNullWhen(true)] out IContainer? container,
[NotNullWhen(true)] out BaseContainer? container,
ContainerManagerComponent? containerManager = null)
{
return _containerSystem.TryGetContainer(holderId, ActionContainerId, out container, containerManager);
@@ -185,7 +185,7 @@ public abstract class SharedActionsSystem : EntitySystem
protected bool TryGetProvidedContainer(
EntityUid providerId,
[NotNullWhen(true)] out IContainer? container,
[NotNullWhen(true)] out BaseContainer? container,
ContainerManagerComponent? containerManager = null)
{
return _containerSystem.TryGetContainer(providerId, ProvidedActionContainerId, out container, containerManager);
@@ -215,7 +215,9 @@ public abstract class SharedActionsSystem : EntitySystem
if (action.AttachedEntity == null)
return;
if (!TryComp(action.AttachedEntity, out ActionsComponent? comp))
var ent = action.AttachedEntity;
if (!TryComp(ent, out ActionsComponent? comp))
{
action.AttachedEntity = null;
return;
@@ -267,7 +269,7 @@ public abstract class SharedActionsSystem : EntitySystem
private void OnActionsGetState(EntityUid uid, ActionsComponent component, ref ComponentGetState args)
{
args.State = new ActionsComponentState(component.Actions);
args.State = new ActionsComponentState(GetNetEntitySet(component.Actions));
}
private void OnActionsShutdown(EntityUid uid, ActionsComponent component, ComponentShutdown args)
@@ -291,20 +293,22 @@ public abstract class SharedActionsSystem : EntitySystem
if (!TryComp(user, out ActionsComponent? component))
return;
if (!TryComp(ev.Action, out MetaDataComponent? metaData))
var actionEnt = GetEntity(ev.Action);
if (!TryComp(actionEnt, out MetaDataComponent? metaData))
return;
var name = Name(ev.Action, metaData);
var name = Name(actionEnt, metaData);
// Does the user actually have the requested action?
if (!component.Actions.Contains(ev.Action))
if (!component.Actions.Contains(actionEnt))
{
_adminLogger.Add(LogType.Action,
$"{ToPrettyString(user):user} attempted to perform an action that they do not have: {name}.");
return;
}
var action = GetActionData(ev.Action);
var action = GetActionData(actionEnt);
if (action == null || !action.Enabled)
return;
@@ -318,12 +322,14 @@ public abstract class SharedActionsSystem : EntitySystem
switch (action)
{
case EntityTargetActionComponent entityAction:
if (ev.EntityTarget is not { Valid: true } entityTarget)
if (ev.EntityTarget is not { Valid: true } netTarget)
{
Log.Error($"Attempted to perform an entity-targeted action without a target! Action: {name}");
return;
}
var entityTarget = GetEntity(netTarget);
var targetWorldPos = _transformSystem.GetWorldPosition(entityTarget);
_rotateToFaceSystem.TryFaceCoordinates(user, targetWorldPos);
@@ -344,18 +350,19 @@ public abstract class SharedActionsSystem : EntitySystem
if (entityAction.Event != null)
{
entityAction.Event.Target = entityTarget;
Dirty(ev.Action, entityAction);
Dirty(actionEnt, entityAction);
performEvent = entityAction.Event;
}
break;
case WorldTargetActionComponent worldAction:
if (ev.EntityCoordinatesTarget is not { } entityCoordinatesTarget)
if (ev.EntityCoordinatesTarget is not { } netCoordinatesTarget)
{
Log.Error($"Attempted to perform a world-targeted action without a target! Action: {name}");
return;
}
var entityCoordinatesTarget = GetCoordinates(netCoordinatesTarget);
_rotateToFaceSystem.TryFaceCoordinates(user, entityCoordinatesTarget.Position);
if (!ValidateWorldTarget(user, entityCoordinatesTarget, worldAction))
@@ -375,7 +382,7 @@ public abstract class SharedActionsSystem : EntitySystem
if (worldAction.Event != null)
{
worldAction.Event.Target = entityCoordinatesTarget;
Dirty(ev.Action, worldAction);
Dirty(actionEnt, worldAction);
performEvent = worldAction.Event;
}
@@ -403,7 +410,7 @@ public abstract class SharedActionsSystem : EntitySystem
performEvent.Performer = user;
// All checks passed. Perform the action!
PerformAction(user, component, ev.Action, action, performEvent, curTime);
PerformAction(user, component, actionEnt, action, performEvent, curTime);
}
public bool ValidateEntityTarget(EntityUid user, EntityUid target, EntityTargetActionComponent action)
@@ -477,11 +484,12 @@ public abstract class SharedActionsSystem : EntitySystem
{
// This here is required because of client-side prediction (RaisePredictiveEvent results in event re-use).
actionEvent.Handled = false;
var provider = action.Provider;
if (action.Provider == null)
if (provider == null)
RaiseLocalEvent(performer, (object) actionEvent, broadcast: true);
else
RaiseLocalEvent(action.Provider.Value, (object) actionEvent, broadcast: true);
RaiseLocalEvent(provider.Value, (object) actionEvent, broadcast: true);
handled = actionEvent.Handled;
}
@@ -550,7 +558,7 @@ public abstract class SharedActionsSystem : EntitySystem
/// <param name="holder">Component of <see cref="holderId"/></param>
/// <param name="action">Component of <see cref="actionId"/></param>
/// <param name="actionContainer">Action container of <see cref="holderId"/></param>
public virtual void AddAction(EntityUid holderId, EntityUid actionId, EntityUid? provider, ActionsComponent? holder = null, BaseActionComponent? action = null, bool dirty = true, IContainer? actionContainer = null)
public virtual void AddAction(EntityUid holderId, EntityUid actionId, EntityUid? provider, ActionsComponent? holder = null, BaseActionComponent? action = null, bool dirty = true, BaseContainer? actionContainer = null)
{
action ??= GetActionData(actionId);
// TODO remove when action subscriptions are split up
@@ -572,7 +580,7 @@ public abstract class SharedActionsSystem : EntitySystem
Dirty(holderId, holder);
}
protected virtual void AddActionInternal(EntityUid holderId, EntityUid actionId, IContainer container, ActionsComponent holder)
protected virtual void AddActionInternal(EntityUid holderId, EntityUid actionId, BaseContainer container, ActionsComponent holder)
{
container.Insert(actionId);
holder.Actions.Add(actionId);

View File

@@ -19,7 +19,7 @@ public sealed partial class WorldTargetActionComponent : BaseTargetActionCompone
[Serializable, NetSerializable]
public sealed class WorldTargetActionComponentState : BaseActionComponentState
{
public WorldTargetActionComponentState(WorldTargetActionComponent component) : base(component)
public WorldTargetActionComponentState(WorldTargetActionComponent component, IEntityManager entManager) : base(component, entManager)
{
}
}

View File

@@ -7,10 +7,10 @@ namespace Content.Shared.Administration
[Serializable, NetSerializable]
public sealed class EditSolutionsEuiState : EuiStateBase
{
public readonly EntityUid Target;
public readonly NetEntity Target;
public readonly Dictionary<string, Solution>? Solutions;
public EditSolutionsEuiState(EntityUid target, Dictionary<string, Solution>? solutions)
public EditSolutionsEuiState(NetEntity target, Dictionary<string, Solution>? solutions)
{
Target = target;
Solutions = solutions;

View File

@@ -10,7 +10,7 @@ namespace Content.Shared.Administration
string IdentityName,
string StartingJob,
bool Antag,
EntityUid? EntityUid,
NetEntity? NetEntity,
NetUserId SessionId,
bool Connected,
bool ActiveThisRound);

View File

@@ -6,6 +6,6 @@ namespace Content.Shared.Administration
[Serializable, NetSerializable]
public sealed class SetOutfitEuiState : EuiStateBase
{
public EntityUid TargetEntityId;
public NetEntity TargetNetEntity;
}
}

View File

@@ -32,11 +32,11 @@ public sealed partial class GasAnalyzerComponent : Component
public sealed class GasAnalyzerUserMessage : BoundUserInterfaceMessage
{
public string DeviceName;
public EntityUid DeviceUid;
public NetEntity DeviceUid;
public bool DeviceFlipped;
public string? Error;
public GasMixEntry[] NodeGasMixes;
public GasAnalyzerUserMessage(GasMixEntry[] nodeGasMixes, string deviceName, EntityUid deviceUid, bool deviceFlipped, string? error = null)
public GasAnalyzerUserMessage(GasMixEntry[] nodeGasMixes, string deviceName, NetEntity deviceUid, bool deviceFlipped, string? error = null)
{
NodeGasMixes = nodeGasMixes;
DeviceName = deviceName;

View File

@@ -39,13 +39,13 @@ namespace Content.Shared.Atmos.EntitySystems
[Serializable, NetSerializable]
public sealed class AtmosDebugOverlayMessage : EntityEventArgs
{
public EntityUid GridId { get; }
public NetEntity GridId { get; }
public Vector2i BaseIdx { get; }
// LocalViewRange*LocalViewRange
public AtmosDebugOverlayData[] OverlayData { get; }
public AtmosDebugOverlayMessage(EntityUid gridIndices, Vector2i baseIdx, AtmosDebugOverlayData[] overlayData)
public AtmosDebugOverlayMessage(NetEntity gridIndices, Vector2i baseIdx, AtmosDebugOverlayData[] overlayData)
{
GridId = gridIndices;
BaseIdx = baseIdx;

View File

@@ -103,8 +103,8 @@ namespace Content.Shared.Atmos.EntitySystems
[Serializable, NetSerializable]
public sealed class GasOverlayUpdateEvent : EntityEventArgs
{
public Dictionary<EntityUid, List<GasOverlayChunk>> UpdatedChunks = new();
public Dictionary<EntityUid, HashSet<Vector2i>> RemovedChunks = new();
public Dictionary<NetEntity, List<GasOverlayChunk>> UpdatedChunks = new();
public Dictionary<NetEntity, HashSet<Vector2i>> RemovedChunks = new();
}
}
}

View File

@@ -97,13 +97,13 @@ public sealed class BeamFiredEvent : EntityEventArgs
[Serializable, NetSerializable]
public sealed class BeamVisualizerEvent : EntityEventArgs
{
public readonly EntityUid Beam;
public readonly NetEntity Beam;
public readonly float DistanceLength;
public readonly Angle UserAngle;
public readonly string? BodyState;
public readonly string Shader = "unshaded";
public BeamVisualizerEvent(EntityUid beam, float distanceLength, Angle userAngle, string? bodyState = null, string shader = "unshaded")
public BeamVisualizerEvent(NetEntity beam, float distanceLength, Angle userAngle, string? bodyState = null, string shader = "unshaded")
{
Beam = beam;
DistanceLength = distanceLength;

View File

@@ -5,10 +5,10 @@ namespace Content.Shared.Body.Organ;
[Serializable, NetSerializable]
public sealed class OrganComponentState : ComponentState
{
public readonly EntityUid? Body;
public readonly NetEntity? Body;
public readonly OrganSlot? Parent;
public OrganComponentState(EntityUid? body, OrganSlot? parent)
public OrganComponentState(NetEntity? body, OrganSlot? parent)
{
Body = body;
Parent = parent;

View File

@@ -5,10 +5,23 @@ namespace Content.Shared.Body.Organ;
[Serializable, NetSerializable]
[Access(typeof(SharedBodySystem))]
[DataRecord]
public sealed record OrganSlot(string Id, EntityUid Parent)
[DataDefinition]
public sealed partial record OrganSlot
{
public EntityUid? Child { get; set; }
[DataField("id")]
public string Id = string.Empty;
[NonSerialized]
[DataField("parent")]
public EntityUid Parent;
public NetEntity NetParent;
[NonSerialized]
[DataField("child")]
public EntityUid? Child;
public NetEntity? NetChild;
// Rider doesn't suggest explicit properties during deconstruction without this
public void Deconstruct(out EntityUid? child, out string id, out EntityUid parent)

View File

@@ -6,7 +6,7 @@ namespace Content.Shared.Body.Part;
[Serializable, NetSerializable]
public sealed class BodyPartComponentState : ComponentState
{
public readonly EntityUid? Body;
public readonly NetEntity? Body;
public readonly BodyPartSlot? ParentSlot;
public readonly Dictionary<string, BodyPartSlot> Children;
public readonly Dictionary<string, OrganSlot> Organs;
@@ -15,7 +15,7 @@ public sealed class BodyPartComponentState : ComponentState
public readonly BodyPartSymmetry Symmetry;
public BodyPartComponentState(
EntityUid? body,
NetEntity? body,
BodyPartSlot? parentSlot,
Dictionary<string, BodyPartSlot> children,
Dictionary<string, OrganSlot> organs,

View File

@@ -5,10 +5,32 @@ namespace Content.Shared.Body.Part;
[Serializable, NetSerializable]
[Access(typeof(SharedBodySystem))]
[DataRecord]
public sealed record BodyPartSlot(string Id, EntityUid Parent, BodyPartType? Type)
[DataDefinition]
public sealed partial record BodyPartSlot
{
public EntityUid? Child { get; set; }
[DataField("id")]
public string Id = string.Empty;
[DataField("type")]
public BodyPartType? Type;
[NonSerialized]
[DataField("parent")]
public EntityUid Parent;
public NetEntity NetParent;
[NonSerialized]
[DataField("child")]
public EntityUid? Child;
public NetEntity? NetChild;
public void SetChild(EntityUid? child, NetEntity? netChild)
{
Child = child;
NetChild = netChild;
}
// Rider doesn't suggest explicit properties during deconstruction without this
public void Deconstruct(out EntityUid? child, out string id, out EntityUid parent, out BodyPartType? type)

View File

@@ -38,7 +38,7 @@ public partial class SharedBodySystem
var prototype = Prototypes.Index<BodyPrototype>(body.Prototype);
if (!_netManager.IsClient || bodyId.IsClientSide())
if (!_netManager.IsClient || IsClientSide(bodyId))
InitBody(body, prototype);
Dirty(body); // Client doesn't actually spawn the body, need to sync it
@@ -72,7 +72,12 @@ public partial class SharedBodySystem
body.Root != null)
return false;
slot = new BodyPartSlot(slotId, bodyId.Value, null);
slot = new BodyPartSlot
{
Id = slotId,
Parent = bodyId.Value,
NetParent = GetNetEntity(bodyId.Value),
};
body.Root = slot;
return true;
@@ -86,7 +91,13 @@ public partial class SharedBodySystem
return;
var bodyId = Spawn(root.Part, body.Owner.ToCoordinates());
var partComponent = Comp<BodyPartComponent>(bodyId);
var slot = new BodyPartSlot(root.Part, body.Owner, partComponent.PartType);
var slot = new BodyPartSlot
{
Id = root.Part,
Type = partComponent.PartType,
Parent = body.Owner,
NetParent = GetNetEntity(body.Owner),
};
body.Root = slot;
partComponent.Body = bodyId;

View File

@@ -12,6 +12,8 @@ namespace Content.Shared.Body.Systems;
public partial class SharedBodySystem
{
[Dependency] private readonly SharedContainerSystem _container = default!;
private void InitializeOrgans()
{
SubscribeLocalEvent<OrganComponent, ComponentGetState>(OnOrganGetState);
@@ -23,7 +25,12 @@ public partial class SharedBodySystem
if (!Resolve(parent, ref part, false))
return null;
var slot = new OrganSlot(slotId, parent);
var slot = new OrganSlot()
{
Id = slotId,
Parent = parent,
NetParent = GetNetEntity(parent),
};
part.Organs.Add(slotId, slot);
return slot;
@@ -35,12 +42,12 @@ public partial class SharedBodySystem
slot.Child == null &&
Resolve(organId.Value, ref organ, false) &&
Containers.TryGetContainer(slot.Parent, BodyContainerId, out var container) &&
container.CanInsert(organId.Value);
_container.CanInsert(organId.Value, container);
}
private void OnOrganGetState(EntityUid uid, OrganComponent organ, ref ComponentGetState args)
{
args.State = new OrganComponentState(organ.Body, organ.ParentSlot);
args.State = new OrganComponentState(GetNetEntity(organ.Body), organ.ParentSlot);
}
private void OnOrganHandleState(EntityUid uid, OrganComponent organ, ref ComponentHandleState args)
@@ -48,7 +55,7 @@ public partial class SharedBodySystem
if (args.Current is not OrganComponentState state)
return;
organ.Body = state.Body;
organ.Body = EnsureEntity<OrganComponent>(state.Body, uid);
organ.ParentSlot = state.Parent;
}

View File

@@ -26,7 +26,7 @@ public partial class SharedBodySystem
private void OnPartGetState(EntityUid uid, BodyPartComponent part, ref ComponentGetState args)
{
args.State = new BodyPartComponentState(
part.Body,
GetNetEntity(part.Body),
part.ParentSlot,
part.Children,
part.Organs,
@@ -41,7 +41,7 @@ public partial class SharedBodySystem
if (args.Current is not BodyPartComponentState state)
return;
part.Body = state.Body;
part.Body = EnsureEntity<BodyPartComponent>(state.Body, uid);
part.ParentSlot = state.ParentSlot; // TODO use containers. This is broken and does not work.
part.Children = state.Children; // TODO use containers. This is broken and does not work.
part.Organs = state.Organs; // TODO end my suffering.
@@ -54,7 +54,7 @@ public partial class SharedBodySystem
{
if (part.ParentSlot is { } slot)
{
slot.Child = null;
slot.SetChild(null, GetNetEntity(null));
DirtyAllComponents(slot.Parent);
}
@@ -73,7 +73,13 @@ public partial class SharedBodySystem
if (!Resolve(parent, ref part, false))
return null;
var slot = new BodyPartSlot(slotId, parent, partType);
var slot = new BodyPartSlot
{
Id = slotId,
Type = partType,
Parent = parent,
NetParent = GetNetEntity(parent),
};
part.Children.Add(slotId, slot);
return slot;
@@ -91,7 +97,12 @@ public partial class SharedBodySystem
!Resolve(parentId.Value, ref parent, false))
return false;
slot = new BodyPartSlot(id, parentId.Value, null);
slot = new BodyPartSlot
{
Id = id,
Parent = parentId.Value,
NetParent = GetNetEntity(parentId.Value),
};
if (!parent.Children.TryAdd(id, slot))
{
slot = null;
@@ -171,7 +182,7 @@ public partial class SharedBodySystem
Resolve(partId.Value, ref part, false) &&
(slot.Type == null || slot.Type == part.PartType) &&
Containers.TryGetContainer(slot.Parent, BodyContainerId, out var container) &&
container.CanInsert(partId.Value);
_container.CanInsert(partId.Value, container);
}
public virtual bool AttachPart(
@@ -191,7 +202,7 @@ public partial class SharedBodySystem
if (!container.Insert(partId.Value))
return false;
slot.Child = partId;
slot.SetChild(partId, GetNetEntity(partId));
part.ParentSlot = slot;
if (TryComp(slot.Parent, out BodyPartComponent? parentPart))
@@ -241,7 +252,7 @@ public partial class SharedBodySystem
var oldBodyNullable = part.Body;
slot.Child = null;
slot.SetChild(null, null);
part.ParentSlot = null;
part.Body = null;

View File

@@ -6,9 +6,9 @@ namespace Content.Shared.Bql;
[Serializable, NetSerializable]
public sealed class ToolshedVisualizeEuiState : EuiStateBase
{
public readonly (string name, EntityUid entity)[] Entities;
public readonly (string name, NetEntity entity)[] Entities;
public ToolshedVisualizeEuiState((string name, EntityUid entity)[] entities)
public ToolshedVisualizeEuiState((string name, NetEntity entity)[] entities)
{
Entities = entities;
}

View File

@@ -78,7 +78,7 @@ public sealed partial class BuckleComponent : Component
[Serializable, NetSerializable]
public sealed class BuckleComponentState : ComponentState
{
public BuckleComponentState(bool buckled, EntityUid? buckledTo, EntityUid? lastEntityBuckledTo,
public BuckleComponentState(bool buckled, NetEntity? buckledTo, NetEntity? lastEntityBuckledTo,
bool dontCollide)
{
Buckled = buckled;
@@ -88,8 +88,8 @@ public sealed class BuckleComponentState : ComponentState
}
public readonly bool Buckled;
public readonly EntityUid? BuckledTo;
public readonly EntityUid? LastEntityBuckledTo;
public readonly NetEntity? BuckledTo;
public readonly NetEntity? LastEntityBuckledTo;
public readonly bool DontCollide;
}

View File

@@ -125,10 +125,10 @@ public sealed class StrapComponentState : ComponentState
public readonly StrapPosition Position;
public readonly float MaxBuckleDistance;
public readonly Vector2 BuckleOffsetClamped;
public readonly HashSet<EntityUid> BuckledEntities;
public readonly HashSet<NetEntity> BuckledEntities;
public readonly int OccupiedSize;
public StrapComponentState(StrapPosition position, Vector2 offset, HashSet<EntityUid> buckled,
public StrapComponentState(StrapPosition position, Vector2 offset, HashSet<NetEntity> buckled,
float maxBuckleDistance, int occupiedSize)
{
Position = position;

View File

@@ -59,7 +59,7 @@ public abstract partial class SharedBuckleSystem
private void OnBuckleComponentGetState(EntityUid uid, BuckleComponent component, ref ComponentGetState args)
{
args.State = new BuckleComponentState(component.Buckled, component.BuckledTo, component.LastEntityBuckledTo, component.DontCollide);
args.State = new BuckleComponentState(component.Buckled, GetNetEntity(component.BuckledTo), GetNetEntity(component.LastEntityBuckledTo), component.DontCollide);
}
private void OnBuckleMove(EntityUid uid, BuckleComponent component, ref MoveEvent ev)

View File

@@ -52,7 +52,7 @@ public abstract partial class SharedBuckleSystem
private void OnStrapGetState(EntityUid uid, StrapComponent component, ref ComponentGetState args)
{
args.State = new StrapComponentState(component.Position, component.BuckleOffset, component.BuckledEntities, component.MaxBuckleDistance, component.OccupiedSize);
args.State = new StrapComponentState(component.Position, component.BuckleOffset, GetNetEntitySet(component.BuckledEntities), component.MaxBuckleDistance, component.OccupiedSize);
}
private void OnStrapHandleState(EntityUid uid, StrapComponent component, ref ComponentHandleState args)
@@ -63,7 +63,7 @@ public abstract partial class SharedBuckleSystem
component.Position = state.Position;
component.BuckleOffsetUnclamped = state.BuckleOffsetClamped;
component.BuckledEntities.Clear();
component.BuckledEntities.UnionWith(state.BuckledEntities);
component.BuckledEntities.UnionWith(EnsureEntitySet<StrapComponent>(state.BuckledEntities, uid));
component.MaxBuckleDistance = state.MaxBuckleDistance;
component.OccupiedSize = state.OccupiedSize;
}

View File

@@ -82,12 +82,12 @@ public abstract class SharedCameraRecoilSystem : EntitySystem
[NetSerializable]
public sealed class CameraKickEvent : EntityEventArgs
{
public readonly EntityUid Euid;
public readonly NetEntity NetEntity;
public readonly Vector2 Recoil;
public CameraKickEvent(EntityUid euid, Vector2 recoil)
public CameraKickEvent(NetEntity netEntity, Vector2 recoil)
{
Recoil = recoil;
Euid = euid;
NetEntity = netEntity;
}
}

View File

@@ -61,10 +61,10 @@ public sealed partial class CardboardBoxComponent : Component
[Serializable, NetSerializable]
public sealed class PlayBoxEffectMessage : EntityEventArgs
{
public EntityUid Source;
public EntityUid Mover;
public NetEntity Source;
public NetEntity Mover;
public PlayBoxEffectMessage(EntityUid source, EntityUid mover)
public PlayBoxEffectMessage(NetEntity source, NetEntity mover)
{
Source = source;
Mover = mover;

View File

@@ -14,7 +14,7 @@ public sealed partial class CartridgeLoaderComponent : Component
/// <summary>
/// List of programs that come preinstalled with this cartridge loader
/// </summary>
[DataField("preinstalled")]
[DataField("preinstalled")] // TODO remove this and use container fill.
public List<string> PreinstalledPrograms = new();
/// <summary>
@@ -29,12 +29,6 @@ public sealed partial class CartridgeLoaderComponent : Component
[ViewVariables]
public readonly List<EntityUid> BackgroundPrograms = new();
/// <summary>
/// The list of program entities that are spawned into the cartridge loaders program container
/// </summary>
[DataField("installedCartridges")]
public List<EntityUid> InstalledPrograms = new();
/// <summary>
/// The maximum amount of programs that can be installed on the cartridge loader entity
/// </summary>

View File

@@ -5,10 +5,10 @@ namespace Content.Shared.CartridgeLoader;
[Serializable, NetSerializable]
public sealed class CartridgeLoaderUiMessage : BoundUserInterfaceMessage
{
public readonly EntityUid CartridgeUid;
public readonly NetEntity CartridgeUid;
public readonly CartridgeUiMessageAction Action;
public CartridgeLoaderUiMessage(EntityUid cartridgeUid, CartridgeUiMessageAction action)
public CartridgeLoaderUiMessage(NetEntity cartridgeUid, CartridgeUiMessageAction action)
{
CartridgeUid = cartridgeUid;
Action = action;

View File

@@ -7,6 +7,12 @@ namespace Content.Shared.CartridgeLoader;
[Serializable, NetSerializable]
public class CartridgeLoaderUiState : BoundUserInterfaceState
{
public EntityUid? ActiveUI;
public List<EntityUid> Programs = new();
public NetEntity? ActiveUI;
public List<NetEntity> Programs;
public CartridgeLoaderUiState(List<NetEntity> programs, NetEntity? activeUI)
{
Programs = programs;
ActiveUI = activeUI;
}
}

View File

@@ -16,5 +16,5 @@ public sealed class CartridgeUiMessage : BoundUserInterfaceMessage
[Serializable, NetSerializable]
public abstract class CartridgeMessageEvent : EntityEventArgs
{
public EntityUid LoaderUid;
public NetEntity LoaderUid;
}

View File

@@ -5,7 +5,7 @@ namespace Content.Shared.CartridgeLoader.Cartridges;
[Serializable, NetSerializable]
public sealed class NotekeeperUiState : BoundUserInterfaceState
{
public List<String> Notes;
public List<string> Notes;
public NotekeeperUiState(List<string> notes)
{

View File

@@ -2,13 +2,18 @@
using Robust.Shared.Containers;
using Robust.Shared.GameStates;
using Robust.Shared.Map;
using Robust.Shared.Network;
namespace Content.Shared.CartridgeLoader;
public abstract class SharedCartridgeLoaderSystem : EntitySystem
{
public const string InstalledContainerId = "program-container";
[Dependency] private readonly ItemSlotsSystem _itemSlotsSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearanceSystem = default!;
[Dependency] private readonly SharedContainerSystem _container = default!;
[Dependency] private readonly INetManager _netMan = default!;
public override void Initialize()
{
@@ -36,11 +41,8 @@ public abstract class SharedCartridgeLoaderSystem : EntitySystem
private void OnComponentRemove(EntityUid uid, CartridgeLoaderComponent loader, ComponentRemove args)
{
_itemSlotsSystem.RemoveItemSlot(uid, loader.CartridgeSlot);
foreach (var program in loader.InstalledPrograms)
{
EntityManager.QueueDeleteEntity(program);
}
if (_container.TryGetContainer(uid, InstalledContainerId, out var cont))
cont.Shutdown(EntityManager, _netMan);
}
protected virtual void OnItemInserted(EntityUid uid, CartridgeLoaderComponent loader, EntInsertedIntoContainerMessage args)

View File

@@ -6,25 +6,25 @@ namespace Content.Shared.CharacterInfo;
[Serializable, NetSerializable]
public sealed class RequestCharacterInfoEvent : EntityEventArgs
{
public readonly EntityUid EntityUid;
public readonly NetEntity NetEntity;
public RequestCharacterInfoEvent(EntityUid entityUid)
public RequestCharacterInfoEvent(NetEntity netEntity)
{
EntityUid = entityUid;
NetEntity = netEntity;
}
}
[Serializable, NetSerializable]
public sealed class CharacterInfoEvent : EntityEventArgs
{
public readonly EntityUid EntityUid;
public readonly NetEntity NetEntity;
public readonly string JobTitle;
public readonly Dictionary<string, List<ConditionInfo>> Objectives;
public readonly string? Briefing;
public CharacterInfoEvent(EntityUid entityUid, string jobTitle, Dictionary<string, List<ConditionInfo>> objectives, string? briefing)
public CharacterInfoEvent(NetEntity netEntity, string jobTitle, Dictionary<string, List<ConditionInfo>> objectives, string? briefing)
{
EntityUid = entityUid;
NetEntity = netEntity;
JobTitle = jobTitle;
Objectives = objectives;
Briefing = briefing;

View File

@@ -13,7 +13,7 @@ namespace Content.Shared.Chat
public ChatChannel Channel;
public string Message;
public string WrappedMessage;
public EntityUid SenderEntity;
public NetEntity SenderEntity;
public bool HideChat;
public Color? MessageColorOverride;
public string? AudioPath;
@@ -22,7 +22,7 @@ namespace Content.Shared.Chat
[NonSerialized]
public bool Read;
public ChatMessage(ChatChannel channel, string message, string wrappedMessage, EntityUid source, bool hideChat = false, Color? colorOverride = null, string? audioPath = null, float audioVolume = 0)
public ChatMessage(ChatChannel channel, string message, string wrappedMessage, NetEntity source, bool hideChat = false, Color? colorOverride = null, string? audioPath = null, float audioVolume = 0)
{
Channel = channel;
Message = message;

View File

@@ -76,7 +76,7 @@ public sealed partial class BonkSystem : EntitySystem
if (args.Handled || !HasComp<ClumsyComponent>(args.Dragged))
return;
var doAfterArgs = new DoAfterArgs(args.Dragged, component.BonkDelay, new BonkDoAfterEvent(), uid, target: uid)
var doAfterArgs = new DoAfterArgs(EntityManager, args.Dragged, component.BonkDelay, new BonkDoAfterEvent(), uid, target: uid)
{
BreakOnTargetMove = true,
BreakOnUserMove = true,

View File

@@ -93,7 +93,7 @@ public sealed class ToggleableClothingSystem : EntitySystem
var (time, stealth) = _strippable.GetStripTimeModifiers(user, wearer, (float) component.StripDelay.Value.TotalSeconds);
var args = new DoAfterArgs(user, time, new ToggleClothingDoAfterEvent(), item, wearer, item)
var args = new DoAfterArgs(EntityManager, user, time, new ToggleClothingDoAfterEvent(), item, wearer, item)
{
BreakOnDamage = true,
BreakOnTargetMove = true,

View File

@@ -15,7 +15,7 @@ public sealed class TryStartStructureConstructionMessage : EntityEventArgs
/// <summary>
/// Position to start building.
/// </summary>
public readonly EntityCoordinates Location;
public readonly NetCoordinates Location;
/// <summary>
/// The construction prototype to start building.
@@ -27,9 +27,13 @@ public sealed class TryStartStructureConstructionMessage : EntityEventArgs
/// <summary>
/// Identifier to be sent back in the acknowledgement so that the client can clean up its ghost.
/// </summary>
/// <remarks>
/// So essentially the client is sending its own entity to the server so it knows to delete it when it gets server
/// response back.
/// </remarks>
public readonly int Ack;
public TryStartStructureConstructionMessage(EntityCoordinates loc, string prototypeName, Angle angle, int ack)
public TryStartStructureConstructionMessage(NetCoordinates loc, string prototypeName, Angle angle, int ack)
{
Location = loc;
PrototypeName = prototypeName;
@@ -67,9 +71,9 @@ public sealed class AckStructureConstructionMessage : EntityEventArgs
/// <summary>
/// The entity that is now being constructed, if any.
/// </summary>
public readonly EntityUid? Uid;
public readonly NetEntity? Uid;
public AckStructureConstructionMessage(int ghostId, EntityUid? uid = null)
public AckStructureConstructionMessage(int ghostId, NetEntity? uid = null)
{
GhostId = ghostId;
Uid = uid;
@@ -110,15 +114,15 @@ public sealed class ResponseConstructionGuide : EntityEventArgs
public sealed partial class ConstructionInteractDoAfterEvent : DoAfterEvent
{
[DataField("clickLocation")]
public EntityCoordinates ClickLocation;
public NetCoordinates ClickLocation;
private ConstructionInteractDoAfterEvent()
{
}
public ConstructionInteractDoAfterEvent(InteractUsingEvent ev)
public ConstructionInteractDoAfterEvent(IEntityManager entManager, InteractUsingEvent ev)
{
ClickLocation = ev.ClickLocation;
ClickLocation = entManager.GetNetCoordinates(ev.ClickLocation);
}
public override DoAfterEvent Clone() => this;

View File

@@ -246,6 +246,9 @@ namespace Content.Shared.Containers.ItemSlots
/// </remarks>
public bool CanInsert(EntityUid uid, EntityUid usedUid, EntityUid? user, ItemSlot slot, bool swap = false, EntityUid? popup = null)
{
if (slot.ContainerSlot == null)
return false;
if (slot.Locked)
return false;
@@ -265,7 +268,7 @@ namespace Content.Shared.Containers.ItemSlots
if (ev.Cancelled)
return false;
return slot.ContainerSlot?.CanInsertIfEmpty(usedUid, EntityManager) ?? false;
return _containers.CanInsert(usedUid, slot.ContainerSlot, assumeEmpty: true);
}
/// <summary>
@@ -325,16 +328,16 @@ namespace Content.Shared.Containers.ItemSlots
public bool CanEject(EntityUid uid, EntityUid? user, ItemSlot slot)
{
if (slot.Locked || slot.Item == null)
if (slot.Locked || slot.ContainerSlot?.ContainedEntity is not {} item)
return false;
var ev = new ItemSlotEjectAttemptEvent(uid, slot.Item.Value, user, slot);
var ev = new ItemSlotEjectAttemptEvent(uid, item, user, slot);
RaiseLocalEvent(uid, ref ev);
RaiseLocalEvent(slot.Item.Value, ref ev);
RaiseLocalEvent(item, ref ev);
if (ev.Cancelled)
return false;
return slot.ContainerSlot?.CanRemove(slot.Item.Value, EntityManager) ?? false;
return _containers.CanRemove(item, slot.ContainerSlot);
}
/// <summary>
@@ -435,11 +438,13 @@ namespace Content.Shared.Containers.ItemSlots
var verbSubject = slot.Name != string.Empty
? Loc.GetString(slot.Name)
: Name(args.Using.Value) ?? string.Empty;
: Name(args.Using.Value);
AlternativeVerb verb = new();
verb.IconEntity = args.Using;
verb.Act = () => Insert(uid, slot, args.Using.Value, args.User, excludeUserAudio: true);
AlternativeVerb verb = new()
{
IconEntity = GetNetEntity(args.Using),
Act = () => Insert(uid, slot, args.Using.Value, args.User, excludeUserAudio: true)
};
if (slot.InsertVerbText != null)
{
@@ -491,7 +496,7 @@ namespace Content.Shared.Containers.ItemSlots
AlternativeVerb verb = new()
{
IconEntity = slot.Item,
IconEntity = GetNetEntity(slot.Item),
Act = () => TryEjectToHands(uid, slot, args.User, excludeUserAudio: true)
};
@@ -528,9 +533,11 @@ namespace Content.Shared.Containers.ItemSlots
? Loc.GetString(slot.Name)
: Name(slot.Item!.Value);
InteractionVerb takeVerb = new();
takeVerb.IconEntity = slot.Item;
takeVerb.Act = () => TryEjectToHands(uid, slot, args.User, excludeUserAudio: true);
InteractionVerb takeVerb = new()
{
IconEntity = GetNetEntity(slot.Item),
Act = () => TryEjectToHands(uid, slot, args.User, excludeUserAudio: true)
};
if (slot.EjectVerbText == null)
takeVerb.Text = Loc.GetString("take-item-verb-text", ("subject", verbSubject));
@@ -556,7 +563,7 @@ namespace Content.Shared.Containers.ItemSlots
InteractionVerb insertVerb = new()
{
IconEntity = args.Using,
IconEntity = GetNetEntity(args.Using),
Act = () => Insert(uid, slot, args.Using.Value, args.User, excludeUserAudio: true)
};

View File

@@ -11,9 +11,9 @@ namespace Content.Shared.CrewManifest;
[Serializable, NetSerializable]
public sealed class RequestCrewManifestMessage : EntityEventArgs
{
public EntityUid Id { get; }
public NetEntity Id { get; }
public RequestCrewManifestMessage(EntityUid id)
public RequestCrewManifestMessage(NetEntity id)
{
Id = id;
}

View File

@@ -479,7 +479,7 @@ namespace Content.Shared.Cuffs
if (HasComp<DisarmProneComponent>(target))
cuffTime = 0.0f; // cuff them instantly.
var doAfterEventArgs = new DoAfterArgs(user, cuffTime, new AddCuffDoAfterEvent(), handcuff, target, handcuff)
var doAfterEventArgs = new DoAfterArgs(EntityManager, user, cuffTime, new AddCuffDoAfterEvent(), handcuff, target, handcuff)
{
BreakOnTargetMove = true,
BreakOnUserMove = true,
@@ -566,7 +566,7 @@ namespace Content.Shared.Cuffs
}
var uncuffTime = isOwner ? cuff.BreakoutTime : cuff.UncuffTime;
var doAfterEventArgs = new DoAfterArgs(user, uncuffTime, new UnCuffDoAfterEvent(), target, target, cuffsToRemove)
var doAfterEventArgs = new DoAfterArgs(EntityManager, user, uncuffTime, new UnCuffDoAfterEvent(), target, target, cuffsToRemove)
{
BreakOnUserMove = true,
BreakOnTargetMove = true,

View File

@@ -6,7 +6,7 @@ namespace Content.Shared.Decals
[Serializable, NetSerializable]
public sealed class DecalChunkUpdateEvent : EntityEventArgs
{
public Dictionary<EntityUid, Dictionary<Vector2i, DecalChunk>> Data = new();
public Dictionary<EntityUid, HashSet<Vector2i>> RemovedChunks = new();
public Dictionary<NetEntity, Dictionary<Vector2i, DecalChunk>> Data = new();
public Dictionary<NetEntity, HashSet<Vector2i>> RemovedChunks = new();
}
}

View File

@@ -149,9 +149,9 @@ namespace Content.Shared.Decals
public sealed class RequestDecalPlacementEvent : EntityEventArgs
{
public Decal Decal;
public EntityCoordinates Coordinates;
public NetCoordinates Coordinates;
public RequestDecalPlacementEvent(Decal decal, EntityCoordinates coordinates)
public RequestDecalPlacementEvent(Decal decal, NetCoordinates coordinates)
{
Decal = decal;
Coordinates = coordinates;
@@ -161,9 +161,9 @@ namespace Content.Shared.Decals
[Serializable, NetSerializable]
public sealed class RequestDecalRemovalEvent : EntityEventArgs
{
public EntityCoordinates Coordinates;
public NetCoordinates Coordinates;
public RequestDecalRemovalEvent(EntityCoordinates coordinates)
public RequestDecalRemovalEvent(NetCoordinates coordinates)
{
Coordinates = coordinates;
}

View File

@@ -40,11 +40,11 @@ public sealed partial class DeviceListComponent : Component
[Serializable, NetSerializable]
public sealed class DeviceListComponentState : ComponentState
{
public readonly HashSet<EntityUid> Devices;
public readonly HashSet<NetEntity> Devices;
public readonly bool IsAllowList;
public readonly bool HandleIncomingPackets;
public DeviceListComponentState(HashSet<EntityUid> devices, bool isAllowList, bool handleIncomingPackets)
public DeviceListComponentState(HashSet<NetEntity> devices, bool isAllowList, bool handleIncomingPackets)
{
Devices = devices;
IsAllowList = isAllowList;

View File

@@ -62,10 +62,10 @@ public sealed partial class NetworkConfiguratorComponent : Component
[Serializable, NetSerializable]
public sealed class NetworkConfiguratorComponentState : ComponentState
{
public readonly EntityUid? ActiveDeviceList;
public readonly NetEntity? ActiveDeviceList;
public readonly bool LinkModeActive;
public NetworkConfiguratorComponentState(EntityUid? activeDeviceList, bool linkModeActive)
public NetworkConfiguratorComponentState(NetEntity? activeDeviceList, bool linkModeActive)
{
ActiveDeviceList = activeDeviceList;
LinkModeActive = linkModeActive;

View File

@@ -60,7 +60,7 @@ public abstract class SharedDeviceListSystem : EntitySystem
private void GetDeviceListState(EntityUid uid, DeviceListComponent comp, ref ComponentGetState args)
{
args.State = new DeviceListComponentState(comp.Devices, comp.IsAllowList, comp.HandleIncomingPackets);
args.State = new DeviceListComponentState(GetNetEntitySet(comp.Devices), comp.IsAllowList, comp.HandleIncomingPackets);
}
private void HandleDeviceListState(EntityUid uid, DeviceListComponent comp, ref ComponentHandleState args)
@@ -70,7 +70,7 @@ public abstract class SharedDeviceListSystem : EntitySystem
return;
}
comp.Devices = state.Devices;
comp.Devices = EnsureEntitySet<DeviceListComponent>(state.Devices, uid);
comp.HandleIncomingPackets = state.HandleIncomingPackets;
comp.IsAllowList = state.IsAllowList;
}

View File

@@ -18,7 +18,7 @@ public abstract class SharedNetworkConfiguratorSystem : EntitySystem
private void GetNetworkConfiguratorState(EntityUid uid, NetworkConfiguratorComponent comp,
ref ComponentGetState args)
{
args.State = new NetworkConfiguratorComponentState(comp.ActiveDeviceList, comp.LinkModeActive);
args.State = new NetworkConfiguratorComponentState(GetNetEntity(comp.ActiveDeviceList), comp.LinkModeActive);
}
private void HandleNetworkConfiguratorState(EntityUid uid, NetworkConfiguratorComponent comp,
@@ -29,7 +29,7 @@ public abstract class SharedNetworkConfiguratorSystem : EntitySystem
return;
}
comp.ActiveDeviceList = state.ActiveDeviceList;
comp.ActiveDeviceList = EnsureEntity<NetworkConfiguratorComponent>(state.ActiveDeviceList, uid);
comp.LinkModeActive = state.LinkModeActive;
}
}

View File

@@ -53,7 +53,7 @@ public abstract class SharedDevourSystem : EntitySystem
case MobState.Critical:
case MobState.Dead:
_doAfterSystem.TryStartDoAfter(new DoAfterArgs(uid, component.DevourTime, new DevourDoAfterEvent(), uid, target: target, used: uid)
_doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, uid, component.DevourTime, new DevourDoAfterEvent(), uid, target: target, used: uid)
{
BreakOnTargetMove = true,
BreakOnUserMove = true,
@@ -72,7 +72,7 @@ public abstract class SharedDevourSystem : EntitySystem
if (component.SoundStructureDevour != null)
_audioSystem.PlayPredicted(component.SoundStructureDevour, uid, uid, component.SoundStructureDevour.Params);
_doAfterSystem.TryStartDoAfter(new DoAfterArgs(uid, component.StructureDevourTime, new DevourDoAfterEvent(), uid, target: target, used: uid)
_doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, uid, component.StructureDevourTime, new DevourDoAfterEvent(), uid, target: target, used: uid)
{
BreakOnTargetMove = true,
BreakOnUserMove = true,

View File

@@ -142,9 +142,9 @@ public abstract class SharedDisposalUnitSystem : EntitySystem
public TimeSpan? NextFlush;
public bool Powered;
public bool Engaged;
public List<EntityUid> RecentlyEjected;
public List<NetEntity> RecentlyEjected;
public DisposalUnitComponentState(SoundSpecifier? flushSound, DisposalsPressureState state, TimeSpan nextPressurized, TimeSpan automaticEngageTime, TimeSpan? nextFlush, bool powered, bool engaged, List<EntityUid> recentlyEjected)
public DisposalUnitComponentState(SoundSpecifier? flushSound, DisposalsPressureState state, TimeSpan nextPressurized, TimeSpan automaticEngageTime, TimeSpan? nextFlush, bool powered, bool engaged, List<NetEntity> recentlyEjected)
{
FlushSound = flushSound;
State = state;

View File

@@ -44,9 +44,12 @@ public sealed partial class DoAfter
/// <summary>
/// Position of the user relative to their parent when the do after was started.
/// </summary>
[NonSerialized]
[DataField("userPosition")]
public EntityCoordinates UserPosition;
public NetCoordinates NetUserPosition;
/// <summary>
/// Distance from the user to the target when the do after was started.
/// </summary>
@@ -62,9 +65,12 @@ public sealed partial class DoAfter
/// <summary>
/// If <see cref="NeedHand"/> is true, this is the entity that was in the active hand when the doafter started.
/// </summary>
[NonSerialized]
[DataField("activeItem")]
public EntityUid? InitialItem;
public NetEntity? NetInitialItem;
// cached attempt event for the sake of avoiding unnecessary reflection every time this needs to be raised.
[NonSerialized] public object? AttemptEvent;
@@ -86,7 +92,7 @@ public sealed partial class DoAfter
StartTime = startTime;
}
public DoAfter(DoAfter other)
public DoAfter(IEntityManager entManager, DoAfter other)
{
Index = other.Index;
Args = new(other.Args);
@@ -97,6 +103,9 @@ public sealed partial class DoAfter
TargetDistance = other.TargetDistance;
InitialHand = other.InitialHand;
InitialItem = other.InitialItem;
NetUserPosition = other.NetUserPosition;
NetInitialItem = other.NetInitialItem;
}
}

View File

@@ -10,9 +10,12 @@ public sealed partial class DoAfterArgs
/// <summary>
/// The entity invoking do_after
/// </summary>
[NonSerialized]
[DataField("user", required: true)]
public EntityUid User;
public NetEntity NetUser;
/// <summary>
/// How long does the do_after require to complete
/// </summary>
@@ -22,15 +25,21 @@ public sealed partial class DoAfterArgs
/// <summary>
/// Applicable target (if relevant)
/// </summary>
[NonSerialized]
[DataField("target")]
public EntityUid? Target;
public NetEntity? NetTarget;
/// <summary>
/// Entity used by the User on the Target.
/// </summary>
[NonSerialized]
[DataField("using")]
public EntityUid? Used;
public NetEntity? NetUsed;
#region Event options
/// <summary>
/// The event that will get raised when the DoAfter has finished. If null, this will simply raise a <see cref="SimpleDoAfterEvent"/>
@@ -48,9 +57,12 @@ public sealed partial class DoAfterArgs
/// <summary>
/// Entity which will receive the directed event. If null, no directed event will be raised.
/// </summary>
[NonSerialized]
[DataField("eventTarget")]
public EntityUid? EventTarget;
public NetEntity? NetEventTarget;
/// <summary>
/// Should the DoAfter event broadcast? If this is false, then <see cref="EventTarget"/> should be a valid entity.
/// </summary>
@@ -173,6 +185,7 @@ public sealed partial class DoAfterArgs
/// <param name="target">The entity being targeted by the DoAFter. Not the same as <see cref="EventTarget"/></param>.
/// <param name="used">The entity being used during the DoAfter. E.g., a tool</param>
public DoAfterArgs(
IEntityManager entManager,
EntityUid user,
TimeSpan delay,
DoAfterEvent @event,
@@ -186,6 +199,10 @@ public sealed partial class DoAfterArgs
Used = used;
EventTarget = eventTarget;
Event = @event;
NetUser = entManager.GetNetEntity(User);
NetTarget = entManager.GetNetEntity(Target);
NetUsed = entManager.GetNetEntity(Used);
}
private DoAfterArgs()
@@ -202,13 +219,14 @@ public sealed partial class DoAfterArgs
/// <param name="target">The entity being targeted by the DoAfter. Not the same as <see cref="EventTarget"/></param>.
/// <param name="used">The entity being used during the DoAfter. E.g., a tool</param>
public DoAfterArgs(
IEntityManager entManager,
EntityUid user,
float seconds,
DoAfterEvent @event,
EntityUid? eventTarget,
EntityUid? target = null,
EntityUid? used = null)
: this(user, TimeSpan.FromSeconds(seconds), @event, eventTarget, target, used)
: this(entManager, user, TimeSpan.FromSeconds(seconds), @event, eventTarget, target, used)
{
}
@@ -238,6 +256,12 @@ public sealed partial class DoAfterArgs
CancelDuplicate = other.CancelDuplicate;
DuplicateCondition = other.DuplicateCondition;
// Networked
NetUser = other.NetUser;
NetTarget = other.NetTarget;
NetUsed = other.NetUsed;
NetEventTarget = other.NetEventTarget;
Event = other.Event.Clone();
}
}

View File

@@ -24,7 +24,7 @@ public sealed class DoAfterComponentState : ComponentState
public readonly ushort NextId;
public readonly Dictionary<ushort, DoAfter> DoAfters;
public DoAfterComponentState(DoAfterComponent component)
public DoAfterComponentState(IEntityManager entManager, DoAfterComponent component)
{
NextId = component.NextId;
@@ -36,9 +36,10 @@ public sealed class DoAfterComponentState : ComponentState
DoAfters = component.DoAfters;
#else
DoAfters = new();
foreach (var (id, doafter) in component.DoAfters)
foreach (var (id, doAfter) in component.DoAfters)
{
DoAfters.Add(id, new DoAfter(doafter));
var newDoAfter = new DoAfter(entManager, doAfter);
DoAfters.Add(id, newDoAfter);
}
#endif
}

View File

@@ -71,7 +71,7 @@ public abstract partial class SharedDoAfterSystem : EntitySystem
}
if (dirty)
Dirty(comp);
Dirty(uid, comp);
if (comp.DoAfters.Count == 0)
RemCompDeferred(uid, active);

View File

@@ -100,7 +100,7 @@ public abstract partial class SharedDoAfterSystem : EntitySystem
private void OnDoAfterGetState(EntityUid uid, DoAfterComponent comp, ref ComponentGetState args)
{
args.State = new DoAfterComponentState(comp);
args.State = new DoAfterComponentState(EntityManager, comp);
}
private void OnDoAfterHandleState(EntityUid uid, DoAfterComponent comp, ref ComponentHandleState args)
@@ -115,7 +115,18 @@ public abstract partial class SharedDoAfterSystem : EntitySystem
comp.DoAfters.Clear();
foreach (var (id, doAfter) in state.DoAfters)
{
comp.DoAfters.Add(id, new(doAfter));
var newDoAfter = new DoAfter(EntityManager, doAfter);
comp.DoAfters.Add(id, newDoAfter);
// Networking yay (if you have an easier way dear god please).
newDoAfter.UserPosition = EnsureCoordinates<DoAfterComponent>(newDoAfter.NetUserPosition, uid);
newDoAfter.InitialItem = EnsureEntity<DoAfterComponent>(newDoAfter.NetInitialItem, uid);
var doAfterArgs = newDoAfter.Args;
doAfterArgs.Target = EnsureEntity<DoAfterComponent>(doAfterArgs.NetTarget, uid);
doAfterArgs.Used = EnsureEntity<DoAfterComponent>(doAfterArgs.NetUsed, uid);
doAfterArgs.User = EnsureEntity<DoAfterComponent>(doAfterArgs.NetUser, uid);
doAfterArgs.EventTarget = EnsureEntity<DoAfterComponent>(doAfterArgs.NetEventTarget, uid);
}
comp.NextId = state.NextId;
@@ -195,6 +206,16 @@ public abstract partial class SharedDoAfterSystem : EntitySystem
id = new DoAfterId(args.User, comp.NextId++);
var doAfter = new DoAfter(id.Value.Index, args, GameTiming.CurTime);
// Networking yay
doAfter.NetUserPosition = GetNetCoordinates(doAfter.UserPosition);
doAfter.NetInitialItem = GetNetEntity(doAfter.InitialItem);
// Networking yay
args.NetTarget = GetNetEntity(args.Target);
args.NetUsed = GetNetEntity(args.Used);
args.NetUser = GetNetEntity(args.User);
args.NetEventTarget = GetNetEntity(args.EventTarget);
if (args.BreakOnUserMove || args.BreakOnTargetMove)
doAfter.UserPosition = Transform(args.User).Coordinates;
@@ -322,7 +343,7 @@ public abstract partial class SharedDoAfterSystem : EntitySystem
}
InternalCancel(doAfter, comp);
Dirty(comp);
Dirty(entity, comp);
}
private void InternalCancel(DoAfter doAfter, DoAfterComponent component)

View File

@@ -340,14 +340,14 @@ public enum DoorVisualLayers : byte
public sealed class DoorComponentState : ComponentState
{
public readonly DoorState DoorState;
public readonly HashSet<EntityUid> CurrentlyCrushing;
public readonly HashSet<NetEntity> CurrentlyCrushing;
public readonly TimeSpan? NextStateChange;
public readonly bool Partial;
public DoorComponentState(DoorComponent door)
public DoorComponentState(DoorComponent door, HashSet<NetEntity> currentlyCrushing)
{
DoorState = door.State;
CurrentlyCrushing = door.CurrentlyCrushing;
CurrentlyCrushing = currentlyCrushing;
NextStateChange = door.NextStateChange;
Partial = door.Partial;
}

View File

@@ -101,7 +101,7 @@ public abstract partial class SharedDoorSystem : EntitySystem
#region StateManagement
private void OnGetState(EntityUid uid, DoorComponent door, ref ComponentGetState args)
{
args.State = new DoorComponentState(door);
args.State = new DoorComponentState(door, GetNetEntitySet(door.CurrentlyCrushing));
}
private void OnHandleState(EntityUid uid, DoorComponent door, ref ComponentHandleState args)
@@ -109,11 +109,8 @@ public abstract partial class SharedDoorSystem : EntitySystem
if (args.Current is not DoorComponentState state)
return;
if (!door.CurrentlyCrushing.SetEquals(state.CurrentlyCrushing))
{
door.CurrentlyCrushing.Clear();
door.CurrentlyCrushing.UnionWith(state.CurrentlyCrushing);
}
door.CurrentlyCrushing.Clear();
door.CurrentlyCrushing.UnionWith(EnsureEntitySet<DoorComponent>(state.CurrentlyCrushing, uid));
door.State = state.DoorState;
door.NextStateChange = state.NextStateChange;

View File

@@ -11,14 +11,14 @@ namespace Content.Shared.DragDrop
/// <summary>
/// Entity that was dragged and dropped.
/// </summary>
public EntityUid Dragged { get; }
public NetEntity Dragged { get; }
/// <summary>
/// Entity that was drag dropped on.
/// </summary>
public EntityUid Target { get; }
public NetEntity Target { get; }
public DragDropRequestEvent(EntityUid dragged, EntityUid target)
public DragDropRequestEvent(NetEntity dragged, NetEntity target)
{
Dragged = dragged;
Target = target;

View File

@@ -13,9 +13,9 @@ public sealed class ColorFlashEffectEvent : EntityEventArgs
/// </summary>
public Color Color;
public List<EntityUid> Entities;
public List<NetEntity> Entities;
public ColorFlashEffectEvent(Color color, List<EntityUid> entities)
public ColorFlashEffectEvent(Color color, List<NetEntity> entities)
{
Color = color;
Entities = entities;

View File

@@ -9,15 +9,15 @@ namespace Content.Shared.Examine
[Serializable, NetSerializable]
public sealed class RequestExamineInfoMessage : EntityEventArgs
{
public readonly EntityUid EntityUid;
public readonly NetEntity NetEntity;
public readonly int Id;
public readonly bool GetVerbs;
public RequestExamineInfoMessage(EntityUid entityUid, int id, bool getVerbs=false)
public RequestExamineInfoMessage(NetEntity netEntity, int id, bool getVerbs=false)
{
EntityUid = entityUid;
NetEntity = netEntity;
Id = id;
GetVerbs = getVerbs;
}
@@ -26,7 +26,7 @@ namespace Content.Shared.Examine
[Serializable, NetSerializable]
public sealed class ExamineInfoResponseMessage : EntityEventArgs
{
public readonly EntityUid EntityUid;
public readonly NetEntity EntityUid;
public readonly int Id;
public readonly FormattedMessage Message;
@@ -37,7 +37,7 @@ namespace Content.Shared.Examine
public readonly bool KnowTarget;
public ExamineInfoResponseMessage(EntityUid entityUid, int id, FormattedMessage message, List<Verb>? verbs=null,
public ExamineInfoResponseMessage(NetEntity entityUid, int id, FormattedMessage message, List<Verb>? verbs=null,
bool centerAtCursor=true, bool openAtOldTooltip=true, bool knowTarget = true)
{
EntityUid = entityUid;

View File

@@ -48,7 +48,7 @@ namespace Content.Shared.Examine
public bool IsInDetailsRange(EntityUid examiner, EntityUid entity)
{
if (entity.IsClientSide())
if (IsClientSide(entity))
return true;
// check if the mob is in critical or dead
@@ -72,7 +72,7 @@ namespace Content.Shared.Examine
public bool CanExamine(EntityUid examiner, EntityUid examined)
{
// special check for client-side entities stored in null-space for some UI guff.
if (examined.IsClientSide())
if (IsClientSide(examined))
return true;
return !Deleted(examined) && CanExamine(examiner, EntityManager.GetComponent<TransformComponent>(examined).MapPosition,

View File

@@ -24,7 +24,7 @@ public sealed class ExplosionVisualsState : ComponentState
{
public MapCoordinates Epicenter;
public Dictionary<int, List<Vector2i>>? SpaceTiles;
public Dictionary<EntityUid, Dictionary<int, List<Vector2i>>> Tiles;
public Dictionary<NetEntity, Dictionary<int, List<Vector2i>>> Tiles;
public List<float> Intensity;
public string ExplosionType = string.Empty;
public Matrix3 SpaceMatrix;
@@ -35,7 +35,7 @@ public sealed class ExplosionVisualsState : ComponentState
string typeID,
List<float> intensity,
Dictionary<int, List<Vector2i>>? spaceTiles,
Dictionary<EntityUid, Dictionary<int, List<Vector2i>>> tiles,
Dictionary<NetEntity, Dictionary<int, List<Vector2i>>> tiles,
Matrix3 spaceMatrix,
ushort spaceTileSize)
{

View File

@@ -17,11 +17,11 @@ public sealed class AdminFaxEuiState : EuiStateBase
[Serializable, NetSerializable]
public sealed class AdminFaxEntry
{
public EntityUid Uid { get; }
public NetEntity Uid { get; }
public string Name { get; }
public string Address { get; }
public AdminFaxEntry(EntityUid uid, string name, string address)
public AdminFaxEntry(NetEntity uid, string name, string address)
{
Uid = uid;
Name = name;
@@ -39,9 +39,9 @@ public static class AdminFaxEuiMsg
[Serializable, NetSerializable]
public sealed class Follow : EuiMessageBase
{
public EntityUid TargetFax { get; }
public NetEntity TargetFax { get; }
public Follow(EntityUid targetFax)
public Follow(NetEntity targetFax)
{
TargetFax = targetFax;
}
@@ -50,14 +50,14 @@ public static class AdminFaxEuiMsg
[Serializable, NetSerializable]
public sealed class Send : EuiMessageBase
{
public EntityUid Target { get; }
public NetEntity Target { get; }
public string Title { get; }
public string From { get; }
public string Content { get; }
public string StampState { get; }
public Color StampColor { get; }
public Send(EntityUid target, string title, string from, string content, string stamp, Color stampColor)
public Send(NetEntity target, string title, string from, string content, string stamp, Color stampColor)
{
Target = target;
Title = title;

View File

@@ -26,10 +26,10 @@ public sealed class PuddleOverlayDebugMessage : EntityEventArgs
{
public PuddleDebugOverlayData[] OverlayData { get; }
public EntityUid GridUid { get; }
public NetEntity GridUid { get; }
public PuddleOverlayDebugMessage(EntityUid gridUid, PuddleDebugOverlayData[] overlayData)
public PuddleOverlayDebugMessage(NetEntity gridUid, PuddleDebugOverlayData[] overlayData)
{
GridUid = gridUid;
OverlayData = overlayData;

View File

@@ -7,9 +7,9 @@ namespace Content.Shared.Follower.Components;
/// Attached to entities that are currently being followed by a ghost.
/// </summary>
[RegisterComponent, Access(typeof(FollowerSystem))]
[NetworkedComponent, AutoGenerateComponentState]
[NetworkedComponent]
public sealed partial class FollowedComponent : Component
{
[AutoNetworkedField(true), DataField("following")]
[DataField("following")]
public HashSet<EntityUid> Following = new();
}

View File

@@ -8,12 +8,14 @@ using Content.Shared.Physics.Pull;
using Content.Shared.Tag;
using Content.Shared.Verbs;
using Robust.Shared.Containers;
using Robust.Shared.GameStates;
using Robust.Shared.Map;
using Robust.Shared.Map.Events;
using Robust.Shared.Network;
using Robust.Shared.Utility;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Systems;
using Robust.Shared.Serialization;
namespace Content.Shared.Follower;
@@ -36,6 +38,25 @@ public sealed class FollowerSystem : EntitySystem
SubscribeLocalEvent<FollowerComponent, GotEquippedHandEvent>(OnGotEquippedHand);
SubscribeLocalEvent<FollowedComponent, EntityTerminatingEvent>(OnFollowedTerminating);
SubscribeLocalEvent<BeforeSaveEvent>(OnBeforeSave);
SubscribeLocalEvent<FollowedComponent, ComponentGetState>(OnFollowedGetState);
SubscribeLocalEvent<FollowedComponent, ComponentHandleState>(OnFollowedHandleState);
}
private void OnFollowedGetState(EntityUid uid, FollowedComponent component, ref ComponentGetState args)
{
args.State = new FollowedComponentState()
{
Following = GetNetEntitySet(component.Following),
};
}
private void OnFollowedHandleState(EntityUid uid, FollowedComponent component, ref ComponentHandleState args)
{
if (args.Current is not FollowedComponentState state)
return;
component.Following = EnsureEntitySet<FollowedComponent>(state.Following, uid);
}
private void OnBeforeSave(BeforeSaveEvent ev)
@@ -58,7 +79,7 @@ public sealed class FollowerSystem : EntitySystem
private void OnGetAlternativeVerbs(GetVerbsEvent<AlternativeVerb> ev)
{
if (ev.User == ev.Target || ev.Target.IsClientSide())
if (ev.User == ev.Target || IsClientSide(ev.Target))
return;
if (HasComp<GhostComponent>(ev.User))
@@ -221,6 +242,12 @@ public sealed class FollowerSystem : EntitySystem
StopFollowingEntity(player, uid, followed);
}
}
[Serializable, NetSerializable]
private sealed class FollowedComponentState : ComponentState
{
public HashSet<NetEntity> Following = new();
}
}
public abstract class FollowEvent : EntityEventArgs

View File

@@ -124,10 +124,10 @@ namespace Content.Shared.GameTicking
/// <summary>
/// The Status of the Player in the lobby (ready, observer, ...)
/// </summary>
public Dictionary<EntityUid, Dictionary<string, uint?>> JobsAvailableByStation { get; }
public Dictionary<EntityUid, string> StationNames { get; }
public Dictionary<NetEntity, Dictionary<string, uint?>> JobsAvailableByStation { get; }
public Dictionary<NetEntity, string> StationNames { get; }
public TickerJobsAvailableEvent(Dictionary<EntityUid, string> stationNames, Dictionary<EntityUid, Dictionary<string, uint?>> jobsAvailableByStation)
public TickerJobsAvailableEvent(Dictionary<NetEntity, string> stationNames, Dictionary<NetEntity, Dictionary<string, uint?>> jobsAvailableByStation)
{
StationNames = stationNames;
JobsAvailableByStation = jobsAvailableByStation;
@@ -143,7 +143,7 @@ namespace Content.Shared.GameTicking
public string PlayerOOCName;
public string? PlayerICName;
public string Role;
public EntityUid? PlayerEntityUid;
public NetEntity? PlayerNetEntity;
public bool Antag;
public bool Observer;
public bool Connected;

View File

@@ -26,12 +26,12 @@ public sealed class GatewayBoundUserInterfaceState : BoundUserInterfaceState
/// <summary>
/// List of enabled destinations and information about them.
/// </summary>
public readonly List<(EntityUid, string, TimeSpan, bool)> Destinations;
public readonly List<(NetEntity, string, TimeSpan, bool)> Destinations;
/// <summary>
/// Which destination it is currently linked to, if any.
/// </summary>
public readonly EntityUid? Current;
public readonly NetEntity? Current;
/// <summary>
/// Time the portal will close at.
@@ -43,8 +43,8 @@ public sealed class GatewayBoundUserInterfaceState : BoundUserInterfaceState
/// </summary>
public readonly TimeSpan LastOpen;
public GatewayBoundUserInterfaceState(List<(EntityUid, string, TimeSpan, bool)> destinations,
EntityUid? current, TimeSpan nextClose, TimeSpan lastOpen)
public GatewayBoundUserInterfaceState(List<(NetEntity, string, TimeSpan, bool)> destinations,
NetEntity? current, TimeSpan nextClose, TimeSpan lastOpen)
{
Destinations = destinations;
Current = current;
@@ -56,9 +56,9 @@ public sealed class GatewayBoundUserInterfaceState : BoundUserInterfaceState
[Serializable, NetSerializable]
public sealed class GatewayOpenPortalMessage : BoundUserInterfaceMessage
{
public EntityUid Destination;
public NetEntity Destination;
public GatewayOpenPortalMessage(EntityUid destination)
public GatewayOpenPortalMessage(NetEntity destination)
{
Destination = destination;
}

View File

@@ -6,11 +6,11 @@ namespace Content.Shared.Ghost.Roles
[Serializable, NetSerializable]
public sealed class MakeGhostRoleEuiState : EuiStateBase
{
public MakeGhostRoleEuiState(EntityUid entityUid)
public MakeGhostRoleEuiState(NetEntity entityUid)
{
EntityUid = entityUid;
}
public EntityUid EntityUid { get; }
public NetEntity EntityUid { get; }
}
}

View File

@@ -7,6 +7,6 @@ namespace Content.Shared.Ghost.Roles
{
public string Name { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public EntityUid Id;
public NetEntity Id;
}
}

View File

@@ -66,7 +66,7 @@ namespace Content.Shared.Ghost
[Serializable, NetSerializable]
public struct GhostWarp
{
public GhostWarp(EntityUid entity, string displayName, bool isWarpPoint)
public GhostWarp(NetEntity entity, string displayName, bool isWarpPoint)
{
Entity = entity;
DisplayName = displayName;
@@ -77,11 +77,13 @@ namespace Content.Shared.Ghost
/// The entity representing the warp point.
/// This is passed back to the server in <see cref="GhostWarpToTargetRequestEvent"/>
/// </summary>
public EntityUid Entity { get; }
public NetEntity Entity { get; }
/// <summary>
/// The display name to be surfaced in the ghost warps menu
/// </summary>
public string DisplayName { get; }
/// <summary>
/// Whether this warp represents a warp point or a player
/// </summary>
@@ -112,9 +114,9 @@ namespace Content.Shared.Ghost
[Serializable, NetSerializable]
public sealed class GhostWarpToTargetRequestEvent : EntityEventArgs
{
public EntityUid Target { get; }
public NetEntity Target { get; }
public GhostWarpToTargetRequestEvent(EntityUid target)
public GhostWarpToTargetRequestEvent(NetEntity target)
{
Target = target;
}

View File

@@ -8,6 +8,8 @@ namespace Content.Shared.Hands.EntitySystems;
public abstract partial class SharedHandsSystem : EntitySystem
{
[Dependency] private readonly SharedContainerSystem _container = default!;
private void InitializeDrop()
{
SubscribeLocalEvent<HandsComponent, EntRemovedFromContainerMessage>(HandleEntityRemoved);
@@ -32,10 +34,10 @@ public abstract partial class SharedHandsSystem : EntitySystem
/// </summary>
public bool CanDropHeld(EntityUid uid, Hand hand, bool checkActionBlocker = true)
{
if (hand.HeldEntity == null)
if (hand.Container?.ContainedEntity is not {} held)
return false;
if (!hand.Container!.CanRemove(hand.HeldEntity.Value, EntityManager))
if (!_container.CanRemove(held, hand.Container))
return false;
if (checkActionBlocker && !_actionBlocker.CanDrop(uid))
@@ -110,7 +112,7 @@ public abstract partial class SharedHandsSystem : EntitySystem
/// <summary>
/// Attempts to move a held item from a hand into a container that is not another hand, without dropping it on the floor in-between.
/// </summary>
public bool TryDropIntoContainer(EntityUid uid, EntityUid entity, IContainer targetContainer, bool checkActionBlocker = true, HandsComponent? handsComp = null)
public bool TryDropIntoContainer(EntityUid uid, EntityUid entity, BaseContainer targetContainer, bool checkActionBlocker = true, HandsComponent? handsComp = null)
{
if (!Resolve(uid, ref handsComp))
return false;
@@ -121,7 +123,7 @@ public abstract partial class SharedHandsSystem : EntitySystem
if (!CanDropHeld(uid, hand, checkActionBlocker))
return false;
if (!targetContainer.CanInsert(entity, EntityManager))
if (!_container.CanInsert(entity, targetContainer))
return false;
DoDrop(uid, hand, false, handsComp);

View File

@@ -86,13 +86,13 @@ public abstract partial class SharedHandsSystem : EntitySystem
var newActiveIndex = component.SortedHands.IndexOf(component.ActiveHand.Name) + 1;
var nextHand = component.SortedHands[newActiveIndex % component.Hands.Count];
TrySetActiveHand(component.Owner, nextHand, component);
TrySetActiveHand(session.AttachedEntity.Value, nextHand, component);
}
private bool DropPressed(ICommonSession? session, EntityCoordinates coords, EntityUid uid)
private bool DropPressed(ICommonSession? session, EntityCoordinates coords, EntityUid netEntity)
{
if (TryComp(session?.AttachedEntity, out HandsComponent? hands) && hands.ActiveHand != null)
TryDrop(session.AttachedEntity!.Value, hands.ActiveHand, coords, handsComp: hands);
TryDrop(session.AttachedEntity.Value, hands.ActiveHand, coords, handsComp: hands);
// always send to server.
return false;

View File

@@ -181,7 +181,7 @@ public abstract partial class SharedHandsSystem : EntitySystem
return false;
// check can insert (including raising attempt events).
return handContainer.CanInsert(entity, EntityManager);
return _containerSystem.CanInsert(entity, handContainer);
}
/// <summary>

View File

@@ -117,12 +117,12 @@ namespace Content.Shared.Hands
[Serializable, NetSerializable]
public sealed class PickupAnimationEvent : EntityEventArgs
{
public EntityUid ItemUid { get; }
public EntityCoordinates InitialPosition { get; }
public NetEntity ItemUid { get; }
public NetCoordinates InitialPosition { get; }
public Vector2 FinalPosition { get; }
public Angle InitialAngle { get; }
public PickupAnimationEvent(EntityUid itemUid, EntityCoordinates initialPosition,
public PickupAnimationEvent(NetEntity itemUid, NetCoordinates initialPosition,
Vector2 finalPosition, Angle initialAngle)
{
ItemUid = itemUid;

View File

@@ -36,7 +36,7 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
private void OnInit(EntityUid uid, HumanoidAppearanceComponent humanoid, ComponentInit args)
{
if (string.IsNullOrEmpty(humanoid.Species) || _netManager.IsClient && !uid.IsClientSide())
if (string.IsNullOrEmpty(humanoid.Species) || _netManager.IsClient && !IsClientSide(uid))
{
return;
}

View File

@@ -111,7 +111,7 @@ public abstract class SharedImplanterSystem : EntitySystem
continue;
//Don't remove a permanent implant and look for the next that can be drawn
if (!implantContainer.CanRemove(implant))
if (!_container.CanRemove(implant, implantContainer))
{
var implantName = Identity.Entity(implant, EntityManager);
var targetName = Identity.Entity(target, EntityManager);

View File

@@ -42,9 +42,9 @@ public abstract partial class SharedInstrumentComponent : Component
[Serializable, NetSerializable]
public sealed class InstrumentStopMidiEvent : EntityEventArgs
{
public EntityUid Uid { get; }
public NetEntity Uid { get; }
public InstrumentStopMidiEvent(EntityUid uid)
public InstrumentStopMidiEvent(NetEntity uid)
{
Uid = uid;
}
@@ -56,10 +56,10 @@ public sealed class InstrumentStopMidiEvent : EntityEventArgs
[Serializable, NetSerializable]
public sealed class InstrumentSetMasterEvent : EntityEventArgs
{
public EntityUid Uid { get; }
public EntityUid? Master { get; }
public NetEntity Uid { get; }
public NetEntity? Master { get; }
public InstrumentSetMasterEvent(EntityUid uid, EntityUid? master)
public InstrumentSetMasterEvent(NetEntity uid, NetEntity? master)
{
Uid = uid;
Master = master;
@@ -72,11 +72,11 @@ public sealed class InstrumentSetMasterEvent : EntityEventArgs
[Serializable, NetSerializable]
public sealed class InstrumentSetFilteredChannelEvent : EntityEventArgs
{
public EntityUid Uid { get; }
public NetEntity Uid { get; }
public int Channel { get; }
public bool Value { get; }
public InstrumentSetFilteredChannelEvent(EntityUid uid, int channel, bool value)
public InstrumentSetFilteredChannelEvent(NetEntity uid, int channel, bool value)
{
Uid = uid;
Channel = channel;
@@ -90,9 +90,9 @@ public sealed class InstrumentSetFilteredChannelEvent : EntityEventArgs
[Serializable, NetSerializable]
public sealed class InstrumentStartMidiEvent : EntityEventArgs
{
public EntityUid Uid { get; }
public NetEntity Uid { get; }
public InstrumentStartMidiEvent(EntityUid uid)
public InstrumentStartMidiEvent(NetEntity uid)
{
Uid = uid;
}
@@ -104,10 +104,10 @@ public sealed class InstrumentStartMidiEvent : EntityEventArgs
[Serializable, NetSerializable]
public sealed class InstrumentMidiEventEvent : EntityEventArgs
{
public EntityUid Uid { get; }
public NetEntity Uid { get; }
public RobustMidiEvent[] MidiEvent { get; }
public InstrumentMidiEventEvent(EntityUid uid, RobustMidiEvent[] midiEvent)
public InstrumentMidiEventEvent(NetEntity uid, RobustMidiEvent[] midiEvent)
{
Uid = uid;
MidiEvent = midiEvent;

View File

@@ -10,9 +10,9 @@ public sealed class InstrumentBandRequestBuiMessage : BoundUserInterfaceMessage
[Serializable, NetSerializable]
public sealed class InstrumentBandResponseBuiMessage : BoundUserInterfaceMessage
{
public (EntityUid, string)[] Nearby { get; set; }
public (NetEntity, string)[] Nearby { get; set; }
public InstrumentBandResponseBuiMessage((EntityUid, string)[] nearby)
public InstrumentBandResponseBuiMessage((NetEntity, string)[] nearby)
{
Nearby = nearby;
}

View File

@@ -27,9 +27,9 @@ public sealed partial class InteractionRelayComponent : Component
[Serializable, NetSerializable]
public sealed class InteractionRelayComponentState : ComponentState
{
public EntityUid? RelayEntity;
public NetEntity? RelayEntity;
public InteractionRelayComponentState(EntityUid? relayEntity)
public InteractionRelayComponentState(NetEntity? relayEntity)
{
RelayEntity = relayEntity;
}

View File

@@ -32,7 +32,7 @@ namespace Content.Shared.Interaction.Helpers
public static bool InRangeUnOccluded(
this EntityUid origin,
IContainer other,
BaseContainer other,
float range = InteractionRange,
Ignored? predicate = null,
bool ignoreInsideBlocker = true)
@@ -90,7 +90,7 @@ namespace Content.Shared.Interaction.Helpers
public static bool InRangeUnOccluded(
this IComponent origin,
IContainer other,
BaseContainer other,
float range = InteractionRange,
Ignored? predicate = null,
bool ignoreInsideBlocker = true)
@@ -130,7 +130,7 @@ namespace Content.Shared.Interaction.Helpers
#region Containers
public static bool InRangeUnOccluded(
this IContainer origin,
this BaseContainer origin,
EntityUid other,
float range = InteractionRange,
Ignored? predicate = null,
@@ -143,7 +143,7 @@ namespace Content.Shared.Interaction.Helpers
}
public static bool InRangeUnOccluded(
this IContainer origin,
this BaseContainer origin,
IComponent other,
float range = InteractionRange,
Ignored? predicate = null,
@@ -155,8 +155,8 @@ namespace Content.Shared.Interaction.Helpers
}
public static bool InRangeUnOccluded(
this IContainer origin,
IContainer other,
this BaseContainer origin,
BaseContainer other,
float range = InteractionRange,
Ignored? predicate = null,
bool ignoreInsideBlocker = true)
@@ -169,7 +169,7 @@ namespace Content.Shared.Interaction.Helpers
}
public static bool InRangeUnOccluded(
this IContainer origin,
this BaseContainer origin,
EntityCoordinates other,
float range = InteractionRange,
Ignored? predicate = null,
@@ -181,7 +181,7 @@ namespace Content.Shared.Interaction.Helpers
}
public static bool InRangeUnOccluded(
this IContainer origin,
this BaseContainer origin,
MapCoordinates other,
float range = InteractionRange,
Ignored? predicate = null,
@@ -226,7 +226,7 @@ namespace Content.Shared.Interaction.Helpers
public static bool InRangeUnOccluded(
this EntityCoordinates origin,
IContainer other,
BaseContainer other,
float range = InteractionRange,
Ignored? predicate = null,
bool ignoreInsideBlocker = true)
@@ -304,7 +304,7 @@ namespace Content.Shared.Interaction.Helpers
public static bool InRangeUnOccluded(
this MapCoordinates origin,
IContainer other,
BaseContainer other,
float range = InteractionRange,
Ignored? predicate = null,
bool ignoreInsideBlocker = true)

View File

@@ -13,7 +13,7 @@ public abstract partial class SharedInteractionSystem
private void OnGetState(EntityUid uid, InteractionRelayComponent component, ref ComponentGetState args)
{
args.State = new InteractionRelayComponentState(component.RelayEntity);
args.State = new InteractionRelayComponentState(GetNetEntity(component.RelayEntity));
}
private void OnHandleState(EntityUid uid, InteractionRelayComponent component, ref ComponentHandleState args)
@@ -21,7 +21,7 @@ public abstract partial class SharedInteractionSystem
if (args.Current is not InteractionRelayComponentState state)
return;
component.RelayEntity = state.RelayEntity;
component.RelayEntity = EnsureEntity<InteractionRelayComponent>(state.RelayEntity, uid);
}
public void SetRelay(EntityUid uid, EntityUid? relayEntity, InteractionRelayComponent? component = null)

View File

@@ -205,8 +205,10 @@ namespace Content.Shared.Interaction
/// </summary>
private void HandleInteractInventorySlotEvent(InteractInventorySlotEvent msg, EntitySessionEventArgs args)
{
var item = GetEntity(msg.ItemUid);
// client sanitization
if (!TryComp(msg.ItemUid, out TransformComponent? itemXform) || !ValidateClientInput(args.SenderSession, itemXform.Coordinates, msg.ItemUid, out var user))
if (!TryComp(item, out TransformComponent? itemXform) || !ValidateClientInput(args.SenderSession, itemXform.Coordinates, item, out var user))
{
Logger.InfoS("system.interaction", $"Inventory interaction validation failed. Session={args.SenderSession}");
return;
@@ -219,10 +221,10 @@ namespace Content.Shared.Interaction
if (msg.AltInteract)
// Use 'UserInteraction' function - behaves as if the user alt-clicked the item in the world.
UserInteraction(user.Value, itemXform.Coordinates, msg.ItemUid, msg.AltInteract);
UserInteraction(user.Value, itemXform.Coordinates, item, msg.AltInteract);
else
// User used 'E'. We want to activate it, not simulate clicking on the item
InteractionActivate(user.Value, msg.ItemUid);
InteractionActivate(user.Value, item);
}
public bool HandleAltUseInteraction(ICommonSession? session, EntityCoordinates coords, EntityUid uid)
@@ -1093,7 +1095,7 @@ namespace Content.Shared.Interaction
return false;
}
if (uid.IsClientSide())
if (IsClientSide(uid))
{
Logger.WarningS("system.interaction",
$"Client sent interaction with client-side entity. Session={session}, Uid={uid}");
@@ -1148,14 +1150,14 @@ namespace Content.Shared.Interaction
/// <summary>
/// Entity that was interacted with.
/// </summary>
public EntityUid ItemUid { get; }
public NetEntity ItemUid { get; }
/// <summary>
/// Whether the interaction used the alt-modifier to trigger alternative interactions.
/// </summary>
public bool AltInteract { get; }
public InteractInventorySlotEvent(EntityUid itemUid, bool altInteract = false)
public InteractInventorySlotEvent(NetEntity itemUid, bool altInteract = false)
{
ItemUid = itemUid;
AltInteract = altInteract;

View File

@@ -8,13 +8,13 @@ namespace Content.Shared.Inventory.Events;
[NetSerializable, Serializable]
public sealed class InventoryEquipActEvent : EntityEventArgs
{
public readonly EntityUid Uid;
public readonly EntityUid ItemUid;
public readonly NetEntity Uid;
public readonly NetEntity ItemUid;
public readonly string Slot;
public readonly bool Silent;
public readonly bool Force;
public InventoryEquipActEvent(EntityUid uid, EntityUid itemUid, string slot, bool silent = false, bool force = false)
public InventoryEquipActEvent(NetEntity uid, NetEntity itemUid, string slot, bool silent = false, bool force = false)
{
Uid = uid;
ItemUid = itemUid;

View File

@@ -360,7 +360,7 @@ public abstract partial class InventorySystem
}
//we need to do this to make sure we are 100% removing this entity, since we are now dropping dependant slots
if (!force && !slotContainer.CanRemove(removedItem.Value))
if (!force && !_containerSystem.CanRemove(removedItem.Value, slotContainer))
return false;
foreach (var slotDef in GetSlots(target, inventory))
@@ -426,14 +426,12 @@ public abstract partial class InventorySystem
if ((containerSlot == null || slotDefinition == null) && !TryGetSlotContainer(target, slot, out containerSlot, out slotDefinition, inventory))
return false;
if (containerSlot.ContainedEntity == null)
if (containerSlot.ContainedEntity is not {} itemUid)
return false;
if (!containerSlot.ContainedEntity.HasValue || !containerSlot.CanRemove(containerSlot.ContainedEntity.Value))
if (!_containerSystem.CanRemove(itemUid, containerSlot))
return false;
var itemUid = containerSlot.ContainedEntity.Value;
// make sure the user can actually reach the target
if (!CanAccess(actor, target, itemUid))
{

View File

@@ -56,10 +56,10 @@ public sealed class ItemComponentState : ComponentState
[Serializable, NetSerializable]
public sealed class VisualsChangedEvent : EntityEventArgs
{
public readonly EntityUid Item;
public readonly NetEntity Item;
public readonly string ContainerId;
public VisualsChangedEvent(EntityUid item, string containerId)
public VisualsChangedEvent(NetEntity item, string containerId)
{
Item = item;
ContainerId = containerId;

View File

@@ -18,8 +18,8 @@ namespace Content.Shared.Kitchen.Components
[Serializable, NetSerializable]
public sealed class MicrowaveEjectSolidIndexedMessage : BoundUserInterfaceMessage
{
public EntityUid EntityID;
public MicrowaveEjectSolidIndexedMessage(EntityUid entityId)
public NetEntity EntityID;
public MicrowaveEjectSolidIndexedMessage(NetEntity entityId)
{
EntityID = entityId;
}
@@ -50,12 +50,12 @@ namespace Content.Shared.Kitchen.Components
[NetSerializable, Serializable]
public sealed class MicrowaveUpdateUserInterfaceState : BoundUserInterfaceState
{
public EntityUid[] ContainedSolids;
public NetEntity[] ContainedSolids;
public bool IsMicrowaveBusy;
public int ActiveButtonIndex;
public uint CurrentCookTime;
public MicrowaveUpdateUserInterfaceState(EntityUid[] containedSolids,
public MicrowaveUpdateUserInterfaceState(NetEntity[] containedSolids,
bool isMicrowaveBusy, int activeButtonIndex, uint currentCookTime)
{
ContainedSolids = containedSolids;

View File

@@ -32,8 +32,8 @@ namespace Content.Shared.Kitchen
[Serializable, NetSerializable]
public sealed class ReagentGrinderEjectChamberContentMessage : BoundUserInterfaceMessage
{
public EntityUid EntityId;
public ReagentGrinderEjectChamberContentMessage(EntityUid entityId)
public NetEntity EntityId;
public ReagentGrinderEjectChamberContentMessage(NetEntity entityId)
{
EntityId = entityId;
}
@@ -84,9 +84,9 @@ namespace Content.Shared.Kitchen
public bool Powered;
public bool CanJuice;
public bool CanGrind;
public EntityUid[] ChamberContents;
public NetEntity[] ChamberContents;
public ReagentQuantity[]? ReagentQuantities;
public ReagentGrinderInterfaceState(bool isBusy, bool hasBeaker, bool powered, bool canJuice, bool canGrind, EntityUid[] chamberContents, ReagentQuantity[]? heldBeakerContents)
public ReagentGrinderInterfaceState(bool isBusy, bool hasBeaker, bool powered, bool canJuice, bool canGrind, NetEntity[] chamberContents, ReagentQuantity[]? heldBeakerContents)
{
IsBusy = isBusy;
HasBeakerIn = hasBeaker;

View File

@@ -27,13 +27,13 @@ public sealed class GridDragToggleMessage : EntityEventArgs
[Serializable, NetSerializable]
public sealed class GridDragRequestPosition : EntityEventArgs
{
public EntityUid Grid;
public NetEntity Grid;
public Vector2 WorldPosition;
}
[Serializable, NetSerializable]
public sealed class GridDragVelocityRequest : EntityEventArgs
{
public EntityUid Grid;
public NetEntity Grid;
public Vector2 LinearVelocity;
}

View File

@@ -25,11 +25,12 @@ public sealed class NewsWriteBoundUserInterfaceState : BoundUserInterfaceState
[Serializable, NetSerializable]
public sealed class NewsWriteShareMessage : BoundUserInterfaceMessage
{
public NewsArticle Article;
public NewsWriteShareMessage(NewsArticle article)
public readonly string Name;
public readonly string Content;
public NewsWriteShareMessage(string name, string content)
{
Article = article;
Name = name;
Content = content;
}
}

View File

@@ -1,13 +1,13 @@
using Content.Shared.StationRecords;
using Robust.Shared.Serialization;
namespace Content.Shared.MassMedia.Systems;
[Serializable]
[Serializable, NetSerializable]
public struct NewsArticle
{
public string Name;
public string Content;
public string? Author;
public ICollection<StationRecordKey>? AuthorStationRecordKeyIds;
public ICollection<(NetEntity, uint)>? AuthorStationRecordKeyIds;
public TimeSpan ShareTime;
}

View File

@@ -169,6 +169,6 @@ public sealed class MechComponentState : ComponentState
public FixedPoint2 MaxIntegrity;
public FixedPoint2 Energy;
public FixedPoint2 MaxEnergy;
public EntityUid? CurrentSelectedEquipment;
public NetEntity? CurrentSelectedEquipment;
public bool Broken;
}

View File

@@ -22,5 +22,5 @@ public sealed partial class MechPilotComponent : Component
[Serializable, NetSerializable]
public sealed class MechPilotComponentState : ComponentState
{
public EntityUid Mech;
public NetEntity Mech;
}

View File

@@ -69,7 +69,7 @@ public abstract class SharedMechSystem : EntitySystem
MaxIntegrity = component.MaxIntegrity,
Energy = component.Energy,
MaxEnergy = component.MaxEnergy,
CurrentSelectedEquipment = component.CurrentSelectedEquipment,
CurrentSelectedEquipment = GetNetEntity(component.CurrentSelectedEquipment),
Broken = component.Broken
};
}
@@ -83,7 +83,7 @@ public abstract class SharedMechSystem : EntitySystem
component.MaxIntegrity = state.MaxIntegrity;
component.Energy = state.Energy;
component.MaxEnergy = state.MaxEnergy;
component.CurrentSelectedEquipment = state.CurrentSelectedEquipment;
component.CurrentSelectedEquipment = EnsureEntity<MechComponent>(state.CurrentSelectedEquipment, uid);
component.Broken = state.Broken;
}
@@ -91,7 +91,7 @@ public abstract class SharedMechSystem : EntitySystem
{
args.State = new MechPilotComponentState
{
Mech = component.Mech
Mech = GetNetEntity(component.Mech)
};
}
@@ -100,7 +100,7 @@ public abstract class SharedMechSystem : EntitySystem
if (args.Current is not MechPilotComponentState state)
return;
component.Mech = state.Mech;
component.Mech = EnsureEntity<MechPilotComponent>(state.Mech, uid);
}
#endregion

View File

@@ -31,7 +31,7 @@ public sealed class MechSoundboardSystem : EntitySystem
{
Sounds = sounds.ToList()
};
args.States.Add(uid, state);
args.States.Add(GetNetEntity(uid), state);
}
private void OnSoundboardMessage(EntityUid uid, MechSoundboardComponent comp, MechEquipmentUiMessageRelayEvent args)

View File

@@ -13,7 +13,7 @@ public enum MechUiKey : byte
/// </summary>
public sealed class MechEquipmentUiStateReadyEvent : EntityEventArgs
{
public Dictionary<EntityUid, BoundUserInterfaceState> States = new();
public Dictionary<NetEntity, BoundUserInterfaceState> States = new();
}
/// <summary>
@@ -35,9 +35,9 @@ public sealed class MechEquipmentUiMessageRelayEvent : EntityEventArgs
[Serializable, NetSerializable]
public sealed class MechEquipmentRemoveMessage : BoundUserInterfaceMessage
{
public EntityUid Equipment;
public NetEntity Equipment;
public MechEquipmentRemoveMessage(EntityUid equipment)
public MechEquipmentRemoveMessage(NetEntity equipment)
{
Equipment = equipment;
}
@@ -49,7 +49,7 @@ public sealed class MechEquipmentRemoveMessage : BoundUserInterfaceMessage
[Serializable, NetSerializable]
public abstract class MechEquipmentUiMessage : BoundUserInterfaceMessage
{
public EntityUid Equipment;
public NetEntity Equipment;
}
/// <summary>
@@ -58,9 +58,9 @@ public abstract class MechEquipmentUiMessage : BoundUserInterfaceMessage
[Serializable, NetSerializable]
public sealed class MechGrabberEjectMessage : MechEquipmentUiMessage
{
public EntityUid Item;
public NetEntity Item;
public MechGrabberEjectMessage(EntityUid equipment, EntityUid uid)
public MechGrabberEjectMessage(NetEntity equipment, NetEntity uid)
{
Equipment = equipment;
Item = uid;
@@ -75,7 +75,7 @@ public sealed class MechSoundboardPlayMessage : MechEquipmentUiMessage
{
public int Sound;
public MechSoundboardPlayMessage(EntityUid equipment, int sound)
public MechSoundboardPlayMessage(NetEntity equipment, int sound)
{
Equipment = equipment;
Sound = sound;
@@ -106,13 +106,13 @@ public sealed class MechSoundboardPlayMessage : MechEquipmentUiMessage
[Serializable, NetSerializable]
public sealed class MechBoundUiState : BoundUserInterfaceState
{
public Dictionary<EntityUid, BoundUserInterfaceState> EquipmentStates = new();
public Dictionary<NetEntity, BoundUserInterfaceState> EquipmentStates = new();
}
[Serializable, NetSerializable]
public sealed class MechGrabberUiState : BoundUserInterfaceState
{
public List<EntityUid> Contents = new();
public List<NetEntity> Contents = new();
public int MaxContents;
}

View File

@@ -6,7 +6,7 @@ namespace Content.Shared.Medical.SuitSensor
[Serializable, NetSerializable]
public sealed class SuitSensorStatus
{
public SuitSensorStatus(EntityUid suitSensorUid, string name, string job)
public SuitSensorStatus(NetEntity suitSensorUid, string name, string job)
{
SuitSensorUid = suitSensorUid;
Name = name;
@@ -14,12 +14,12 @@ namespace Content.Shared.Medical.SuitSensor
}
public TimeSpan Timestamp;
public EntityUid SuitSensorUid;
public NetEntity SuitSensorUid;
public string Name;
public string Job;
public bool IsAlive;
public int? TotalDamage;
public EntityCoordinates? Coordinates;
public NetCoordinates? Coordinates;
}
[Serializable, NetSerializable]

View File

@@ -8,11 +8,11 @@ namespace Content.Shared.MedicalScanner;
[Serializable, NetSerializable]
public sealed class HealthAnalyzerScannedUserMessage : BoundUserInterfaceMessage
{
public readonly EntityUid? TargetEntity;
public readonly NetEntity? TargetEntity;
public float Temperature;
public float BloodLevel;
public HealthAnalyzerScannedUserMessage(EntityUid? targetEntity, float temperature, float bloodLevel)
public HealthAnalyzerScannedUserMessage(NetEntity? targetEntity, float temperature, float bloodLevel)
{
TargetEntity = targetEntity;
Temperature = temperature;

Some files were not shown because too many files have changed in this diff Show More