Disable interactions for entities in storage
This commit is contained in:
@@ -3,17 +3,18 @@
|
||||
using Robust.Shared.Utility;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.GameObjects.Components.Items.Storage;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Shared.GameObjects;
|
||||
using Content.Shared.GameObjects.Components.Items;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Serialization;
|
||||
using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
|
||||
namespace Content.Server.GameObjects
|
||||
namespace Content.Server.GameObjects.Components.Items.Clothing
|
||||
{
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(ItemComponent))]
|
||||
|
||||
@@ -212,6 +212,11 @@ namespace Content.Server.GameObjects.Components.Items.Storage
|
||||
|
||||
private bool AddToContents(IEntity entity)
|
||||
{
|
||||
if (!entity.HasComponent<InEntityStorageComponent>())
|
||||
{
|
||||
entity.AddComponent<InEntityStorageComponent>();
|
||||
}
|
||||
|
||||
var collidableComponent = Owner.GetComponent<ICollidableComponent>();
|
||||
ICollidableComponent entityCollidableComponent;
|
||||
if (entity.TryGetComponent(out entityCollidableComponent))
|
||||
@@ -273,6 +278,11 @@ namespace Content.Server.GameObjects.Components.Items.Storage
|
||||
{
|
||||
entityCollidableComponent.CanCollide = true;
|
||||
}
|
||||
|
||||
if (contained.HasComponent<InEntityStorageComponent>())
|
||||
{
|
||||
contained.RemoveComponent<InEntityStorageComponent>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -407,6 +417,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage
|
||||
|
||||
public void OnDestroy(DestructionEventArgs eventArgs)
|
||||
{
|
||||
Open = true;
|
||||
EmptyContents();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Items.Storage
|
||||
{
|
||||
[RegisterComponent]
|
||||
public class InEntityStorageComponent : Component, IActionBlocker
|
||||
{
|
||||
public override string Name => "InEntityStorage";
|
||||
|
||||
public bool CanInteract()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ using Robust.Shared.Maths;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Server.GameObjects
|
||||
namespace Content.Server.GameObjects.Components.Items.Storage
|
||||
{
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(StoreableComponent))]
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.GameObjects.Components;
|
||||
using Content.Server.GameObjects.Components.Items.Storage;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.Interfaces.GameObjects;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.GameObjects.Components.Storage;
|
||||
using Content.Shared.Interfaces;
|
||||
using Robust.Server.GameObjects;
|
||||
@@ -24,7 +21,7 @@ using Robust.Shared.Log;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Server.GameObjects
|
||||
namespace Content.Server.GameObjects.Components.Items.Storage
|
||||
{
|
||||
/// <summary>
|
||||
/// Storage component for containing entities within this one, matches a UI on the client which shows stored entities
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Server.GameObjects
|
||||
namespace Content.Server.GameObjects.Components.Items.Storage
|
||||
{
|
||||
[RegisterComponent]
|
||||
public class StoreableComponent : Component
|
||||
|
||||
Reference in New Issue
Block a user