Construction warning cleanup (#12256)
This commit is contained in:
@@ -4,12 +4,14 @@ using Content.Shared.Construction;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Tag;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Containers;
|
||||
|
||||
namespace Content.Server.Construction;
|
||||
|
||||
public sealed class MachineFrameSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly AppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly IComponentFactory _factory = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _container = default!;
|
||||
[Dependency] private readonly TagSystem _tag = default!;
|
||||
@@ -47,7 +49,7 @@ public sealed class MachineFrameSystem : EntitySystem
|
||||
{
|
||||
if (!component.HasBoard && TryComp<MachineBoardComponent?>(args.Used, out var machineBoard))
|
||||
{
|
||||
if (args.Used.TryRemoveFromContainer())
|
||||
if (_container.TryRemoveFromContainer(args.Used))
|
||||
{
|
||||
// Valid board!
|
||||
component.BoardContainer.Insert(args.Used);
|
||||
@@ -55,8 +57,7 @@ public sealed class MachineFrameSystem : EntitySystem
|
||||
// Setup requirements and progress...
|
||||
ResetProgressAndRequirements(component, machineBoard);
|
||||
|
||||
if (TryComp<AppearanceComponent?>(uid, out var appearance))
|
||||
appearance.SetData(MachineFrameVisuals.State, 2);
|
||||
_appearance.SetData(uid, MachineFrameVisuals.State, 2);
|
||||
|
||||
if (TryComp(uid, out ConstructionComponent? construction))
|
||||
{
|
||||
@@ -73,7 +74,7 @@ public sealed class MachineFrameSystem : EntitySystem
|
||||
return;
|
||||
|
||||
if (component.Progress[machinePart.PartType] != component.Requirements[machinePart.PartType]
|
||||
&& args.Used.TryRemoveFromContainer() && component.PartContainer.Insert(args.Used))
|
||||
&& _container.TryRemoveFromContainer(args.Used) && component.PartContainer.Insert(args.Used))
|
||||
{
|
||||
component.Progress[machinePart.PartType]++;
|
||||
args.Handled = true;
|
||||
@@ -127,7 +128,8 @@ public sealed class MachineFrameSystem : EntitySystem
|
||||
if (!HasComp(args.Used, registration.Type))
|
||||
continue;
|
||||
|
||||
if (!args.Used.TryRemoveFromContainer() || !component.PartContainer.Insert(args.Used)) continue;
|
||||
if (!_container.TryRemoveFromContainer(args.Used) || !component.PartContainer.Insert(args.Used))
|
||||
continue;
|
||||
component.ComponentProgress[compName]++;
|
||||
args.Handled = true;
|
||||
return;
|
||||
@@ -141,7 +143,8 @@ public sealed class MachineFrameSystem : EntitySystem
|
||||
if (!_tag.HasTag(args.Used, tagName))
|
||||
continue;
|
||||
|
||||
if (!args.Used.TryRemoveFromContainer() || !component.PartContainer.Insert(args.Used)) continue;
|
||||
if (!_container.TryRemoveFromContainer(args.Used) || !component.PartContainer.Insert(args.Used))
|
||||
continue;
|
||||
component.TagProgress[tagName]++;
|
||||
args.Handled = true;
|
||||
return;
|
||||
@@ -216,11 +219,9 @@ public sealed class MachineFrameSystem : EntitySystem
|
||||
|
||||
public void RegenerateProgress(MachineFrameComponent component)
|
||||
{
|
||||
AppearanceComponent? appearance;
|
||||
|
||||
if (!component.HasBoard)
|
||||
{
|
||||
if (TryComp(component.Owner, out appearance)) appearance.SetData(MachineFrameVisuals.State, 1);
|
||||
_appearance.SetData(component.Owner, MachineFrameVisuals.State, 1);
|
||||
|
||||
component.TagRequirements.Clear();
|
||||
component.MaterialRequirements.Clear();
|
||||
@@ -239,7 +240,7 @@ public sealed class MachineFrameSystem : EntitySystem
|
||||
if (!TryComp<MachineBoardComponent>(board, out var machineBoard))
|
||||
return;
|
||||
|
||||
if (TryComp(component.Owner, out appearance)) appearance.SetData(MachineFrameVisuals.State, 2);
|
||||
_appearance.SetData(component.Owner, MachineFrameVisuals.State, 2);
|
||||
|
||||
ResetProgressAndRequirements(component, machineBoard);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user