Adds disposal mailing units (again) (#7630)
This commit is contained in:
@@ -13,6 +13,10 @@ namespace Content.Shared.Disposal.Components
|
||||
/// </summary>
|
||||
public List<EntityUid> RecentlyEjected = new();
|
||||
|
||||
|
||||
[DataField("mobsCanEnter")]
|
||||
public bool MobsCanEnter = true;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum Visuals : byte
|
||||
{
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
using Content.Shared.Disposal.Components;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Disposal;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class MailingUnitBoundUserInterfaceState: BoundUserInterfaceState, IEquatable<MailingUnitBoundUserInterfaceState>
|
||||
{
|
||||
public string? Target;
|
||||
public List<string> TargetList;
|
||||
public string? Tag;
|
||||
public SharedDisposalUnitComponent.DisposalUnitBoundUserInterfaceState DisposalState;
|
||||
|
||||
public MailingUnitBoundUserInterfaceState(SharedDisposalUnitComponent.DisposalUnitBoundUserInterfaceState disposalState, string? target, List<string> targetList, string? tag)
|
||||
{
|
||||
DisposalState = disposalState;
|
||||
Target = target;
|
||||
TargetList = targetList;
|
||||
Tag = tag;
|
||||
}
|
||||
|
||||
public bool Equals(MailingUnitBoundUserInterfaceState? other)
|
||||
{
|
||||
if (ReferenceEquals(null, other)) return false;
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
return DisposalState.Equals(other.DisposalState)
|
||||
&& Target == other.Target
|
||||
&& TargetList.Equals(other.TargetList)
|
||||
&& Tag == other.Tag;
|
||||
}
|
||||
}
|
||||
23
Content.Shared/Disposal/MailingUnitUiMessages.cs
Normal file
23
Content.Shared/Disposal/MailingUnitUiMessages.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Disposal;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum MailingUnitUiKey : byte
|
||||
{
|
||||
Key
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Message data sent from client to server when a disposal unit ui button is pressed.
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class TargetSelectedMessage : BoundUserInterfaceMessage
|
||||
{
|
||||
public readonly string? target;
|
||||
|
||||
public TargetSelectedMessage(string? target)
|
||||
{
|
||||
this.target = target;
|
||||
}
|
||||
}
|
||||
@@ -66,11 +66,15 @@ namespace Content.Shared.Disposal
|
||||
return false;
|
||||
}
|
||||
|
||||
//Check if the entity is a mob and if mobs can be inserted
|
||||
if (EntityManager.HasComponent<MobStateComponent>(entity) && !component.MobsCanEnter)
|
||||
return false;
|
||||
|
||||
if (!EntityManager.TryGetComponent(entity, out IPhysBody? physics) ||
|
||||
!physics.CanCollide && storable == null)
|
||||
{
|
||||
if (!(EntityManager.TryGetComponent(entity, out MobStateComponent? damageState) && damageState.IsDead()))
|
||||
if (!(EntityManager.TryGetComponent(entity, out MobStateComponent? damageState) &&
|
||||
(!component.MobsCanEnter || damageState.IsDead())))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user