Construction warning cleanup (#12256)
This commit is contained in:
@@ -7,7 +7,7 @@ namespace Content.Server.Construction.Completions
|
||||
[DataDefinition]
|
||||
public sealed class AddContainer : IGraphAction
|
||||
{
|
||||
[DataField("container")] public string? Container { get; private set; } = null;
|
||||
[DataField("container")] public string? Container { get; private set; }
|
||||
|
||||
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Content.Server.Construction.Completions
|
||||
if (userUid == null)
|
||||
return;
|
||||
|
||||
EntitySystem.Get<ElectrocutionSystem>().TryDoElectrifiedAct(uid, userUid.Value);
|
||||
entityManager.EntitySysManager.GetEntitySystem<ElectrocutionSystem>().TryDoElectrifiedAct(uid, userUid.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ using System.Linq;
|
||||
using Content.Server.Construction.Components;
|
||||
using Content.Shared.Construction;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.Containers;
|
||||
using Robust.Shared.Containers;
|
||||
|
||||
namespace Content.Server.Construction.Completions
|
||||
@@ -24,7 +25,7 @@ namespace Content.Server.Construction.Completions
|
||||
return;
|
||||
}
|
||||
|
||||
if (!EntitySystem.Get<MachineFrameSystem>().IsComplete(machineFrame))
|
||||
if (!entityManager.EntitySysManager.GetEntitySystem<MachineFrameSystem>().IsComplete(machineFrame))
|
||||
{
|
||||
Logger.Warning($"Machine frame entity {uid} doesn't have all required parts to be built! Aborting build machine action.");
|
||||
return;
|
||||
@@ -57,24 +58,25 @@ namespace Content.Server.Construction.Completions
|
||||
|
||||
entBoardContainer.Remove(board);
|
||||
|
||||
var containerSys = entityManager.EntitySysManager.GetEntitySystem<ContainerSystem>();
|
||||
var transform = entityManager.GetComponent<TransformComponent>(uid);
|
||||
var machine = entityManager.SpawnEntity(boardComponent.Prototype, transform.Coordinates);
|
||||
entityManager.GetComponent<TransformComponent>(machine).LocalRotation = transform.LocalRotation;
|
||||
|
||||
var boardContainer = machine.EnsureContainer<Container>(MachineFrameComponent.BoardContainerName, out var existed);
|
||||
var boardContainer = containerSys.EnsureContainer<Container>(machine, MachineFrameComponent.BoardContainerName, out var existed);
|
||||
|
||||
if (existed)
|
||||
{
|
||||
// Clean that up...
|
||||
boardContainer.CleanContainer();
|
||||
containerSys.CleanContainer(boardContainer);
|
||||
}
|
||||
|
||||
var partContainer = machine.EnsureContainer<Container>(MachineFrameComponent.PartContainerName, out existed);
|
||||
var partContainer = containerSys.EnsureContainer<Container>(machine, MachineFrameComponent.PartContainerName, out existed);
|
||||
|
||||
if (existed)
|
||||
{
|
||||
// Clean that up, too...
|
||||
partContainer.CleanContainer();
|
||||
containerSys.CleanContainer(partContainer);
|
||||
}
|
||||
|
||||
boardContainer.Insert(board);
|
||||
|
||||
@@ -7,13 +7,13 @@ namespace Content.Server.Construction.Completions
|
||||
[DataDefinition]
|
||||
public sealed class ConditionalAction : IGraphAction
|
||||
{
|
||||
[DataField("passUser")] public bool PassUser { get; } = false;
|
||||
[DataField("passUser")] public bool PassUser { get; }
|
||||
|
||||
[DataField("condition", required:true)] public IGraphCondition? Condition { get; } = null;
|
||||
[DataField("condition", required:true)] public IGraphCondition? Condition { get; }
|
||||
|
||||
[DataField("action", required:true)] public IGraphAction? Action { get; } = null;
|
||||
[DataField("action", required:true)] public IGraphAction? Action { get; }
|
||||
|
||||
[DataField("else")] public IGraphAction? Else { get; } = null;
|
||||
[DataField("else")] public IGraphAction? Else { get; }
|
||||
|
||||
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Linq;
|
||||
using Content.Shared.Construction;
|
||||
using Robust.Server.Containers;
|
||||
using Robust.Shared.Containers;
|
||||
|
||||
namespace Content.Server.Construction.Completions
|
||||
@@ -11,10 +12,12 @@ namespace Content.Server.Construction.Completions
|
||||
|
||||
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
|
||||
{
|
||||
if (string.IsNullOrEmpty(Container)) return;
|
||||
// TODO CONSTRUCTION: Use the new ContainerSystem methods here.
|
||||
if (!entityManager.TryGetComponent(uid, out ContainerManagerComponent? containerMan)) return;
|
||||
if (!containerMan.TryGetContainer(Container, out var container)) return;
|
||||
if (string.IsNullOrEmpty(Container))
|
||||
return;
|
||||
var containerSys = entityManager.EntitySysManager.GetEntitySystem<ContainerSystem>();
|
||||
|
||||
if (!containerSys.TryGetContainer(uid, Container, out var container))
|
||||
return;
|
||||
|
||||
foreach (var contained in container.ContainedEntities.ToArray())
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Content.Shared.Construction;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.Containers;
|
||||
using Robust.Shared.Containers;
|
||||
|
||||
namespace Content.Server.Construction.Completions
|
||||
@@ -14,9 +15,10 @@ namespace Content.Server.Construction.Completions
|
||||
return;
|
||||
|
||||
var transform = entityManager.GetComponent<TransformComponent>(uid);
|
||||
var containerSys = entityManager.EntitySysManager.GetEntitySystem<ContainerSystem>();
|
||||
foreach (var container in containerManager.GetAllContainers())
|
||||
{
|
||||
container.EmptyContainer(true, transform.Coordinates);
|
||||
containerSys.EmptyContainer(container, true, transform.Coordinates);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Linq;
|
||||
using Content.Shared.Construction;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.Containers;
|
||||
using Robust.Shared.Containers;
|
||||
|
||||
namespace Content.Server.Construction.Completions
|
||||
@@ -16,15 +17,9 @@ namespace Content.Server.Construction.Completions
|
||||
if (!entityManager.TryGetComponent(uid, out ContainerManagerComponent? containerManager) ||
|
||||
!containerManager.TryGetContainer(Container, out var container)) return;
|
||||
|
||||
// TODO: Use container system methods.
|
||||
var containerSys = entityManager.EntitySysManager.GetEntitySystem<ContainerSystem>();
|
||||
var transform = entityManager.GetComponent<TransformComponent>(uid);
|
||||
foreach (var contained in container.ContainedEntities.ToArray())
|
||||
{
|
||||
container.ForceRemove(contained);
|
||||
var cTransform = entityManager.GetComponent<TransformComponent>(contained);
|
||||
cTransform.Coordinates = transform.Coordinates;
|
||||
cTransform.AttachToGridOrMap();
|
||||
}
|
||||
containerSys.EmptyContainer(container, true, transform.Coordinates, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Content.Server.Construction.Completions
|
||||
{
|
||||
if (entityManager.TryGetComponent<MachineFrameComponent>(uid, out var machineFrame))
|
||||
{
|
||||
EntitySystem.Get<MachineFrameSystem>().RegenerateProgress(machineFrame);
|
||||
entityManager.EntitySysManager.GetEntitySystem<MachineFrameSystem>().RegenerateProgress(machineFrame);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@ namespace Content.Server.Construction.Completions
|
||||
[DataDefinition]
|
||||
public sealed class MoveContainer : IGraphAction
|
||||
{
|
||||
[DataField("from")] public string? FromContainer { get; } = null;
|
||||
[DataField("to")] public string? ToContainer { get; } = null;
|
||||
[DataField("from")] public string? FromContainer { get; }
|
||||
[DataField("to")] public string? ToContainer { get; }
|
||||
|
||||
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Content.Shared.Construction;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server.Construction.Completions
|
||||
@@ -22,7 +21,8 @@ namespace Content.Server.Construction.Completions
|
||||
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
|
||||
{
|
||||
var scale = (float) IoCManager.Resolve<IRobustRandom>().NextGaussian(1, Variation);
|
||||
SoundSystem.Play(Sound.GetSound(), Filter.Pvs(uid, entityManager: entityManager), uid, AudioParams.WithPitchScale(scale));
|
||||
entityManager.EntitySysManager.GetEntitySystem<SharedAudioSystem>()
|
||||
.PlayPvs(Sound, uid, AudioParams.WithPitchScale(scale));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Content.Server.Construction.Completions
|
||||
[DataDefinition]
|
||||
public sealed class PopupUser : IGraphAction
|
||||
{
|
||||
[DataField("cursor")] public bool Cursor { get; } = false;
|
||||
[DataField("cursor")] public bool Cursor { get; }
|
||||
[DataField("text")] public string Text { get; } = string.Empty;
|
||||
|
||||
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Content.Server.Construction.Completions
|
||||
public sealed class RaiseEvent : IGraphAction
|
||||
{
|
||||
[DataField("event", required:true)]
|
||||
public EntityEventArgs? Event { get; } = null;
|
||||
public EntityEventArgs? Event { get; }
|
||||
|
||||
[DataField("directed")]
|
||||
public bool Directed { get; } = true;
|
||||
@@ -21,7 +21,7 @@ namespace Content.Server.Construction.Completions
|
||||
return;
|
||||
|
||||
if(Directed)
|
||||
entityManager.EventBus.RaiseLocalEvent(uid, (object)Event, false);
|
||||
entityManager.EventBus.RaiseLocalEvent(uid, (object)Event);
|
||||
|
||||
if(Broadcast)
|
||||
entityManager.EventBus.RaiseEvent(EventSource.Local, (object)Event);
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Content.Server.Construction.Completions
|
||||
|
||||
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
|
||||
{
|
||||
EntitySystem.Get<StackSystem>().SetCount(uid, Amount);
|
||||
entityManager.EntitySysManager.GetEntitySystem<StackSystem>().SetCount(uid, Amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Content.Server.Construction.Completions
|
||||
[DataDefinition]
|
||||
public sealed class SnapToGrid : IGraphAction
|
||||
{
|
||||
[DataField("southRotation")] public bool SouthRotation { get; private set; } = false;
|
||||
[DataField("southRotation")] public bool SouthRotation { get; private set; }
|
||||
|
||||
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
|
||||
{
|
||||
|
||||
@@ -14,12 +14,15 @@ namespace Content.Server.Construction.Completions
|
||||
|
||||
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
|
||||
{
|
||||
if (SpriteSpecifier == null || SpriteSpecifier == SpriteSpecifier.Invalid) return;
|
||||
if (SpriteSpecifier == null || SpriteSpecifier == SpriteSpecifier.Invalid)
|
||||
return;
|
||||
|
||||
if (!entityManager.TryGetComponent(uid, out SpriteComponent? sprite)) return;
|
||||
if (!entityManager.TryGetComponent(uid, out SpriteComponent? sprite))
|
||||
return;
|
||||
|
||||
// That layer doesn't exist, we do nothing.
|
||||
if (sprite.LayerCount <= Layer) return;
|
||||
if (sprite.LayerCount <= Layer)
|
||||
return;
|
||||
|
||||
sprite.LayerSetSprite(Layer, SpriteSpecifier);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user