Shared Containers (#3331)
* Namespace changes for containers. Moved ContainerSlot from content to engine. * Merged client/server ContainerManagerComponents into a single shared version. * Mapfile and nullability fixes. * Upgrades map. * Update engine.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
using Content.Shared.GameObjects.EntitySystems;
|
using Content.Shared.GameObjects.EntitySystems;
|
||||||
using Content.Shared.Physics;
|
using Content.Shared.Physics;
|
||||||
using Robust.Client.Player;
|
using Robust.Client.Player;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using Content.Client.Utility;
|
|||||||
using Content.Shared.GameObjects.EntitySystems;
|
using Content.Shared.GameObjects.EntitySystems;
|
||||||
using Content.Shared.Utility;
|
using Content.Shared.Utility;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ namespace Content.IntegrationTests.Tests.Interaction
|
|||||||
|
|
||||||
origin = entityManager.SpawnEntity(HumanId, coordinates);
|
origin = entityManager.SpawnEntity(HumanId, coordinates);
|
||||||
other = entityManager.SpawnEntity(HumanId, coordinates);
|
other = entityManager.SpawnEntity(HumanId, coordinates);
|
||||||
container = ContainerManagerComponent.Ensure<Container>("InRangeUnobstructedTestOtherContainer", other);
|
container = ContainerHelpers.EnsureContainer<Container>(other, "InRangeUnobstructedTestOtherContainer");
|
||||||
component = other.Transform;
|
component = other.Transform;
|
||||||
entityCoordinates = other.Transform.Coordinates;
|
entityCoordinates = other.Transform.Coordinates;
|
||||||
mapCoordinates = other.Transform.MapPosition;
|
mapCoordinates = other.Transform.MapPosition;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using System.Threading.Tasks;
|
|||||||
using Content.Server.GameObjects.Components.Construction;
|
using Content.Server.GameObjects.Components.Construction;
|
||||||
using Content.Shared.Construction;
|
using Content.Shared.Construction;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
@@ -54,7 +54,7 @@ namespace Content.Server.Construction.Completions
|
|||||||
var computer = entityManager.SpawnEntity(boardComponent.Prototype, entity.Transform.Coordinates);
|
var computer = entityManager.SpawnEntity(boardComponent.Prototype, entity.Transform.Coordinates);
|
||||||
computer.Transform.LocalRotation = entity.Transform.LocalRotation;
|
computer.Transform.LocalRotation = entity.Transform.LocalRotation;
|
||||||
|
|
||||||
var computerContainer = ContainerManagerComponent.Ensure<Container>(Container, computer, out var existed);
|
var computerContainer = ContainerHelpers.EnsureContainer<Container>(computer, Container, out var existed);
|
||||||
|
|
||||||
if (existed)
|
if (existed)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ using System.Threading.Tasks;
|
|||||||
using Content.Server.GameObjects.Components.Construction;
|
using Content.Server.GameObjects.Components.Construction;
|
||||||
using Content.Shared.Construction;
|
using Content.Shared.Construction;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
@@ -66,7 +65,7 @@ namespace Content.Server.Construction.Completions
|
|||||||
var machine = entityManager.SpawnEntity(boardComponent.Prototype, entity.Transform.Coordinates);
|
var machine = entityManager.SpawnEntity(boardComponent.Prototype, entity.Transform.Coordinates);
|
||||||
machine.Transform.LocalRotation = entity.Transform.LocalRotation;
|
machine.Transform.LocalRotation = entity.Transform.LocalRotation;
|
||||||
|
|
||||||
var boardContainer = ContainerManagerComponent.Ensure<Container>(MachineFrameComponent.BoardContainer, machine, out var existed);
|
var boardContainer = ContainerHelpers.EnsureContainer<Container>(machine, MachineFrameComponent.BoardContainer, out var existed);
|
||||||
|
|
||||||
if (existed)
|
if (existed)
|
||||||
{
|
{
|
||||||
@@ -74,7 +73,7 @@ namespace Content.Server.Construction.Completions
|
|||||||
boardContainer.CleanContainer();
|
boardContainer.CleanContainer();
|
||||||
}
|
}
|
||||||
|
|
||||||
var partContainer = ContainerManagerComponent.Ensure<Container>(MachineFrameComponent.PartContainer, machine, out existed);
|
var partContainer = ContainerHelpers.EnsureContainer<Container>(machine, MachineFrameComponent.PartContainer, out existed);
|
||||||
|
|
||||||
if (existed)
|
if (existed)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Content.Shared.Construction;
|
using Content.Shared.Construction;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Content.Shared.Construction;
|
using Content.Shared.Construction;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Content.Shared.Construction;
|
using Content.Shared.Construction;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ using Content.Shared.GameObjects.Verbs;
|
|||||||
using Content.Shared.GameObjects.EntitySystems;
|
using Content.Shared.GameObjects.EntitySystems;
|
||||||
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
|
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
@@ -40,8 +41,8 @@ namespace Content.Server.GameObjects.Components.Access
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
_privilegedIdContainer = ContainerManagerComponent.Ensure<ContainerSlot>($"{Name}-privilegedId", Owner);
|
_privilegedIdContainer = ContainerHelpers.EnsureContainer<ContainerSlot>(Owner, $"{Name}-privilegedId");
|
||||||
_targetIdContainer = ContainerManagerComponent.Ensure<ContainerSlot>($"{Name}-targetId", Owner);
|
_targetIdContainer = ContainerHelpers.EnsureContainer<ContainerSlot>(Owner, $"{Name}-targetId");
|
||||||
|
|
||||||
Owner.EnsureComponentWarn<AccessReader>();
|
Owner.EnsureComponentWarn<AccessReader>();
|
||||||
Owner.EnsureComponentWarn<ServerUserInterfaceComponent>();
|
Owner.EnsureComponentWarn<ServerUserInterfaceComponent>();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -12,6 +12,7 @@ using Content.Shared.GameObjects.Verbs;
|
|||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
using Content.Shared.Utility;
|
using Content.Shared.Utility;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
@@ -49,7 +50,7 @@ namespace Content.Server.GameObjects.Components.ActionBlocking
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
Container = ContainerManagerComponent.Ensure<Container>(Name, Owner);
|
Container = ContainerHelpers.EnsureContainer<Container>(Owner, Name);
|
||||||
Owner.EnsureComponentWarn<HandsComponent>();
|
Owner.EnsureComponentWarn<HandsComponent>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ using Content.Shared.Utility;
|
|||||||
using Robust.Server.Console;
|
using Robust.Server.Console;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Console;
|
using Robust.Shared.Console;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
@@ -51,7 +52,7 @@ namespace Content.Server.GameObjects.Components.Body
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
_partContainer = ContainerManagerComponent.Ensure<Container>($"{Name}-{nameof(BodyComponent)}", Owner);
|
_partContainer = ContainerHelpers.EnsureContainer<Container>(Owner, $"{Name}-{nameof(BodyComponent)}");
|
||||||
|
|
||||||
foreach (var (slot, partId) in PartIds)
|
foreach (var (slot, partId) in PartIds)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ using Content.Shared.Utility;
|
|||||||
using Robust.Server.Console;
|
using Robust.Server.Console;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
@@ -60,7 +61,7 @@ namespace Content.Server.GameObjects.Components.Body.Part
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
_mechanismContainer = ContainerManagerComponent.Ensure<Container>($"{Name}-{nameof(BodyPartComponent)}", Owner);
|
_mechanismContainer = ContainerHelpers.EnsureContainer<Container>(Owner, $"{Name}-{nameof(BodyPartComponent)}");
|
||||||
|
|
||||||
// This is ran in Startup as entities spawned in Initialize
|
// This is ran in Startup as entities spawned in Initialize
|
||||||
// are not synced to the client since they are assumed to be
|
// are not synced to the client since they are assumed to be
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ using Content.Shared.Utility;
|
|||||||
using Content.Shared.GameObjects.Verbs;
|
using Content.Shared.GameObjects.Verbs;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
@@ -58,7 +59,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
}
|
}
|
||||||
|
|
||||||
_beakerContainer =
|
_beakerContainer =
|
||||||
ContainerManagerComponent.Ensure<ContainerSlot>($"{Name}-reagentContainerContainer", Owner);
|
ContainerHelpers.EnsureContainer<ContainerSlot>(Owner, $"{Name}-reagentContainerContainer");
|
||||||
|
|
||||||
//BufferSolution = Owner.BufferSolution
|
//BufferSolution = Owner.BufferSolution
|
||||||
BufferSolution.RemoveAllSolution();
|
BufferSolution.RemoveAllSolution();
|
||||||
@@ -185,7 +186,11 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var beaker = _beakerContainer.ContainedEntity;
|
var beaker = _beakerContainer.ContainedEntity;
|
||||||
_beakerContainer.Remove(_beakerContainer.ContainedEntity);
|
|
||||||
|
if(beaker is null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_beakerContainer.Remove(beaker);
|
||||||
UpdateUserInterface();
|
UpdateUserInterface();
|
||||||
|
|
||||||
if(!user.TryGetComponent<HandsComponent>(out var hands) || !beaker.TryGetComponent<ItemComponent>(out var item))
|
if(!user.TryGetComponent<HandsComponent>(out var hands) || !beaker.TryGetComponent<ItemComponent>(out var item))
|
||||||
@@ -198,6 +203,10 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
{
|
{
|
||||||
if (!HasBeaker && _bufferModeTransfer) return;
|
if (!HasBeaker && _bufferModeTransfer) return;
|
||||||
var beaker = _beakerContainer.ContainedEntity;
|
var beaker = _beakerContainer.ContainedEntity;
|
||||||
|
|
||||||
|
if(beaker is null)
|
||||||
|
return;
|
||||||
|
|
||||||
var beakerSolution = beaker.GetComponent<SolutionContainerComponent>();
|
var beakerSolution = beaker.GetComponent<SolutionContainerComponent>();
|
||||||
if (isBuffer)
|
if (isBuffer)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ using Content.Shared.GameObjects.Verbs;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
@@ -47,7 +48,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
|
|
||||||
[ViewVariables] private bool HasBeaker => _beakerContainer.ContainedEntity != null;
|
[ViewVariables] private bool HasBeaker => _beakerContainer.ContainedEntity != null;
|
||||||
[ViewVariables] private ReagentUnit _dispenseAmount = ReagentUnit.New(10);
|
[ViewVariables] private ReagentUnit _dispenseAmount = ReagentUnit.New(10);
|
||||||
[UsedImplicitly] [ViewVariables] private SolutionContainerComponent? Solution => _beakerContainer.ContainedEntity.GetComponent<SolutionContainerComponent>();
|
[UsedImplicitly] [ViewVariables] private SolutionContainerComponent? Solution => _beakerContainer.ContainedEntity?.GetComponent<SolutionContainerComponent>();
|
||||||
|
|
||||||
[ViewVariables] private bool Powered => !Owner.TryGetComponent(out PowerReceiverComponent? receiver) || receiver.Powered;
|
[ViewVariables] private bool Powered => !Owner.TryGetComponent(out PowerReceiverComponent? receiver) || receiver.Powered;
|
||||||
|
|
||||||
@@ -78,7 +79,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
}
|
}
|
||||||
|
|
||||||
_beakerContainer =
|
_beakerContainer =
|
||||||
ContainerManagerComponent.Ensure<ContainerSlot>($"{Name}-reagentContainerContainer", Owner);
|
ContainerHelpers.EnsureContainer<ContainerSlot>(Owner, $"{Name}-reagentContainerContainer");
|
||||||
|
|
||||||
InitializeFromPrototype();
|
InitializeFromPrototype();
|
||||||
UpdateUserInterface();
|
UpdateUserInterface();
|
||||||
@@ -246,7 +247,10 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var beaker = _beakerContainer.ContainedEntity;
|
var beaker = _beakerContainer.ContainedEntity;
|
||||||
_beakerContainer.Remove(_beakerContainer.ContainedEntity);
|
if(beaker is null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_beakerContainer.Remove(beaker);
|
||||||
UpdateUserInterface();
|
UpdateUserInterface();
|
||||||
|
|
||||||
if(!user.TryGetComponent<HandsComponent>(out var hands) || !beaker.TryGetComponent<ItemComponent>(out var item))
|
if(!user.TryGetComponent<HandsComponent>(out var hands) || !beaker.TryGetComponent<ItemComponent>(out var item))
|
||||||
@@ -261,7 +265,10 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
private void TryClear()
|
private void TryClear()
|
||||||
{
|
{
|
||||||
if (!HasBeaker) return;
|
if (!HasBeaker) return;
|
||||||
var solution = _beakerContainer.ContainedEntity.GetComponent<SolutionContainerComponent>();
|
var solution = _beakerContainer.ContainedEntity?.GetComponent<SolutionContainerComponent>();
|
||||||
|
if(solution is null)
|
||||||
|
return;
|
||||||
|
|
||||||
solution.RemoveAllSolution();
|
solution.RemoveAllSolution();
|
||||||
|
|
||||||
UpdateUserInterface();
|
UpdateUserInterface();
|
||||||
@@ -275,7 +282,10 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
{
|
{
|
||||||
if (!HasBeaker) return;
|
if (!HasBeaker) return;
|
||||||
|
|
||||||
var solution = _beakerContainer.ContainedEntity.GetComponent<SolutionContainerComponent>();
|
var solution = _beakerContainer.ContainedEntity?.GetComponent<SolutionContainerComponent>();
|
||||||
|
if (solution is null)
|
||||||
|
return;
|
||||||
|
|
||||||
solution.TryAddReagent(Inventory[dispenseIndex].ID, _dispenseAmount, out _);
|
solution.TryAddReagent(Inventory[dispenseIndex].ID, _dispenseAmount, out _);
|
||||||
|
|
||||||
UpdateUserInterface();
|
UpdateUserInterface();
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Server.GameObjects.Components.Construction;
|
|||||||
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
||||||
using Content.Shared.GameObjects.Components;
|
using Content.Shared.GameObjects.Components;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
@@ -71,7 +72,7 @@ namespace Content.Server.GameObjects.Components
|
|||||||
if (string.IsNullOrEmpty(_boardPrototype))
|
if (string.IsNullOrEmpty(_boardPrototype))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var container = ContainerManagerComponent.Ensure<Container>("board", Owner, out var existed);
|
var container = ContainerHelpers.EnsureContainer<Container>(Owner, "board", out var existed);
|
||||||
|
|
||||||
if (existed)
|
if (existed)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ using Content.Shared.Construction;
|
|||||||
using Content.Shared.GameObjects.Components.Interactable;
|
using Content.Shared.GameObjects.Components.Interactable;
|
||||||
using Content.Shared.GameObjects.EntitySystems;
|
using Content.Shared.GameObjects.EntitySystems;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
@@ -286,7 +286,7 @@ namespace Content.Server.GameObjects.Components.Construction
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
_containers.Add(insertStep.Store);
|
_containers.Add(insertStep.Store);
|
||||||
var container = ContainerManagerComponent.Ensure<Container>(insertStep.Store, Owner);
|
var container = ContainerHelpers.EnsureContainer<Container>(Owner, insertStep.Store);
|
||||||
container.Insert(entityUsing);
|
container.Insert(entityUsing);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -425,7 +425,7 @@ namespace Content.Server.GameObjects.Components.Construction
|
|||||||
{
|
{
|
||||||
foreach (var container in _containers)
|
foreach (var container in _containers)
|
||||||
{
|
{
|
||||||
var otherContainer = ContainerManagerComponent.Ensure<Container>(container, entity);
|
var otherContainer = ContainerHelpers.EnsureContainer<Container>(entity, container);
|
||||||
var ourContainer = containerComp.GetContainer(container);
|
var ourContainer = containerComp.GetContainer(container);
|
||||||
|
|
||||||
foreach (var ent in ourContainer.ContainedEntities.ToArray())
|
foreach (var ent in ourContainer.ContainedEntities.ToArray())
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using Content.Server.Construction;
|
using Content.Server.Construction;
|
||||||
using Content.Server.Interfaces.GameObjects;
|
using Content.Server.Interfaces.GameObjects;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
|
||||||
@@ -28,8 +29,8 @@ namespace Content.Server.GameObjects.Components.Construction
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
_boardContainer = ContainerManagerComponent.Ensure<Container>(MachineFrameComponent.BoardContainer, Owner);
|
_boardContainer = ContainerHelpers.EnsureContainer<Container>(Owner, MachineFrameComponent.BoardContainer);
|
||||||
_partContainer = ContainerManagerComponent.Ensure<Container>(MachineFrameComponent.PartContainer, Owner);
|
_partContainer = ContainerHelpers.EnsureContainer<Container>(Owner, MachineFrameComponent.PartContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Startup()
|
protected override void Startup()
|
||||||
@@ -59,8 +60,8 @@ namespace Content.Server.GameObjects.Components.Construction
|
|||||||
public void CreateBoardAndStockParts()
|
public void CreateBoardAndStockParts()
|
||||||
{
|
{
|
||||||
// Entity might not be initialized yet.
|
// Entity might not be initialized yet.
|
||||||
var boardContainer = ContainerManagerComponent.Ensure<Container>(MachineFrameComponent.BoardContainer, Owner, out var existedBoard);
|
var boardContainer = ContainerHelpers.EnsureContainer<Container>(Owner, MachineFrameComponent.BoardContainer, out var existedBoard);
|
||||||
var partContainer = ContainerManagerComponent.Ensure<Container>(MachineFrameComponent.PartContainer, Owner, out var existedParts);
|
var partContainer = ContainerHelpers.EnsureContainer<Container>(Owner, MachineFrameComponent.PartContainer, out var existedParts);
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(BoardPrototype))
|
if (string.IsNullOrEmpty(BoardPrototype))
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -87,8 +87,8 @@ namespace Content.Server.GameObjects.Components.Construction
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
_boardContainer = ContainerManagerComponent.Ensure<Container>(BoardContainer, Owner);
|
_boardContainer = ContainerHelpers.EnsureContainer<Container>(Owner, BoardContainer);
|
||||||
_partContainer = ContainerManagerComponent.Ensure<Container>(PartContainer, Owner);
|
_partContainer = ContainerHelpers.EnsureContainer<Container>(Owner, PartContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Startup()
|
protected override void Startup()
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using Robust.Server.GameObjects;
|
using Robust.Shared.Containers;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.ContainerExt
|
namespace Content.Server.GameObjects
|
||||||
{
|
{
|
||||||
public static class ContainerExt
|
public static class ContainerExt
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
using Robust.Server.GameObjects;
|
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ using Content.Server.GameObjects.Components.Items.Storage;
|
|||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Content.Shared.GameObjects.Components.Body;
|
using Content.Shared.GameObjects.Components.Body;
|
||||||
using Robust.Server.GameObjects;
|
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
@@ -64,7 +63,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
_contents = ContainerManagerComponent.Ensure<Container>(nameof(DisposalHolderComponent), Owner);
|
_contents = ContainerHelpers.EnsureContainer<Container>(Owner, nameof(DisposalHolderComponent));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnRemove()
|
public override void OnRemove()
|
||||||
|
|||||||
@@ -589,7 +589,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
_container = ContainerManagerComponent.Ensure<Container>(Name, Owner);
|
_container = ContainerHelpers.EnsureContainer<Container>(Owner, Name);
|
||||||
|
|
||||||
if (UserInterface != null)
|
if (UserInterface != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Content.Shared.GameObjects.Verbs;
|
|||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
using Robust.Server.Console;
|
using Robust.Server.Console;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
@@ -222,7 +223,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
Contents = ContainerManagerComponent.Ensure<Container>(Name, Owner);
|
Contents = ContainerHelpers.EnsureContainer<Container>(Owner, Name);
|
||||||
Owner.EnsureComponent<AnchorableComponent>();
|
Owner.EnsureComponent<AnchorableComponent>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -546,7 +546,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
_container = ContainerManagerComponent.Ensure<Container>(Name, Owner);
|
_container = ContainerHelpers.EnsureContainer<Container>(Owner, Name);
|
||||||
|
|
||||||
if (UserInterface != null)
|
if (UserInterface != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ using Content.Server.GameObjects.Components.Trigger.TimerTrigger;
|
|||||||
using Content.Server.Throw;
|
using Content.Server.Throw;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Content.Shared.GameObjects.Components.Explosion;
|
using Content.Shared.GameObjects.Components.Explosion;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
@@ -83,7 +84,7 @@ namespace Content.Server.GameObjects.Components.Explosives
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
_grenadesContainer = ContainerManagerComponent.Ensure<Container>("cluster-flash", Owner);
|
_grenadesContainer = ContainerHelpers.EnsureContainer<Container>(Owner, "cluster-flash");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Content.Shared.GameObjects.Components;
|
|||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
@@ -33,7 +34,7 @@ namespace Content.Server.GameObjects.Components
|
|||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
ItemContainer =
|
ItemContainer =
|
||||||
ContainerManagerComponent.Ensure<ContainerSlot>("extinguisher_cabinet", Owner, out _);
|
ContainerHelpers.EnsureContainer<ContainerSlot>(Owner, "extinguisher_cabinet", out _);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ExposeData(ObjectSerializer serializer)
|
public override void ExposeData(ObjectSerializer serializer)
|
||||||
|
|||||||
@@ -457,7 +457,7 @@ namespace Content.Server.GameObjects.Components.GUI
|
|||||||
throw new InvalidOperationException($"Hand '{name}' already exists.");
|
throw new InvalidOperationException($"Hand '{name}' already exists.");
|
||||||
}
|
}
|
||||||
|
|
||||||
var container = ContainerManagerComponent.Create<ContainerSlot>($"hand {_nextHand++}", Owner);
|
var container = ContainerHelpers.CreateContainer<ContainerSlot>(Owner, $"hand {_nextHand++}");
|
||||||
var hand = new Hand(this, name, container);
|
var hand = new Hand(this, name, container);
|
||||||
|
|
||||||
_hands.Add(hand);
|
_hands.Add(hand);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Content.Server.GameObjects.Components.Items.Storage;
|
using Content.Server.GameObjects.Components.Items.Storage;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines;
|
using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines;
|
||||||
|
|||||||
@@ -426,7 +426,7 @@ namespace Content.Server.GameObjects.Components.GUI
|
|||||||
|
|
||||||
Dirty();
|
Dirty();
|
||||||
|
|
||||||
_slotContainers[slot] = ContainerManagerComponent.Create<ContainerSlot>(GetSlotString(slot), Owner);
|
_slotContainers[slot] = ContainerHelpers.CreateContainer<ContainerSlot>(Owner, GetSlotString(slot));
|
||||||
|
|
||||||
OnItemChanged?.Invoke();
|
OnItemChanged?.Invoke();
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ using Content.Shared.GameObjects.Verbs;
|
|||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
@@ -123,7 +124,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage
|
|||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
Contents = ContainerManagerComponent.Ensure<Container>(nameof(EntityStorageComponent), Owner);
|
Contents = ContainerHelpers.EnsureContainer<Container>(Owner, nameof(EntityStorageComponent));
|
||||||
EntityQuery = new IntersectingEntityQuery(Owner);
|
EntityQuery = new IntersectingEntityQuery(Owner);
|
||||||
|
|
||||||
Contents.ShowContents = _showContents;
|
Contents.ShowContents = _showContents;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using Content.Server.GameObjects.Components.GUI;
|
|||||||
using Content.Server.Interfaces.GameObjects.Components.Items;
|
using Content.Server.Interfaces.GameObjects.Components.Items;
|
||||||
using Content.Shared.GameObjects.EntitySystems;
|
using Content.Shared.GameObjects.EntitySystems;
|
||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
@@ -29,7 +29,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage
|
|||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
_itemContainer = ContainerManagerComponent.Ensure<ContainerSlot>("stash", Owner, out _);
|
_itemContainer = ContainerHelpers.EnsureContainer<ContainerSlot>(Owner, "stash", out _);
|
||||||
}
|
}
|
||||||
public override void ExposeData(ObjectSerializer serializer)
|
public override void ExposeData(ObjectSerializer serializer)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ using Content.Shared.Utility;
|
|||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.Enums;
|
using Robust.Shared.Enums;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
@@ -350,7 +351,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage
|
|||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
// ReSharper disable once StringLiteralTypo
|
// ReSharper disable once StringLiteralTypo
|
||||||
_storage = ContainerManagerComponent.Ensure<Container>("storagebase", Owner);
|
_storage = ContainerHelpers.EnsureContainer<Container>(Owner, "storagebase");
|
||||||
_storage.OccludesLight = _occludesLight;
|
_storage.OccludesLight = _occludesLight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.Collections.Generic;
|
|||||||
using Content.Shared.GameObjects.Components;
|
using Content.Shared.GameObjects.Components;
|
||||||
using Content.Shared.GameObjects.Components.Tag;
|
using Content.Shared.GameObjects.Components.Tag;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ using Content.Shared.Kitchen;
|
|||||||
using Content.Shared.Prototypes.Kitchen;
|
using Content.Shared.Prototypes.Kitchen;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
@@ -83,7 +84,7 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
|||||||
|
|
||||||
Owner.EnsureComponent<SolutionContainerComponent>();
|
Owner.EnsureComponent<SolutionContainerComponent>();
|
||||||
|
|
||||||
_storage = ContainerManagerComponent.Ensure<Container>("microwave_entity_container", Owner, out var existed);
|
_storage = ContainerHelpers.EnsureContainer<Container>(Owner, "microwave_entity_container", out var existed);
|
||||||
_audioSystem = EntitySystem.Get<AudioSystem>();
|
_audioSystem = EntitySystem.Get<AudioSystem>();
|
||||||
|
|
||||||
if (UserInterface != null)
|
if (UserInterface != null)
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ using Content.Shared.Kitchen;
|
|||||||
using Content.Shared.Utility;
|
using Content.Shared.Utility;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
@@ -78,11 +79,11 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
|||||||
base.Initialize();
|
base.Initialize();
|
||||||
//A slot for the beaker where the grounds/juices will go.
|
//A slot for the beaker where the grounds/juices will go.
|
||||||
_beakerContainer =
|
_beakerContainer =
|
||||||
ContainerManagerComponent.Ensure<ContainerSlot>($"{Name}-reagentContainerContainer", Owner);
|
ContainerHelpers.EnsureContainer<ContainerSlot>(Owner, $"{Name}-reagentContainerContainer");
|
||||||
|
|
||||||
//A container for the things that WILL be ground/juiced. Useful for ejecting them instead of deleting them from the hands of the user.
|
//A container for the things that WILL be ground/juiced. Useful for ejecting them instead of deleting them from the hands of the user.
|
||||||
_chamber =
|
_chamber =
|
||||||
ContainerManagerComponent.Ensure<Container>($"{Name}-entityContainerContainer", Owner);
|
ContainerHelpers.EnsureContainer<Container>(Owner, $"{Name}-entityContainerContainer");
|
||||||
|
|
||||||
if (UserInterface != null)
|
if (UserInterface != null)
|
||||||
{
|
{
|
||||||
@@ -242,7 +243,11 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
|||||||
if (!HasBeaker || _heldBeaker == null || _busy)
|
if (!HasBeaker || _heldBeaker == null || _busy)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_beakerContainer.Remove(_beakerContainer.ContainedEntity);
|
var beaker = _beakerContainer.ContainedEntity;
|
||||||
|
if(beaker is null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_beakerContainer.Remove(beaker);
|
||||||
|
|
||||||
if (user == null || !user.TryGetComponent<HandsComponent>(out var hands) || !_heldBeaker.Owner.TryGetComponent<ItemComponent>(out var item))
|
if (user == null || !user.TryGetComponent<HandsComponent>(out var hands) || !_heldBeaker.Owner.TryGetComponent<ItemComponent>(out var item))
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ using Content.Shared.Interfaces.GameObjects.Components;
|
|||||||
using Content.Shared.Preferences;
|
using Content.Shared.Preferences;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
@@ -59,7 +60,7 @@ namespace Content.Server.GameObjects.Components.Medical
|
|||||||
UserInterface.OnReceiveMessage += OnUiReceiveMessage;
|
UserInterface.OnReceiveMessage += OnUiReceiveMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
_bodyContainer = ContainerManagerComponent.Ensure<ContainerSlot>($"{Name}-bodyContainer", Owner);
|
_bodyContainer = ContainerHelpers.EnsureContainer<ContainerSlot>(Owner, $"{Name}-bodyContainer");
|
||||||
|
|
||||||
//TODO: write this so that it checks for a change in power events for GORE POD cases
|
//TODO: write this so that it checks for a change in power events for GORE POD cases
|
||||||
var newState = GetUserInterfaceState();
|
var newState = GetUserInterfaceState();
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
|
|||||||
using Content.Shared.GameObjects.Verbs;
|
using Content.Shared.GameObjects.Verbs;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
@@ -52,7 +53,7 @@ namespace Content.Server.GameObjects.Components.Medical
|
|||||||
UserInterface.OnReceiveMessage += OnUiReceiveMessage;
|
UserInterface.OnReceiveMessage += OnUiReceiveMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
_bodyContainer = ContainerManagerComponent.Ensure<ContainerSlot>($"{Name}-bodyContainer", Owner);
|
_bodyContainer = ContainerHelpers.EnsureContainer<ContainerSlot>(Owner, $"{Name}-bodyContainer");
|
||||||
|
|
||||||
// TODO: write this so that it checks for a change in power events and acts accordingly.
|
// TODO: write this so that it checks for a change in power events and acts accordingly.
|
||||||
var newState = GetUserInterfaceState();
|
var newState = GetUserInterfaceState();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using Content.Server.GameObjects.Components.GUI;
|
using Content.Server.GameObjects.Components.GUI;
|
||||||
using Content.Server.GameObjects.Components.Items.Storage;
|
using Content.Server.GameObjects.Components.Items.Storage;
|
||||||
using Content.Server.GameObjects.Components.Paper;
|
using Content.Server.GameObjects.Components.Paper;
|
||||||
@@ -17,6 +17,7 @@ using Robust.Shared.Utility;
|
|||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
|
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Morgue
|
namespace Content.Server.GameObjects.Components.Morgue
|
||||||
{
|
{
|
||||||
@@ -37,7 +38,7 @@ namespace Content.Server.GameObjects.Components.Morgue
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
_appearance?.SetData(BodyBagVisuals.Label, false);
|
_appearance?.SetData(BodyBagVisuals.Label, false);
|
||||||
LabelContainer = ContainerManagerComponent.Ensure<ContainerSlot>("body_bag_label", Owner, out _);
|
LabelContainer = ContainerHelpers.EnsureContainer<ContainerSlot>(Owner, "body_bag_label", out _);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool AddToContents(IEntity entity)
|
protected override bool AddToContents(IEntity entity)
|
||||||
@@ -83,14 +84,18 @@ namespace Content.Server.GameObjects.Components.Morgue
|
|||||||
{
|
{
|
||||||
if (LabelContainer == null) return;
|
if (LabelContainer == null) return;
|
||||||
|
|
||||||
|
var ent = LabelContainer.ContainedEntity;
|
||||||
|
if(ent is null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (user.TryGetComponent(out HandsComponent? hands))
|
if (user.TryGetComponent(out HandsComponent? hands))
|
||||||
{
|
{
|
||||||
hands.PutInHandOrDrop(LabelContainer.ContainedEntity.GetComponent<ItemComponent>());
|
hands.PutInHandOrDrop(ent.GetComponent<ItemComponent>());
|
||||||
_appearance?.SetData(BodyBagVisuals.Label, false);
|
_appearance?.SetData(BodyBagVisuals.Label, false);
|
||||||
}
|
}
|
||||||
else if (LabelContainer.Remove(LabelContainer.ContainedEntity))
|
else if (LabelContainer.Remove(ent))
|
||||||
{
|
{
|
||||||
LabelContainer.ContainedEntity.Transform.Coordinates = Owner.Transform.Coordinates;
|
ent.Transform.Coordinates = Owner.Transform.Coordinates;
|
||||||
_appearance?.SetData(BodyBagVisuals.Label, false);
|
_appearance?.SetData(BodyBagVisuals.Label, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Content.Shared.Interfaces.GameObjects.Components;
|
|||||||
using Content.Shared.Physics;
|
using Content.Shared.Physics;
|
||||||
using Content.Shared.Utility;
|
using Content.Shared.Utility;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
@@ -46,7 +47,7 @@ namespace Content.Server.GameObjects.Components.Morgue
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
Appearance?.SetData(MorgueVisuals.Open, false);
|
Appearance?.SetData(MorgueVisuals.Open, false);
|
||||||
TrayContainer = ContainerManagerComponent.Ensure<ContainerSlot>("morgue_tray", Owner, out _);
|
TrayContainer = ContainerHelpers.EnsureContainer<ContainerSlot>(Owner, "morgue_tray", out _);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ using Content.Shared.GameObjects.Verbs;
|
|||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
@@ -72,8 +73,8 @@ namespace Content.Server.GameObjects.Components.PDA
|
|||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
_idSlot = ContainerManagerComponent.Ensure<ContainerSlot>("pda_entity_container", Owner);
|
_idSlot = ContainerHelpers.EnsureContainer<ContainerSlot>(Owner, "pda_entity_container");
|
||||||
_penSlot = ContainerManagerComponent.Ensure<ContainerSlot>("pda_pen_slot", Owner);
|
_penSlot = ContainerHelpers.EnsureContainer<ContainerSlot>(Owner, "pda_pen_slot");
|
||||||
|
|
||||||
if (UserInterface != null)
|
if (UserInterface != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ using Content.Shared.Interfaces;
|
|||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
@@ -56,7 +57,7 @@ namespace Content.Server.GameObjects.Components.Power.AME
|
|||||||
|
|
||||||
_injecting = false;
|
_injecting = false;
|
||||||
InjectionAmount = 2;
|
InjectionAmount = 2;
|
||||||
_jarSlot = ContainerManagerComponent.Ensure<ContainerSlot>($"{Name}-fuelJarContainer", Owner);
|
_jarSlot = ContainerHelpers.EnsureContainer<ContainerSlot>(Owner, $"{Name}-fuelJarContainer");
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void HandleMessage(ComponentMessage message, IComponent? component)
|
public override void HandleMessage(ComponentMessage message, IComponent? component)
|
||||||
@@ -84,7 +85,11 @@ namespace Content.Server.GameObjects.Components.Power.AME
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_jarSlot.ContainedEntity.TryGetComponent<AMEFuelContainerComponent>(out var fuelJar);
|
var jar = _jarSlot.ContainedEntity;
|
||||||
|
if(jar is null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
jar.TryGetComponent<AMEFuelContainerComponent>(out var fuelJar);
|
||||||
if(fuelJar != null && _powerSupplier != null)
|
if(fuelJar != null && _powerSupplier != null)
|
||||||
{
|
{
|
||||||
var availableInject = fuelJar.FuelAmount >= InjectionAmount ? InjectionAmount : fuelJar.FuelAmount;
|
var availableInject = fuelJar.FuelAmount >= InjectionAmount ? InjectionAmount : fuelJar.FuelAmount;
|
||||||
@@ -222,7 +227,10 @@ namespace Content.Server.GameObjects.Components.Power.AME
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var jar = _jarSlot.ContainedEntity;
|
var jar = _jarSlot.ContainedEntity;
|
||||||
_jarSlot.Remove(_jarSlot.ContainedEntity);
|
if(jar is null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_jarSlot.Remove(jar);
|
||||||
UpdateUserInterface();
|
UpdateUserInterface();
|
||||||
|
|
||||||
if (!user.TryGetComponent<HandsComponent>(out var hands) || !jar.TryGetComponent<ItemComponent>(out var item))
|
if (!user.TryGetComponent<HandsComponent>(out var hands) || !jar.TryGetComponent<ItemComponent>(out var item))
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ using Content.Shared.GameObjects.Verbs;
|
|||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
@@ -48,7 +49,7 @@ namespace Content.Server.GameObjects.Components.Power.ApcNetComponents.PowerRece
|
|||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
Owner.EnsureComponent<PowerReceiverComponent>();
|
Owner.EnsureComponent<PowerReceiverComponent>();
|
||||||
_container = ContainerManagerComponent.Ensure<ContainerSlot>($"{Name}-powerCellContainer", Owner);
|
_container = ContainerHelpers.EnsureContainer<ContainerSlot>(Owner, $"{Name}-powerCellContainer");
|
||||||
// Default state in the visualizer is OFF, so when this gets powered on during initialization it will generally show empty
|
// Default state in the visualizer is OFF, so when this gets powered on during initialization it will generally show empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ using Content.Shared.Interfaces;
|
|||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
@@ -219,7 +220,7 @@ namespace Content.Server.GameObjects.Components.Power.ApcNetComponents.PowerRece
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
_lightBulbContainer = ContainerManagerComponent.Ensure<ContainerSlot>("light_bulb", Owner);
|
_lightBulbContainer = ContainerHelpers.EnsureContainer<ContainerSlot>(Owner, "light_bulb");
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void HandleMessage(ComponentMessage message, IComponent? component)
|
public override void HandleMessage(ComponentMessage message, IComponent? component)
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Content.Shared.GameObjects.EntitySystems;
|
|||||||
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
|
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
|
||||||
using Content.Shared.GameObjects.Verbs;
|
using Content.Shared.GameObjects.Verbs;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
@@ -104,7 +105,7 @@ namespace Content.Server.GameObjects.Components.Power
|
|||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
_cellContainer = ContainerManagerComponent.Ensure<ContainerSlot>("cellslot_cell_container", Owner, out _);
|
_cellContainer = ContainerHelpers.EnsureContainer<ContainerSlot>(Owner, "cellslot_cell_container", out _);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IExamine.Examine(FormattedMessage message, bool inDetailsRange)
|
void IExamine.Examine(FormattedMessage message, bool inDetailsRange)
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ using Content.Shared.GameObjects.Verbs;
|
|||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
@@ -47,7 +48,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
|
|||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
_ammoContainer = ContainerManagerComponent.Ensure<Container>($"{Name}-container", Owner, out var existing);
|
_ammoContainer = ContainerHelpers.EnsureContainer<Container>(Owner, $"{Name}-container", out var existing);
|
||||||
|
|
||||||
if (existing)
|
if (existing)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Content.Shared.GameObjects.EntitySystems;
|
|||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
@@ -62,7 +63,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
|
|||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
_ammoContainer = ContainerManagerComponent.Ensure<Container>($"{Name}-magazine", Owner, out var existing);
|
_ammoContainer = ContainerHelpers.EnsureContainer<Container>(Owner, $"{Name}-magazine", out var existing);
|
||||||
|
|
||||||
if (existing)
|
if (existing)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Content.Shared.GameObjects.Components.Weapons.Ranged.Barrels;
|
|||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
@@ -45,7 +46,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
|
|||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
_ammoContainer = ContainerManagerComponent.Ensure<Container>($"{Name}-container", Owner, out var existing);
|
_ammoContainer = ContainerHelpers.EnsureContainer<Container>(Owner, $"{Name}-container", out var existing);
|
||||||
|
|
||||||
if (existing)
|
if (existing)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
|
|||||||
// TODO: Add existing ammo support on revolvers
|
// TODO: Add existing ammo support on revolvers
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
_spawnedAmmo = new Stack<IEntity>(_capacity - 1);
|
_spawnedAmmo = new Stack<IEntity>(_capacity - 1);
|
||||||
_ammoContainer = ContainerManagerComponent.Ensure<Container>($"{Name}-ammo-container", Owner, out var existing);
|
_ammoContainer = ContainerHelpers.EnsureContainer<Container>(Owner, $"{Name}-ammo-container", out var existing);
|
||||||
|
|
||||||
if (existing)
|
if (existing)
|
||||||
{
|
{
|
||||||
@@ -163,7 +163,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_chamberContainer = ContainerManagerComponent.Ensure<ContainerSlot>($"{Name}-chamber-container", Owner);
|
_chamberContainer = ContainerHelpers.EnsureContainer<ContainerSlot>(Owner, $"{Name}-chamber-container");
|
||||||
|
|
||||||
if (Owner.TryGetComponent(out AppearanceComponent appearanceComponent))
|
if (Owner.TryGetComponent(out AppearanceComponent appearanceComponent))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Content.Shared.Interfaces;
|
|||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
@@ -105,7 +106,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
|
|||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
_ammoContainer =
|
_ammoContainer =
|
||||||
ContainerManagerComponent.Ensure<Container>($"{Name}-ammo-container", Owner, out var existing);
|
ContainerHelpers.EnsureContainer<Container>(Owner, $"{Name}-ammo-container", out var existing);
|
||||||
|
|
||||||
if (existing)
|
if (existing)
|
||||||
{
|
{
|
||||||
@@ -117,7 +118,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
|
|||||||
}
|
}
|
||||||
|
|
||||||
_chamberContainer =
|
_chamberContainer =
|
||||||
ContainerManagerComponent.Ensure<ContainerSlot>($"{Name}-chamber-container", Owner, out existing);
|
ContainerHelpers.EnsureContainer<ContainerSlot>(Owner, $"{Name}-chamber-container", out existing);
|
||||||
if (existing)
|
if (existing)
|
||||||
{
|
{
|
||||||
_unspawnedCount--;
|
_unspawnedCount--;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Content.Shared.Interfaces;
|
|||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
@@ -92,7 +93,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
|
|||||||
base.Initialize();
|
base.Initialize();
|
||||||
_unspawnedCount = Capacity;
|
_unspawnedCount = Capacity;
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
_ammoContainer = ContainerManagerComponent.Ensure<Container>($"{Name}-ammoContainer", Owner, out var existing);
|
_ammoContainer = ContainerHelpers.EnsureContainer<Container>(Owner, $"{Name}-ammoContainer", out var existing);
|
||||||
if (existing)
|
if (existing)
|
||||||
{
|
{
|
||||||
foreach (var entity in _ammoContainer.ContainedEntities)
|
foreach (var entity in _ammoContainer.ContainedEntities)
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ using Content.Shared.GameObjects.Verbs;
|
|||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
@@ -102,7 +103,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
|
|||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
_powerCellContainer = ContainerManagerComponent.Ensure<ContainerSlot>($"{Name}-powercell-container", Owner, out var existing);
|
_powerCellContainer = ContainerHelpers.EnsureContainer<ContainerSlot>(Owner, $"{Name}-powercell-container", out var existing);
|
||||||
if (!existing && _powerCellPrototype != null)
|
if (!existing && _powerCellPrototype != null)
|
||||||
{
|
{
|
||||||
var powerCellEntity = Owner.EntityManager.SpawnEntity(_powerCellPrototype, Owner.Transform.Coordinates);
|
var powerCellEntity = Owner.EntityManager.SpawnEntity(_powerCellPrototype, Owner.Transform.Coordinates);
|
||||||
@@ -111,7 +112,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
|
|||||||
|
|
||||||
if (_ammoPrototype != null)
|
if (_ammoPrototype != null)
|
||||||
{
|
{
|
||||||
_ammoContainer = ContainerManagerComponent.Ensure<ContainerSlot>($"{Name}-ammo-container", Owner);
|
_ammoContainer = ContainerHelpers.EnsureContainer<ContainerSlot>(Owner, $"{Name}-ammo-container");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Owner.TryGetComponent(out AppearanceComponent appearanceComponent))
|
if (Owner.TryGetComponent(out AppearanceComponent appearanceComponent))
|
||||||
|
|||||||
@@ -190,8 +190,8 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
|
|||||||
_appearanceComponent = appearanceComponent;
|
_appearanceComponent = appearanceComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
_chamberContainer = ContainerManagerComponent.Ensure<ContainerSlot>($"{Name}-chamber", Owner);
|
_chamberContainer = ContainerHelpers.EnsureContainer<ContainerSlot>(Owner, $"{Name}-chamber");
|
||||||
_magazineContainer = ContainerManagerComponent.Ensure<ContainerSlot>($"{Name}-magazine", Owner, out var existing);
|
_magazineContainer = ContainerHelpers.EnsureContainer<ContainerSlot>(Owner, $"{Name}-magazine", out var existing);
|
||||||
|
|
||||||
if (!existing && _magFillPrototype != null)
|
if (!existing && _magFillPrototype != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,80 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using Robust.Server.GameObjects;
|
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.ViewVariables;
|
|
||||||
|
|
||||||
namespace Content.Server.GameObjects
|
|
||||||
{
|
|
||||||
public class ContainerSlot : BaseContainer
|
|
||||||
{
|
|
||||||
[ViewVariables]
|
|
||||||
public IEntity ContainedEntity
|
|
||||||
{
|
|
||||||
get => _containedEntity;
|
|
||||||
private set
|
|
||||||
{
|
|
||||||
_containedEntity = value;
|
|
||||||
_containedArray[0] = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly IEntity[] _containedArray = new IEntity[1];
|
|
||||||
private IEntity _containedEntity;
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public override IReadOnlyList<IEntity> ContainedEntities
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (ContainedEntity == null)
|
|
||||||
{
|
|
||||||
return Array.Empty<IEntity>();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _containedArray;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ContainerSlot(string id, IContainerManager manager) : base(id, manager)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public override bool CanInsert(IEntity toinsert)
|
|
||||||
{
|
|
||||||
if (ContainedEntity != null)
|
|
||||||
return false;
|
|
||||||
return base.CanInsert(toinsert);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public override bool Contains(IEntity contained)
|
|
||||||
{
|
|
||||||
if (contained != null && contained == ContainedEntity)
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void InternalInsert(IEntity toinsert)
|
|
||||||
{
|
|
||||||
ContainedEntity = toinsert;
|
|
||||||
base.InternalInsert(toinsert);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void InternalRemove(IEntity toremove)
|
|
||||||
{
|
|
||||||
ContainedEntity = null;
|
|
||||||
base.InternalRemove(toremove);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Shutdown()
|
|
||||||
{
|
|
||||||
base.Shutdown();
|
|
||||||
|
|
||||||
ContainedEntity?.Delete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -14,7 +14,7 @@ using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
|
|||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
using Content.Shared.Utility;
|
using Content.Shared.Utility;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
@@ -89,7 +89,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
private async Task<IEntity?> Construct(IEntity user, string materialContainer, ConstructionGraphPrototype graph, ConstructionGraphEdge edge, ConstructionGraphNode targetNode)
|
private async Task<IEntity?> Construct(IEntity user, string materialContainer, ConstructionGraphPrototype graph, ConstructionGraphEdge edge, ConstructionGraphNode targetNode)
|
||||||
{
|
{
|
||||||
// We need a place to hold our construction items!
|
// We need a place to hold our construction items!
|
||||||
var container = ContainerManagerComponent.Ensure<Container>(materialContainer, user, out var existed);
|
var container = ContainerHelpers.EnsureContainer<Container>(user, materialContainer, out var existed);
|
||||||
|
|
||||||
if (existed)
|
if (existed)
|
||||||
{
|
{
|
||||||
@@ -111,7 +111,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
var random = _robustRandom.Next();
|
var random = _robustRandom.Next();
|
||||||
var c = ContainerManagerComponent.Ensure<Container>(random.ToString(), user!, out var existed);
|
var c = ContainerHelpers.EnsureContainer<Container>(user!, random.ToString(), out var existed);
|
||||||
|
|
||||||
if (existed) continue;
|
if (existed) continue;
|
||||||
|
|
||||||
@@ -250,7 +250,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
// We preserve the containers...
|
// We preserve the containers...
|
||||||
foreach (var (name, cont) in containers)
|
foreach (var (name, cont) in containers)
|
||||||
{
|
{
|
||||||
var newCont = ContainerManagerComponent.Ensure<Container>(name, newEntity);
|
var newCont = ContainerHelpers.EnsureContainer<Container>(newEntity, name);
|
||||||
|
|
||||||
foreach (var entity in cont.ContainedEntities.ToArray())
|
foreach (var entity in cont.ContainedEntities.ToArray())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ using Content.Shared.Interfaces;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Input.Binding;
|
using Robust.Shared.Input.Binding;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Content.Server.GameObjects.EntitySystems.Click;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.EntitySystems
|
namespace Content.Server.GameObjects.EntitySystems
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using Content.Server.GameObjects.Components.Items.Storage;
|
|||||||
using Content.Shared.GameObjects.Components.Items;
|
using Content.Shared.GameObjects.Components.Items;
|
||||||
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
|
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using System;
|
using System;
|
||||||
using Content.Server.GameObjects.Components.ContainerExt;
|
using Content.Server.GameObjects;
|
||||||
using Content.Server.Mobs;
|
using Content.Server.Mobs;
|
||||||
using Content.Server.Objectives.Interfaces;
|
using Content.Server.Objectives.Interfaces;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Content.Shared.GameObjects.Components.Body;
|
|||||||
using Content.Shared.GameObjects.Components.Mobs.State;
|
using Content.Shared.GameObjects.Components.Mobs.State;
|
||||||
using Content.Shared.GameObjects.Components.Storage;
|
using Content.Shared.GameObjects.Components.Storage;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using Content.Shared.GameObjects.EntitySystems;
|
using Content.Shared.GameObjects.EntitySystems;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
using Content.Shared.Physics;
|
using Content.Shared.Physics;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using Content.Shared.GameObjects.EntitySystems;
|
using Content.Shared.GameObjects.EntitySystems;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
|||||||
@@ -1993,8 +1993,7 @@ entities:
|
|||||||
- powerLoad: 0
|
- powerLoad: 0
|
||||||
type: PowerReceiver
|
type: PowerReceiver
|
||||||
- containers:
|
- containers:
|
||||||
light_bulb:
|
light_bulb: !type:ContainerSlot {}
|
||||||
type: Content.Server.GameObjects.ContainerSlot
|
|
||||||
type: ContainerContainer
|
type: ContainerContainer
|
||||||
- uid: 238
|
- uid: 238
|
||||||
type: Poweredlight
|
type: Poweredlight
|
||||||
@@ -2006,8 +2005,7 @@ entities:
|
|||||||
- powerLoad: 0
|
- powerLoad: 0
|
||||||
type: PowerReceiver
|
type: PowerReceiver
|
||||||
- containers:
|
- containers:
|
||||||
light_bulb:
|
light_bulb: !type:ContainerSlot {}
|
||||||
type: Content.Server.GameObjects.ContainerSlot
|
|
||||||
type: ContainerContainer
|
type: ContainerContainer
|
||||||
- uid: 239
|
- uid: 239
|
||||||
type: ApcExtensionCable
|
type: ApcExtensionCable
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Submodule RobustToolbox updated: d751c0b3ab...24707b7385
Reference in New Issue
Block a user