Fixes bug where computers wouldn't return the circuit board when deconstructed.

This commit is contained in:
Vera Aguilera Puerto
2021-03-06 14:45:14 +01:00
parent d87bc211d5
commit 7f3b944500
3 changed files with 9 additions and 4 deletions

View File

@@ -65,6 +65,10 @@ namespace Content.Server.GameObjects.Components
/// </summary>
private void CreateComputerBoard()
{
// Ensure that the construction component is aware of the board container.
if (Owner.TryGetComponent(out ConstructionComponent construction))
construction.AddContainer("board");
// We don't do anything if this is null or empty.
if (string.IsNullOrEmpty(_boardPrototype))
return;
@@ -82,9 +86,6 @@ namespace Content.Server.GameObjects.Components
if(!container.Insert(board))
Logger.Warning($"Couldn't insert board {board} to computer {Owner}!");
if (Owner.TryGetComponent(out ConstructionComponent construction))
construction.AddContainer("board");
}
public void MapInit()

View File

@@ -419,7 +419,7 @@ namespace Content.Server.GameObjects.Components.Construction
{
foreach (var container in _containers)
{
var otherContainer = ContainerHelpers.EnsureContainer<Container>(entity, container);
var otherContainer = entity.EnsureContainer<Container>(container);
var ourContainer = containerComp.GetContainer(container);
foreach (var ent in ourContainer.ContainedEntities.ToArray())

View File

@@ -0,0 +1,4 @@
author: Zumorica
changes:
- type: Fix # One of the following: Add, Remove, Tweak, Fix
message: Fixes bug where deconstructing computers wouldn't return the circuit board.