Construction warning cleanup (#12256)
This commit is contained in:
@@ -1,8 +1,6 @@
|
|||||||
using Content.Shared.Construction;
|
using Content.Shared.Construction;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
|
|
||||||
namespace Content.Client.Construction
|
namespace Content.Client.Construction
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Client.UserInterface.Systems.MenuBar.Widgets;
|
using Content.Client.UserInterface.Systems.MenuBar.Widgets;
|
||||||
using Content.Shared.Construction.Prototypes;
|
using Content.Shared.Construction.Prototypes;
|
||||||
|
using Robust.Client.GameObjects;
|
||||||
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.Placement;
|
using Robust.Client.Placement;
|
||||||
using Robust.Client.UserInterface;
|
using Robust.Client.UserInterface;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
@@ -67,7 +69,6 @@ namespace Content.Client.Construction.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructs a new instance of <see cref="ConstructionMenuPresenter" />.
|
/// Constructs a new instance of <see cref="ConstructionMenuPresenter" />.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="gameHud">GUI that is being presented to.</param>
|
|
||||||
public ConstructionMenuPresenter()
|
public ConstructionMenuPresenter()
|
||||||
{
|
{
|
||||||
// This is a lot easier than a factory
|
// This is a lot easier than a factory
|
||||||
@@ -203,8 +204,9 @@ namespace Content.Client.Construction.UI
|
|||||||
|
|
||||||
private void PopulateInfo(ConstructionPrototype prototype)
|
private void PopulateInfo(ConstructionPrototype prototype)
|
||||||
{
|
{
|
||||||
|
var spriteSys = _systemManager.GetEntitySystem<SpriteSystem>();
|
||||||
_constructionView.ClearRecipeInfo();
|
_constructionView.ClearRecipeInfo();
|
||||||
_constructionView.SetRecipeInfo(prototype.Name, prototype.Description, prototype.Icon.Frame0(), prototype.Type != ConstructionType.Item);
|
_constructionView.SetRecipeInfo(prototype.Name, prototype.Description, spriteSys.Frame0(prototype.Icon), prototype.Type != ConstructionType.Item);
|
||||||
|
|
||||||
var stepList = _constructionView.RecipeStepList;
|
var stepList = _constructionView.RecipeStepList;
|
||||||
GenerateStepList(prototype, stepList);
|
GenerateStepList(prototype, stepList);
|
||||||
@@ -215,19 +217,24 @@ namespace Content.Client.Construction.UI
|
|||||||
if (_constructionSystem?.GetGuide(prototype) is not { } guide)
|
if (_constructionSystem?.GetGuide(prototype) is not { } guide)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
var spriteSys = _systemManager.GetEntitySystem<SpriteSystem>();
|
||||||
|
|
||||||
foreach (var entry in guide.Entries)
|
foreach (var entry in guide.Entries)
|
||||||
{
|
{
|
||||||
var text = entry.Arguments != null
|
var text = entry.Arguments != null
|
||||||
? Loc.GetString(entry.Localization, entry.Arguments) : Loc.GetString(entry.Localization);
|
? Loc.GetString(entry.Localization, entry.Arguments) : Loc.GetString(entry.Localization);
|
||||||
|
|
||||||
if (entry.EntryNumber is {} number)
|
if (entry.EntryNumber is {} number)
|
||||||
|
{
|
||||||
text = Loc.GetString("construction-presenter-step-wrapper",
|
text = Loc.GetString("construction-presenter-step-wrapper",
|
||||||
("step-number", number), ("text", text));
|
("step-number", number), ("text", text));
|
||||||
|
}
|
||||||
|
|
||||||
// The padding needs to be applied regardless of text length... (See PadLeft documentation)
|
// The padding needs to be applied regardless of text length... (See PadLeft documentation)
|
||||||
text = text.PadLeft(text.Length + entry.Padding);
|
text = text.PadLeft(text.Length + entry.Padding);
|
||||||
|
|
||||||
stepList.AddItem(text, entry.Icon?.Frame0(), false);
|
var icon = entry.Icon != null ? spriteSys.Frame0(entry.Icon) : Texture.Transparent;
|
||||||
|
stepList.AddItem(text, icon, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,7 +288,7 @@ namespace Content.Client.Construction.UI
|
|||||||
{
|
{
|
||||||
if (_selected == null || _selected.Type != ConstructionType.Structure) return;
|
if (_selected == null || _selected.Type != ConstructionType.Structure) return;
|
||||||
|
|
||||||
var constructSystem = EntitySystem.Get<ConstructionSystem>();
|
var constructSystem = _systemManager.GetEntitySystem<ConstructionSystem>();
|
||||||
|
|
||||||
_placementManager.BeginPlacing(new PlacementInformation()
|
_placementManager.BeginPlacing(new PlacementInformation()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -103,7 +103,6 @@ public sealed class PrototypeSaveTest
|
|||||||
"CrateArtifactContainer",
|
"CrateArtifactContainer",
|
||||||
"CloningPod",
|
"CloningPod",
|
||||||
"DrinkColaCan",
|
"DrinkColaCan",
|
||||||
"MachineFrame",
|
|
||||||
"WeaponImprovisedPneumaticCannon",
|
"WeaponImprovisedPneumaticCannon",
|
||||||
"LauncherCreamPie",
|
"LauncherCreamPie",
|
||||||
"GravityGenerator",
|
"GravityGenerator",
|
||||||
|
|||||||
@@ -51,9 +51,9 @@ namespace Content.Server.Construction
|
|||||||
component.CancelToken = null;
|
component.CancelToken = null;
|
||||||
var xform = Transform(uid);
|
var xform = Transform(uid);
|
||||||
|
|
||||||
RaiseLocalEvent(uid, new BeforeUnanchoredEvent(args.User, args.Using), false);
|
RaiseLocalEvent(uid, new BeforeUnanchoredEvent(args.User, args.Using));
|
||||||
xform.Anchored = false;
|
xform.Anchored = false;
|
||||||
RaiseLocalEvent(uid, new UserUnanchoredEvent(args.User, args.Using), false);
|
RaiseLocalEvent(uid, new UserUnanchoredEvent(args.User, args.Using));
|
||||||
|
|
||||||
_popup.PopupEntity(Loc.GetString("anchorable-unanchored"), uid, Filter.Pvs(uid, entityManager: EntityManager));
|
_popup.PopupEntity(Loc.GetString("anchorable-unanchored"), uid, Filter.Pvs(uid, entityManager: EntityManager));
|
||||||
|
|
||||||
@@ -93,9 +93,9 @@ namespace Content.Server.Construction
|
|||||||
if (component.Snap)
|
if (component.Snap)
|
||||||
xform.Coordinates = xform.Coordinates.SnapToGrid(EntityManager, _mapManager);
|
xform.Coordinates = xform.Coordinates.SnapToGrid(EntityManager, _mapManager);
|
||||||
|
|
||||||
RaiseLocalEvent(uid, new BeforeAnchoredEvent(args.User, args.Using), false);
|
RaiseLocalEvent(uid, new BeforeAnchoredEvent(args.User, args.Using));
|
||||||
xform.Anchored = true;
|
xform.Anchored = true;
|
||||||
RaiseLocalEvent(uid, new UserAnchoredEvent(args.User, args.Using), false);
|
RaiseLocalEvent(uid, new UserAnchoredEvent(args.User, args.Using));
|
||||||
|
|
||||||
_popup.PopupEntity(Loc.GetString("anchorable-anchored"), uid, Filter.Pvs(uid, entityManager: EntityManager));
|
_popup.PopupEntity(Loc.GetString("anchorable-anchored"), uid, Filter.Pvs(uid, entityManager: EntityManager));
|
||||||
|
|
||||||
@@ -155,16 +155,13 @@ namespace Content.Server.Construction
|
|||||||
|
|
||||||
// Need to cast the event or it will be raised as BaseAnchoredAttemptEvent.
|
// Need to cast the event or it will be raised as BaseAnchoredAttemptEvent.
|
||||||
if (anchoring)
|
if (anchoring)
|
||||||
RaiseLocalEvent(uid, (AnchorAttemptEvent) attempt, false);
|
RaiseLocalEvent(uid, (AnchorAttemptEvent) attempt);
|
||||||
else
|
else
|
||||||
RaiseLocalEvent(uid, (UnanchorAttemptEvent) attempt, false);
|
RaiseLocalEvent(uid, (UnanchorAttemptEvent) attempt);
|
||||||
|
|
||||||
anchorable.Delay += attempt.Delay;
|
anchorable.Delay += attempt.Delay;
|
||||||
|
|
||||||
if (attempt.Cancelled)
|
return !attempt.Cancelled;
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ namespace Content.Server.Construction.Commands
|
|||||||
}
|
}
|
||||||
|
|
||||||
var changed = 0;
|
var changed = 0;
|
||||||
var tagSystem = EntitySystem.Get<TagSystem>();
|
var tagSystem = entityManager.EntitySysManager.GetEntitySystem<TagSystem>();
|
||||||
|
|
||||||
foreach (var child in xformQuery.GetComponent(grid.GridEntityId).ChildEntities)
|
foreach (var child in xformQuery.GetComponent(grid.GridEntityId).ChildEntities)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
using Content.Server.Administration;
|
using Content.Server.Administration;
|
||||||
using Content.Shared.Administration;
|
using Content.Shared.Administration;
|
||||||
using Content.Shared.Maps;
|
|
||||||
using Content.Shared.Tag;
|
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.Console;
|
using Robust.Shared.Console;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Prototypes;
|
|
||||||
|
|
||||||
namespace Content.Server.Construction.Commands;
|
namespace Content.Server.Construction.Commands;
|
||||||
|
|
||||||
@@ -22,8 +19,8 @@ sealed class TileReplaceCommand : IConsoleCommand
|
|||||||
var player = shell.Player as IPlayerSession;
|
var player = shell.Player as IPlayerSession;
|
||||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
EntityUid? gridId;
|
EntityUid? gridId;
|
||||||
string tileIdA = "";
|
string tileIdA;
|
||||||
string tileIdB = "";
|
string tileIdB;
|
||||||
|
|
||||||
switch (args.Length)
|
switch (args.Length)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ using Content.Shared.Tag;
|
|||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.Console;
|
using Robust.Shared.Console;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Prototypes;
|
|
||||||
|
|
||||||
namespace Content.Server.Construction.Commands
|
namespace Content.Server.Construction.Commands
|
||||||
{
|
{
|
||||||
@@ -17,7 +16,7 @@ namespace Content.Server.Construction.Commands
|
|||||||
public string Description => "Puts an underplating tile below every wall on a grid.";
|
public string Description => "Puts an underplating tile below every wall on a grid.";
|
||||||
public string Help => $"Usage: {Command} <gridId> | {Command}";
|
public string Help => $"Usage: {Command} <gridId> | {Command}";
|
||||||
|
|
||||||
public const string TilePrototypeID = "Plating";
|
public const string TilePrototypeId = "Plating";
|
||||||
public const string WallTag = "Wall";
|
public const string WallTag = "Wall";
|
||||||
|
|
||||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||||
@@ -65,8 +64,8 @@ namespace Content.Server.Construction.Commands
|
|||||||
}
|
}
|
||||||
|
|
||||||
var tileDefinitionManager = IoCManager.Resolve<ITileDefinitionManager>();
|
var tileDefinitionManager = IoCManager.Resolve<ITileDefinitionManager>();
|
||||||
var tagSystem = EntitySystem.Get<TagSystem>();
|
var tagSystem = entityManager.EntitySysManager.GetEntitySystem<TagSystem>();
|
||||||
var underplating = tileDefinitionManager[TilePrototypeID];
|
var underplating = tileDefinitionManager[TilePrototypeId];
|
||||||
var underplatingTile = new Tile(underplating.TileId);
|
var underplatingTile = new Tile(underplating.TileId);
|
||||||
var changed = 0;
|
var changed = 0;
|
||||||
foreach (var child in entityManager.GetComponent<TransformComponent>(grid.GridEntityId).ChildEntities)
|
foreach (var child in entityManager.GetComponent<TransformComponent>(grid.GridEntityId).ChildEntities)
|
||||||
@@ -91,7 +90,7 @@ namespace Content.Server.Construction.Commands
|
|||||||
var tile = grid.GetTileRef(childTransform.Coordinates);
|
var tile = grid.GetTileRef(childTransform.Coordinates);
|
||||||
var tileDef = (ContentTileDefinition) tileDefinitionManager[tile.Tile.TypeId];
|
var tileDef = (ContentTileDefinition) tileDefinitionManager[tile.Tile.TypeId];
|
||||||
|
|
||||||
if (tileDef.ID == TilePrototypeID)
|
if (tileDef.ID == TilePrototypeId)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ namespace Content.Server.Construction.Completions
|
|||||||
[DataDefinition]
|
[DataDefinition]
|
||||||
public sealed class AddContainer : IGraphAction
|
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)
|
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace Content.Server.Construction.Completions
|
|||||||
if (userUid == null)
|
if (userUid == null)
|
||||||
return;
|
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.Server.Construction.Components;
|
||||||
using Content.Shared.Construction;
|
using Content.Shared.Construction;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
|
using Robust.Server.Containers;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
|
|
||||||
namespace Content.Server.Construction.Completions
|
namespace Content.Server.Construction.Completions
|
||||||
@@ -24,7 +25,7 @@ namespace Content.Server.Construction.Completions
|
|||||||
return;
|
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.");
|
Logger.Warning($"Machine frame entity {uid} doesn't have all required parts to be built! Aborting build machine action.");
|
||||||
return;
|
return;
|
||||||
@@ -57,24 +58,25 @@ namespace Content.Server.Construction.Completions
|
|||||||
|
|
||||||
entBoardContainer.Remove(board);
|
entBoardContainer.Remove(board);
|
||||||
|
|
||||||
|
var containerSys = entityManager.EntitySysManager.GetEntitySystem<ContainerSystem>();
|
||||||
var transform = entityManager.GetComponent<TransformComponent>(uid);
|
var transform = entityManager.GetComponent<TransformComponent>(uid);
|
||||||
var machine = entityManager.SpawnEntity(boardComponent.Prototype, transform.Coordinates);
|
var machine = entityManager.SpawnEntity(boardComponent.Prototype, transform.Coordinates);
|
||||||
entityManager.GetComponent<TransformComponent>(machine).LocalRotation = transform.LocalRotation;
|
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)
|
if (existed)
|
||||||
{
|
{
|
||||||
// Clean that up...
|
// 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)
|
if (existed)
|
||||||
{
|
{
|
||||||
// Clean that up, too...
|
// Clean that up, too...
|
||||||
partContainer.CleanContainer();
|
containerSys.CleanContainer(partContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
boardContainer.Insert(board);
|
boardContainer.Insert(board);
|
||||||
|
|||||||
@@ -7,13 +7,13 @@ namespace Content.Server.Construction.Completions
|
|||||||
[DataDefinition]
|
[DataDefinition]
|
||||||
public sealed class ConditionalAction : IGraphAction
|
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)
|
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Shared.Construction;
|
using Content.Shared.Construction;
|
||||||
|
using Robust.Server.Containers;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
|
|
||||||
namespace Content.Server.Construction.Completions
|
namespace Content.Server.Construction.Completions
|
||||||
@@ -11,10 +12,12 @@ namespace Content.Server.Construction.Completions
|
|||||||
|
|
||||||
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
|
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(Container)) return;
|
if (string.IsNullOrEmpty(Container))
|
||||||
// TODO CONSTRUCTION: Use the new ContainerSystem methods here.
|
return;
|
||||||
if (!entityManager.TryGetComponent(uid, out ContainerManagerComponent? containerMan)) return;
|
var containerSys = entityManager.EntitySysManager.GetEntitySystem<ContainerSystem>();
|
||||||
if (!containerMan.TryGetContainer(Container, out var container)) return;
|
|
||||||
|
if (!containerSys.TryGetContainer(uid, Container, out var container))
|
||||||
|
return;
|
||||||
|
|
||||||
foreach (var contained in container.ContainedEntities.ToArray())
|
foreach (var contained in container.ContainedEntities.ToArray())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Content.Shared.Construction;
|
using Content.Shared.Construction;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
|
using Robust.Server.Containers;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
|
|
||||||
namespace Content.Server.Construction.Completions
|
namespace Content.Server.Construction.Completions
|
||||||
@@ -14,9 +15,10 @@ namespace Content.Server.Construction.Completions
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var transform = entityManager.GetComponent<TransformComponent>(uid);
|
var transform = entityManager.GetComponent<TransformComponent>(uid);
|
||||||
|
var containerSys = entityManager.EntitySysManager.GetEntitySystem<ContainerSystem>();
|
||||||
foreach (var container in containerManager.GetAllContainers())
|
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 System.Linq;
|
||||||
using Content.Shared.Construction;
|
using Content.Shared.Construction;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
|
using Robust.Server.Containers;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
|
|
||||||
namespace Content.Server.Construction.Completions
|
namespace Content.Server.Construction.Completions
|
||||||
@@ -16,15 +17,9 @@ namespace Content.Server.Construction.Completions
|
|||||||
if (!entityManager.TryGetComponent(uid, out ContainerManagerComponent? containerManager) ||
|
if (!entityManager.TryGetComponent(uid, out ContainerManagerComponent? containerManager) ||
|
||||||
!containerManager.TryGetContainer(Container, out var container)) return;
|
!containerManager.TryGetContainer(Container, out var container)) return;
|
||||||
|
|
||||||
// TODO: Use container system methods.
|
var containerSys = entityManager.EntitySysManager.GetEntitySystem<ContainerSystem>();
|
||||||
var transform = entityManager.GetComponent<TransformComponent>(uid);
|
var transform = entityManager.GetComponent<TransformComponent>(uid);
|
||||||
foreach (var contained in container.ContainedEntities.ToArray())
|
containerSys.EmptyContainer(container, true, transform.Coordinates, true);
|
||||||
{
|
|
||||||
container.ForceRemove(contained);
|
|
||||||
var cTransform = entityManager.GetComponent<TransformComponent>(contained);
|
|
||||||
cTransform.Coordinates = transform.Coordinates;
|
|
||||||
cTransform.AttachToGridOrMap();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace Content.Server.Construction.Completions
|
|||||||
{
|
{
|
||||||
if (entityManager.TryGetComponent<MachineFrameComponent>(uid, out var machineFrame))
|
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]
|
[DataDefinition]
|
||||||
public sealed class MoveContainer : IGraphAction
|
public sealed class MoveContainer : IGraphAction
|
||||||
{
|
{
|
||||||
[DataField("from")] public string? FromContainer { get; } = null;
|
[DataField("from")] public string? FromContainer { get; }
|
||||||
[DataField("to")] public string? ToContainer { get; } = null;
|
[DataField("to")] public string? ToContainer { get; }
|
||||||
|
|
||||||
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
|
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using Content.Shared.Construction;
|
using Content.Shared.Construction;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Player;
|
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
|
|
||||||
namespace Content.Server.Construction.Completions
|
namespace Content.Server.Construction.Completions
|
||||||
@@ -22,7 +21,8 @@ namespace Content.Server.Construction.Completions
|
|||||||
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
|
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
|
||||||
{
|
{
|
||||||
var scale = (float) IoCManager.Resolve<IRobustRandom>().NextGaussian(1, Variation);
|
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]
|
[DataDefinition]
|
||||||
public sealed class PopupUser : IGraphAction
|
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;
|
[DataField("text")] public string Text { get; } = string.Empty;
|
||||||
|
|
||||||
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
|
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ namespace Content.Server.Construction.Completions
|
|||||||
public sealed class RaiseEvent : IGraphAction
|
public sealed class RaiseEvent : IGraphAction
|
||||||
{
|
{
|
||||||
[DataField("event", required:true)]
|
[DataField("event", required:true)]
|
||||||
public EntityEventArgs? Event { get; } = null;
|
public EntityEventArgs? Event { get; }
|
||||||
|
|
||||||
[DataField("directed")]
|
[DataField("directed")]
|
||||||
public bool Directed { get; } = true;
|
public bool Directed { get; } = true;
|
||||||
@@ -21,7 +21,7 @@ namespace Content.Server.Construction.Completions
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if(Directed)
|
if(Directed)
|
||||||
entityManager.EventBus.RaiseLocalEvent(uid, (object)Event, false);
|
entityManager.EventBus.RaiseLocalEvent(uid, (object)Event);
|
||||||
|
|
||||||
if(Broadcast)
|
if(Broadcast)
|
||||||
entityManager.EventBus.RaiseEvent(EventSource.Local, (object)Event);
|
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)
|
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]
|
[DataDefinition]
|
||||||
public sealed class SnapToGrid : IGraphAction
|
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)
|
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)
|
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.
|
// That layer doesn't exist, we do nothing.
|
||||||
if (sprite.LayerCount <= Layer) return;
|
if (sprite.LayerCount <= Layer)
|
||||||
|
return;
|
||||||
|
|
||||||
sprite.LayerSetSprite(Layer, SpriteSpecifier);
|
sprite.LayerSetSprite(Layer, SpriteSpecifier);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace Content.Server.Construction.Components
|
|||||||
public sealed class WelderRefinableComponent : Component
|
public sealed class WelderRefinableComponent : Component
|
||||||
{
|
{
|
||||||
[DataField("refineResult")]
|
[DataField("refineResult")]
|
||||||
public HashSet<string>? RefineResult = new() { };
|
public HashSet<string>? RefineResult = new();
|
||||||
|
|
||||||
[DataField("refineTime")]
|
[DataField("refineTime")]
|
||||||
public float RefineTime = 2f;
|
public float RefineTime = 2f;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace Content.Server.Construction.Conditions
|
|||||||
|
|
||||||
if (airlock.BoltsDown != Value)
|
if (airlock.BoltsDown != Value)
|
||||||
{
|
{
|
||||||
if (Value == true)
|
if (Value)
|
||||||
args.PushMarkup(Loc.GetString("construction-examine-condition-airlock-bolt", ("entityName", entMan.GetComponent<MetaDataComponent>(entity).EntityName)) + "\n");
|
args.PushMarkup(Loc.GetString("construction-examine-condition-airlock-bolt", ("entityName", entMan.GetComponent<MetaDataComponent>(entity).EntityName)) + "\n");
|
||||||
else
|
else
|
||||||
args.PushMarkup(Loc.GetString("construction-examine-condition-airlock-unbolt", ("entityName", entMan.GetComponent<MetaDataComponent>(entity).EntityName)) + "\n");
|
args.PushMarkup(Loc.GetString("construction-examine-condition-airlock-unbolt", ("entityName", entMan.GetComponent<MetaDataComponent>(entity).EntityName)) + "\n");
|
||||||
|
|||||||
@@ -47,7 +47,8 @@ namespace Content.Server.Construction.Conditions
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
var indices = transform.Coordinates.ToVector2i(entityManager, IoCManager.Resolve<IMapManager>());
|
var indices = transform.Coordinates.ToVector2i(entityManager, IoCManager.Resolve<IMapManager>());
|
||||||
var entities = indices.GetEntitiesInTile(transform.GridUid.Value, LookupFlags.Approximate | LookupFlags.Anchored, EntitySystem.Get<EntityLookupSystem>());
|
var lookup = entityManager.EntitySysManager.GetEntitySystem<EntityLookupSystem>();
|
||||||
|
var entities = indices.GetEntitiesInTile(transform.GridUid.Value, LookupFlags.Approximate | LookupFlags.Anchored, lookup);
|
||||||
|
|
||||||
foreach (var ent in entities)
|
foreach (var ent in entities)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace Content.Server.Construction.Conditions
|
|||||||
var isWelded = door.State == DoorState.Welded;
|
var isWelded = door.State == DoorState.Welded;
|
||||||
if (isWelded != Welded)
|
if (isWelded != Welded)
|
||||||
{
|
{
|
||||||
if (Welded == true)
|
if (Welded)
|
||||||
args.PushMarkup(Loc.GetString("construction-examine-condition-door-weld", ("entityName", entMan.GetComponent<MetaDataComponent>(entity).EntityName)) + "\n");
|
args.PushMarkup(Loc.GetString("construction-examine-condition-door-weld", ("entityName", entMan.GetComponent<MetaDataComponent>(entity).EntityName)) + "\n");
|
||||||
else
|
else
|
||||||
args.PushMarkup(Loc.GetString("construction-examine-condition-door-unweld", ("entityName", entMan.GetComponent<MetaDataComponent>(entity).EntityName)) + "\n");
|
args.PushMarkup(Loc.GetString("construction-examine-condition-door-unweld", ("entityName", entMan.GetComponent<MetaDataComponent>(entity).EntityName)) + "\n");
|
||||||
|
|||||||
@@ -25,14 +25,16 @@ namespace Content.Server.Construction.Conditions
|
|||||||
if (!entityManager.TryGetComponent(uid, out MachineFrameComponent? machineFrame))
|
if (!entityManager.TryGetComponent(uid, out MachineFrameComponent? machineFrame))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return EntitySystem.Get<MachineFrameSystem>().IsComplete(machineFrame);
|
return entityManager.EntitySysManager.GetEntitySystem<MachineFrameSystem>().IsComplete(machineFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool DoExamine(ExaminedEvent args)
|
public bool DoExamine(ExaminedEvent args)
|
||||||
{
|
{
|
||||||
var entity = args.Examined;
|
var entity = args.Examined;
|
||||||
|
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<MachineFrameComponent?>(entity, out var machineFrame))
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
|
|
||||||
|
if (!entityManager.TryGetComponent<MachineFrameComponent?>(entity, out var machineFrame))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!machineFrame.HasBoard)
|
if (!machineFrame.HasBoard)
|
||||||
@@ -41,18 +43,20 @@ namespace Content.Server.Construction.Conditions
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EntitySystem.Get<MachineFrameSystem>().IsComplete(machineFrame)) return false;
|
if (entityManager.EntitySysManager.GetEntitySystem<MachineFrameSystem>().IsComplete(machineFrame))
|
||||||
|
return false;
|
||||||
|
|
||||||
args.Message.AddMarkup(Loc.GetString("construction-condition-machine-frame-requirement-label") + "\n");
|
args.Message.AddMarkup(Loc.GetString("construction-condition-machine-frame-requirement-label") + "\n");
|
||||||
foreach (var (part, required) in machineFrame.Requirements)
|
foreach (var (part, required) in machineFrame.Requirements)
|
||||||
{
|
{
|
||||||
var amount = required - machineFrame.Progress[part];
|
var amount = required - machineFrame.Progress[part];
|
||||||
|
|
||||||
if(amount == 0) continue;
|
if(amount == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
args.Message.AddMarkup(Loc.GetString("construction-condition-machine-frame-required-element-entry",
|
args.Message.AddMarkup(Loc.GetString("construction-condition-machine-frame-required-element-entry",
|
||||||
("amount", amount),
|
("amount", amount),
|
||||||
("elementName", Loc.GetString(part.ToString())))
|
("elementName", Loc.GetString(part)))
|
||||||
+ "\n");
|
+ "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,11 +64,12 @@ namespace Content.Server.Construction.Conditions
|
|||||||
{
|
{
|
||||||
var amount = required - machineFrame.MaterialProgress[material];
|
var amount = required - machineFrame.MaterialProgress[material];
|
||||||
|
|
||||||
if(amount == 0) continue;
|
if(amount == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
args.Message.AddMarkup(Loc.GetString("construction-condition-machine-frame-required-element-entry",
|
args.Message.AddMarkup(Loc.GetString("construction-condition-machine-frame-required-element-entry",
|
||||||
("amount", amount),
|
("amount", amount),
|
||||||
("elementName", Loc.GetString(material.ToString())))
|
("elementName", Loc.GetString(material)))
|
||||||
+ "\n");
|
+ "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,7 +77,8 @@ namespace Content.Server.Construction.Conditions
|
|||||||
{
|
{
|
||||||
var amount = info.Amount - machineFrame.ComponentProgress[compName];
|
var amount = info.Amount - machineFrame.ComponentProgress[compName];
|
||||||
|
|
||||||
if(amount == 0) continue;
|
if(amount == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
args.Message.AddMarkup(Loc.GetString("construction-condition-machine-frame-required-element-entry",
|
args.Message.AddMarkup(Loc.GetString("construction-condition-machine-frame-required-element-entry",
|
||||||
("amount", info.Amount),
|
("amount", info.Amount),
|
||||||
@@ -84,7 +90,8 @@ namespace Content.Server.Construction.Conditions
|
|||||||
{
|
{
|
||||||
var amount = info.Amount - machineFrame.TagProgress[tagName];
|
var amount = info.Amount - machineFrame.TagProgress[tagName];
|
||||||
|
|
||||||
if(amount == 0) continue;
|
if(amount == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
args.Message.AddMarkup(Loc.GetString("construction-condition-machine-frame-required-element-entry",
|
args.Message.AddMarkup(Loc.GetString("construction-condition-machine-frame-required-element-entry",
|
||||||
("amount", info.Amount),
|
("amount", info.Amount),
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace Content.Server.Construction.Conditions
|
|||||||
|
|
||||||
if (entityStorage.IsWeldedShut != Welded)
|
if (entityStorage.IsWeldedShut != Welded)
|
||||||
{
|
{
|
||||||
if (Welded == true)
|
if (Welded)
|
||||||
args.PushMarkup(Loc.GetString("construction-examine-condition-door-weld", ("entityName", metaData.EntityName)) + "\n");
|
args.PushMarkup(Loc.GetString("construction-examine-condition-door-weld", ("entityName", metaData.EntityName)) + "\n");
|
||||||
else
|
else
|
||||||
args.PushMarkup(Loc.GetString("construction-examine-condition-door-unweld", ("entityName", metaData.EntityName)) + "\n");
|
args.PushMarkup(Loc.GetString("construction-examine-condition-door-unweld", ("entityName", metaData.EntityName)) + "\n");
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ namespace Content.Server.Construction;
|
|||||||
|
|
||||||
public sealed partial class ConstructionSystem
|
public sealed partial class ConstructionSystem
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||||
|
|
||||||
private void InitializeComputer()
|
private void InitializeComputer()
|
||||||
{
|
{
|
||||||
SubscribeLocalEvent<ComputerComponent, ComponentInit>(OnCompInit);
|
SubscribeLocalEvent<ComputerComponent, ComponentInit>(OnCompInit);
|
||||||
@@ -19,10 +21,9 @@ public sealed partial class ConstructionSystem
|
|||||||
// Let's ensure the container manager and container are here.
|
// Let's ensure the container manager and container are here.
|
||||||
_container.EnsureContainer<Container>(uid, "board");
|
_container.EnsureContainer<Container>(uid, "board");
|
||||||
|
|
||||||
if (TryComp<ApcPowerReceiverComponent>(uid, out var powerReceiver) &&
|
if (TryComp<ApcPowerReceiverComponent>(uid, out var powerReceiver))
|
||||||
TryComp<AppearanceComponent>(uid, out var appearance))
|
|
||||||
{
|
{
|
||||||
appearance.SetData(ComputerVisuals.Powered, powerReceiver.Powered);
|
_appearance.SetData(uid, ComputerVisuals.Powered, powerReceiver.Powered);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,10 +34,7 @@ public sealed partial class ConstructionSystem
|
|||||||
|
|
||||||
private void OnCompPowerChange(EntityUid uid, ComputerComponent component, ref PowerChangedEvent args)
|
private void OnCompPowerChange(EntityUid uid, ComputerComponent component, ref PowerChangedEvent args)
|
||||||
{
|
{
|
||||||
if (TryComp<AppearanceComponent>(uid, out var appearance))
|
_appearance.SetData(uid, ComputerVisuals.Powered, args.Powered);
|
||||||
{
|
|
||||||
appearance.SetData(ComputerVisuals.Powered, args.Powered);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -11,8 +11,6 @@ namespace Content.Server.Construction
|
|||||||
{
|
{
|
||||||
public sealed partial class ConstructionSystem
|
public sealed partial class ConstructionSystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly ContainerSystem _containerSystem = default!;
|
|
||||||
|
|
||||||
private void InitializeGraphs()
|
private void InitializeGraphs()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -329,11 +327,11 @@ namespace Content.Server.Construction
|
|||||||
// Transfer all construction-owned containers from the old entity to the new one.
|
// Transfer all construction-owned containers from the old entity to the new one.
|
||||||
foreach (var container in construction.Containers)
|
foreach (var container in construction.Containers)
|
||||||
{
|
{
|
||||||
if (!_containerSystem.TryGetContainer(uid, container, out var ourContainer, containerManager))
|
if (!_container.TryGetContainer(uid, container, out var ourContainer, containerManager))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// NOTE: Only Container is supported by Construction!
|
// NOTE: Only Container is supported by Construction!
|
||||||
var otherContainer = _containerSystem.EnsureContainer<Container>(newUid, container, newContainerManager);
|
var otherContainer = _container.EnsureContainer<Container>(newUid, container, newContainerManager);
|
||||||
|
|
||||||
for (var i = ourContainer.ContainedEntities.Count - 1; i >= 0; i--)
|
for (var i = ourContainer.ContainedEntities.Count - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,11 +5,14 @@ using Content.Shared.Construction.Steps;
|
|||||||
using Content.Shared.Examine;
|
using Content.Shared.Examine;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
|
using Robust.Shared.Player;
|
||||||
|
|
||||||
namespace Content.Server.Construction
|
namespace Content.Server.Construction
|
||||||
{
|
{
|
||||||
public sealed partial class ConstructionSystem
|
public sealed partial class ConstructionSystem
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||||
|
|
||||||
private readonly Dictionary<ConstructionPrototype, ConstructionGuide> _guideCache = new();
|
private readonly Dictionary<ConstructionPrototype, ConstructionGuide> _guideCache = new();
|
||||||
|
|
||||||
private void InitializeGuided()
|
private void InitializeGuided()
|
||||||
@@ -49,11 +52,11 @@ namespace Content.Server.Construction
|
|||||||
if (component.TargetNode == null)
|
if (component.TargetNode == null)
|
||||||
{
|
{
|
||||||
// Maybe check, but on the flip-side a better solution might be to not make it undeconstructible in the first place, no?
|
// Maybe check, but on the flip-side a better solution might be to not make it undeconstructible in the first place, no?
|
||||||
component.Owner.PopupMessage(args.User, Loc.GetString("deconstructible-verb-activate-no-target-text"));
|
_popup.PopupEntity(Loc.GetString("deconstructible-verb-activate-no-target-text"), uid, Filter.Entities(uid));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
component.Owner.PopupMessage(args.User, Loc.GetString("deconstructible-verb-activate-text"));
|
_popup.PopupEntity(Loc.GetString("deconstructible-verb-activate-text"), args.User, Filter.Entities(args.User));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -94,7 +97,6 @@ namespace Content.Server.Construction
|
|||||||
|
|
||||||
if (!preventStepExamine && component.StepIndex < edge.Steps.Count)
|
if (!preventStepExamine && component.StepIndex < edge.Steps.Count)
|
||||||
edge.Steps[component.StepIndex].DoExamine(args);
|
edge.Steps[component.StepIndex].DoExamine(args);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Content.Server.Administration.Logs;
|
|
||||||
using Content.Server.Construction.Components;
|
using Content.Server.Construction.Components;
|
||||||
using Content.Server.DoAfter;
|
using Content.Server.DoAfter;
|
||||||
using Content.Server.Hands.Components;
|
using Content.Server.Hands.Components;
|
||||||
@@ -15,8 +14,8 @@ using Content.Shared.Database;
|
|||||||
using Content.Shared.Hands.EntitySystems;
|
using Content.Shared.Hands.EntitySystems;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Inventory;
|
using Content.Shared.Inventory;
|
||||||
using Content.Shared.Popups;
|
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Players;
|
using Robust.Shared.Players;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
|
|
||||||
@@ -82,7 +81,7 @@ namespace Content.Server.Construction
|
|||||||
|
|
||||||
foreach (var near in _lookupSystem.GetEntitiesInRange(user, 2f, LookupFlags.Approximate))
|
foreach (var near in _lookupSystem.GetEntitiesInRange(user, 2f, LookupFlags.Approximate))
|
||||||
{
|
{
|
||||||
if (_interactionSystem.InRangeUnobstructed(pos, near, 2f) && _containerSystem.IsInSameOrParentContainer(user, near))
|
if (_interactionSystem.InRangeUnobstructed(pos, near, 2f) && _container.IsInSameOrParentContainer(user, near))
|
||||||
yield return near;
|
yield return near;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -91,11 +90,11 @@ namespace Content.Server.Construction
|
|||||||
private async Task<EntityUid?> Construct(EntityUid user, string materialContainer, ConstructionGraphPrototype graph, ConstructionGraphEdge edge, ConstructionGraphNode targetNode)
|
private async Task<EntityUid?> Construct(EntityUid 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 = ContainerHelpers.EnsureContainer<Container>(user, materialContainer, out var existed);
|
var container = _container.EnsureContainer<Container>(user, materialContainer, out var existed);
|
||||||
|
|
||||||
if (existed)
|
if (existed)
|
||||||
{
|
{
|
||||||
user.PopupMessageCursor(Loc.GetString("construction-system-construct-cannot-start-another-construction"));
|
_popup.PopupCursor(Loc.GetString("construction-system-construct-cannot-start-another-construction"), Filter.Entities(user));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,15 +106,16 @@ namespace Content.Server.Construction
|
|||||||
// But I'd rather do this shit than risk having collisions with other containers.
|
// But I'd rather do this shit than risk having collisions with other containers.
|
||||||
Container GetContainer(string name)
|
Container GetContainer(string name)
|
||||||
{
|
{
|
||||||
if (containers!.ContainsKey(name))
|
if (containers.ContainsKey(name))
|
||||||
return containers[name];
|
return containers[name];
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
var random = _robustRandom.Next();
|
var random = _robustRandom.Next();
|
||||||
var c = ContainerHelpers.EnsureContainer<Container>(user!, random.ToString(), out var existed);
|
var c = _container.EnsureContainer<Container>(user, random.ToString(), out var exists);
|
||||||
|
|
||||||
if (existed) continue;
|
if (exists)
|
||||||
|
continue;
|
||||||
|
|
||||||
containers[name] = c;
|
containers[name] = c;
|
||||||
return c;
|
return c;
|
||||||
@@ -124,12 +124,12 @@ namespace Content.Server.Construction
|
|||||||
|
|
||||||
void FailCleanup()
|
void FailCleanup()
|
||||||
{
|
{
|
||||||
foreach (var entity in container!.ContainedEntities.ToArray())
|
foreach (var entity in container.ContainedEntities.ToArray())
|
||||||
{
|
{
|
||||||
container.Remove(entity);
|
container.Remove(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var cont in containers!.Values)
|
foreach (var cont in containers.Values)
|
||||||
{
|
{
|
||||||
foreach (var entity in cont.ContainedEntities.ToArray())
|
foreach (var entity in cont.ContainedEntities.ToArray())
|
||||||
{
|
{
|
||||||
@@ -143,8 +143,8 @@ namespace Content.Server.Construction
|
|||||||
|
|
||||||
void ShutdownContainers()
|
void ShutdownContainers()
|
||||||
{
|
{
|
||||||
container!.Shutdown();
|
container.Shutdown();
|
||||||
foreach (var c in containers!.Values.ToArray())
|
foreach (var c in containers.Values.ToArray())
|
||||||
{
|
{
|
||||||
c.Shutdown();
|
c.Shutdown();
|
||||||
}
|
}
|
||||||
@@ -219,7 +219,7 @@ namespace Content.Server.Construction
|
|||||||
|
|
||||||
if (failed)
|
if (failed)
|
||||||
{
|
{
|
||||||
user.PopupMessageCursor(Loc.GetString("construction-system-construct-no-materials"));
|
_popup.PopupCursor(Loc.GetString("construction-system-construct-no-materials"), Filter.Entities(user));
|
||||||
FailCleanup();
|
FailCleanup();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -255,7 +255,7 @@ namespace Content.Server.Construction
|
|||||||
// We preserve the containers...
|
// We preserve the containers...
|
||||||
foreach (var (name, cont) in containers)
|
foreach (var (name, cont) in containers)
|
||||||
{
|
{
|
||||||
var newCont = ContainerHelpers.EnsureContainer<Container>(newEntity, name);
|
var newCont = _container.EnsureContainer<Container>(newEntity, name);
|
||||||
|
|
||||||
foreach (var entity in cont.ContainedEntities.ToArray())
|
foreach (var entity in cont.ContainedEntities.ToArray())
|
||||||
{
|
{
|
||||||
@@ -306,10 +306,11 @@ namespace Content.Server.Construction
|
|||||||
var targetNode = constructionGraph.Nodes[constructionPrototype.TargetNode];
|
var targetNode = constructionGraph.Nodes[constructionPrototype.TargetNode];
|
||||||
var pathFind = constructionGraph.Path(startNode.Name, targetNode.Name);
|
var pathFind = constructionGraph.Path(startNode.Name, targetNode.Name);
|
||||||
|
|
||||||
if (args.SenderSession.AttachedEntity is not {Valid: true} user ||
|
if (args.SenderSession.AttachedEntity is not {Valid: true} user || _actionBlocker.CanInteract(user, null))
|
||||||
!Get<ActionBlockerSystem>().CanInteract(user, null)) return;
|
return;
|
||||||
|
|
||||||
if (!EntityManager.TryGetComponent(user, out HandsComponent? hands)) return;
|
if (!HasComp<HandsComponent>(user))
|
||||||
|
return;
|
||||||
|
|
||||||
foreach (var condition in constructionPrototype.Conditions)
|
foreach (var condition in constructionPrototype.Conditions)
|
||||||
{
|
{
|
||||||
@@ -318,14 +319,18 @@ namespace Content.Server.Construction
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pathFind == null)
|
if (pathFind == null)
|
||||||
|
{
|
||||||
throw new InvalidDataException(
|
throw new InvalidDataException(
|
||||||
$"Can't find path from starting node to target node in construction! Recipe: {ev.PrototypeName}");
|
$"Can't find path from starting node to target node in construction! Recipe: {ev.PrototypeName}");
|
||||||
|
}
|
||||||
|
|
||||||
var edge = startNode.GetEdge(pathFind[0].Name);
|
var edge = startNode.GetEdge(pathFind[0].Name);
|
||||||
|
|
||||||
if (edge == null)
|
if (edge == null)
|
||||||
|
{
|
||||||
throw new InvalidDataException(
|
throw new InvalidDataException(
|
||||||
$"Can't find edge from starting node to the next node in pathfinding! Recipe: {ev.PrototypeName}");
|
$"Can't find edge from starting node to the next node in pathfinding! Recipe: {ev.PrototypeName}");
|
||||||
|
}
|
||||||
|
|
||||||
// No support for conditions here!
|
// No support for conditions here!
|
||||||
|
|
||||||
@@ -370,9 +375,9 @@ namespace Content.Server.Construction
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user.IsInContainer())
|
if (_container.IsEntityInContainer(user))
|
||||||
{
|
{
|
||||||
user.PopupMessageCursor(Loc.GetString("construction-system-inside-container"));
|
_popup.PopupCursor(Loc.GetString("construction-system-inside-container"), Filter.Entities(user));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -385,7 +390,7 @@ namespace Content.Server.Construction
|
|||||||
{
|
{
|
||||||
if (!set.Add(ev.Ack))
|
if (!set.Add(ev.Ack))
|
||||||
{
|
{
|
||||||
user.PopupMessageCursor(Loc.GetString("construction-system-already-building"));
|
_popup.PopupCursor(Loc.GetString("construction-system-already-building"), Filter.Entities(user));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -340,7 +340,7 @@ namespace Content.Server.Construction
|
|||||||
construction.Containers.Add(store);
|
construction.Containers.Add(store);
|
||||||
|
|
||||||
// The container doesn't necessarily need to exist, so we ensure it.
|
// The container doesn't necessarily need to exist, so we ensure it.
|
||||||
_containerSystem.EnsureContainer<Container>(uid, store).Insert(insert);
|
_container.EnsureContainer<Container>(uid, store).Insert(insert);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using Content.Server.Stack;
|
|||||||
using Content.Server.Tools;
|
using Content.Server.Tools;
|
||||||
using Content.Shared.Construction;
|
using Content.Shared.Construction;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Server.Containers;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ namespace Content.Server.Construction
|
|||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||||
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
|
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
|
||||||
[Dependency] private readonly SharedContainerSystem _container = default!;
|
[Dependency] private readonly ContainerSystem _container = default!;
|
||||||
[Dependency] private readonly StackSystem _stackSystem = default!;
|
[Dependency] private readonly StackSystem _stackSystem = default!;
|
||||||
[Dependency] private readonly ToolSystem _toolSystem = default!;
|
[Dependency] private readonly ToolSystem _toolSystem = default!;
|
||||||
|
|
||||||
|
|||||||
@@ -4,12 +4,14 @@ using Content.Shared.Construction;
|
|||||||
using Content.Shared.Examine;
|
using Content.Shared.Examine;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Tag;
|
using Content.Shared.Tag;
|
||||||
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
|
|
||||||
namespace Content.Server.Construction;
|
namespace Content.Server.Construction;
|
||||||
|
|
||||||
public sealed class MachineFrameSystem : EntitySystem
|
public sealed class MachineFrameSystem : EntitySystem
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly AppearanceSystem _appearance = default!;
|
||||||
[Dependency] private readonly IComponentFactory _factory = default!;
|
[Dependency] private readonly IComponentFactory _factory = default!;
|
||||||
[Dependency] private readonly SharedContainerSystem _container = default!;
|
[Dependency] private readonly SharedContainerSystem _container = default!;
|
||||||
[Dependency] private readonly TagSystem _tag = 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 (!component.HasBoard && TryComp<MachineBoardComponent?>(args.Used, out var machineBoard))
|
||||||
{
|
{
|
||||||
if (args.Used.TryRemoveFromContainer())
|
if (_container.TryRemoveFromContainer(args.Used))
|
||||||
{
|
{
|
||||||
// Valid board!
|
// Valid board!
|
||||||
component.BoardContainer.Insert(args.Used);
|
component.BoardContainer.Insert(args.Used);
|
||||||
@@ -55,8 +57,7 @@ public sealed class MachineFrameSystem : EntitySystem
|
|||||||
// Setup requirements and progress...
|
// Setup requirements and progress...
|
||||||
ResetProgressAndRequirements(component, machineBoard);
|
ResetProgressAndRequirements(component, machineBoard);
|
||||||
|
|
||||||
if (TryComp<AppearanceComponent?>(uid, out var appearance))
|
_appearance.SetData(uid, MachineFrameVisuals.State, 2);
|
||||||
appearance.SetData(MachineFrameVisuals.State, 2);
|
|
||||||
|
|
||||||
if (TryComp(uid, out ConstructionComponent? construction))
|
if (TryComp(uid, out ConstructionComponent? construction))
|
||||||
{
|
{
|
||||||
@@ -73,7 +74,7 @@ public sealed class MachineFrameSystem : EntitySystem
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (component.Progress[machinePart.PartType] != component.Requirements[machinePart.PartType]
|
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]++;
|
component.Progress[machinePart.PartType]++;
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
@@ -127,7 +128,8 @@ public sealed class MachineFrameSystem : EntitySystem
|
|||||||
if (!HasComp(args.Used, registration.Type))
|
if (!HasComp(args.Used, registration.Type))
|
||||||
continue;
|
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]++;
|
component.ComponentProgress[compName]++;
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
return;
|
return;
|
||||||
@@ -141,7 +143,8 @@ public sealed class MachineFrameSystem : EntitySystem
|
|||||||
if (!_tag.HasTag(args.Used, tagName))
|
if (!_tag.HasTag(args.Used, tagName))
|
||||||
continue;
|
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]++;
|
component.TagProgress[tagName]++;
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
return;
|
return;
|
||||||
@@ -216,11 +219,9 @@ public sealed class MachineFrameSystem : EntitySystem
|
|||||||
|
|
||||||
public void RegenerateProgress(MachineFrameComponent component)
|
public void RegenerateProgress(MachineFrameComponent component)
|
||||||
{
|
{
|
||||||
AppearanceComponent? appearance;
|
|
||||||
|
|
||||||
if (!component.HasBoard)
|
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.TagRequirements.Clear();
|
||||||
component.MaterialRequirements.Clear();
|
component.MaterialRequirements.Clear();
|
||||||
@@ -239,7 +240,7 @@ public sealed class MachineFrameSystem : EntitySystem
|
|||||||
if (!TryComp<MachineBoardComponent>(board, out var machineBoard))
|
if (!TryComp<MachineBoardComponent>(board, out var machineBoard))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (TryComp(component.Owner, out appearance)) appearance.SetData(MachineFrameVisuals.State, 2);
|
_appearance.SetData(component.Owner, MachineFrameVisuals.State, 2);
|
||||||
|
|
||||||
ResetProgressAndRequirements(component, machineBoard);
|
ResetProgressAndRequirements(component, machineBoard);
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace Content.Server.Construction
|
|||||||
{
|
{
|
||||||
args.PushMarkup(Loc.GetString("machine-board-component-required-element-entry-text",
|
args.PushMarkup(Loc.GetString("machine-board-component-required-element-entry-text",
|
||||||
("amount", amount),
|
("amount", amount),
|
||||||
("requiredElement", Loc.GetString(part.ToString()))));
|
("requiredElement", Loc.GetString(part))));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var (material, amount) in component.MaterialRequirements)
|
foreach (var (material, amount) in component.MaterialRequirements)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace Content.Server.Construction
|
|||||||
private async void OnInteractUsing(EntityUid uid, WelderRefinableComponent component, InteractUsingEvent args)
|
private async void OnInteractUsing(EntityUid uid, WelderRefinableComponent component, InteractUsingEvent args)
|
||||||
{
|
{
|
||||||
// check if object is welder
|
// check if object is welder
|
||||||
if (!TryComp(args.Used, out ToolComponent? tool))
|
if (!HasComp<ToolComponent>(args.Used))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// check if someone is already welding object
|
// check if someone is already welding object
|
||||||
|
|||||||
@@ -27,9 +27,9 @@ namespace Content.Shared.Construction.Conditions
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConstructionGuideEntry? GenerateGuideEntry()
|
public ConstructionGuideEntry GenerateGuideEntry()
|
||||||
{
|
{
|
||||||
return new ConstructionGuideEntry()
|
return new ConstructionGuideEntry
|
||||||
{
|
{
|
||||||
Localization = "construction-guide-condition-empty-or-window-valid-in-tile"
|
Localization = "construction-guide-condition-empty-or-window-valid-in-tile"
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ namespace Content.Shared.Construction.Conditions
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConstructionGuideEntry? GenerateGuideEntry()
|
public ConstructionGuideEntry GenerateGuideEntry()
|
||||||
{
|
{
|
||||||
return new ConstructionGuideEntry()
|
return new ConstructionGuideEntry
|
||||||
{
|
{
|
||||||
Localization = "construction-step-condition-no-windows-in-tile"
|
Localization = "construction-step-condition-no-windows-in-tile"
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ namespace Content.Shared.Construction.Conditions
|
|||||||
return !tileRef.Value.IsBlockedTurf(_filterMobs);
|
return !tileRef.Value.IsBlockedTurf(_filterMobs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConstructionGuideEntry? GenerateGuideEntry()
|
public ConstructionGuideEntry GenerateGuideEntry()
|
||||||
{
|
{
|
||||||
return new ConstructionGuideEntry()
|
return new ConstructionGuideEntry
|
||||||
{
|
{
|
||||||
Localization = "construction-step-condition-tile-not-blocked",
|
Localization = "construction-step-condition-tile-not-blocked",
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,15 +13,13 @@ namespace Content.Shared.Construction.Conditions
|
|||||||
public List<string> TargetTiles { get; } = new();
|
public List<string> TargetTiles { get; } = new();
|
||||||
|
|
||||||
[DataField("guideText")]
|
[DataField("guideText")]
|
||||||
public string? GuideText = null;
|
public string? GuideText;
|
||||||
|
|
||||||
[DataField("guideIcon")]
|
[DataField("guideIcon")]
|
||||||
public SpriteSpecifier? GuideIcon = null;
|
public SpriteSpecifier? GuideIcon;
|
||||||
|
|
||||||
public bool Condition(EntityUid user, EntityCoordinates location, Direction direction)
|
public bool Condition(EntityUid user, EntityCoordinates location, Direction direction)
|
||||||
{
|
{
|
||||||
if (TargetTiles == null) return true;
|
|
||||||
|
|
||||||
var tileFound = location.GetTileRef();
|
var tileFound = location.GetTileRef();
|
||||||
|
|
||||||
if (tileFound == null)
|
if (tileFound == null)
|
||||||
@@ -30,10 +28,9 @@ namespace Content.Shared.Construction.Conditions
|
|||||||
var tile = tileFound.Value.Tile.GetContentTileDefinition();
|
var tile = tileFound.Value.Tile.GetContentTileDefinition();
|
||||||
foreach (var targetTile in TargetTiles)
|
foreach (var targetTile in TargetTiles)
|
||||||
{
|
{
|
||||||
if (tile.ID == targetTile) {
|
if (tile.ID == targetTile)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ namespace Content.Shared.Construction.Conditions
|
|||||||
// check that we didn't try to build wallmount that facing another adjacent wall
|
// check that we didn't try to build wallmount that facing another adjacent wall
|
||||||
var rAdjWall = new CollisionRay(objWorldPosition, directionWithOffset.Normalized, (int) CollisionGroup.Impassable);
|
var rAdjWall = new CollisionRay(objWorldPosition, directionWithOffset.Normalized, (int) CollisionGroup.Impassable);
|
||||||
var adjWallRaycastResults = physics.IntersectRayWithPredicate(entManager.GetComponent<TransformComponent>(user).MapID, rAdjWall, maxLength: 0.5f,
|
var adjWallRaycastResults = physics.IntersectRayWithPredicate(entManager.GetComponent<TransformComponent>(user).MapID, rAdjWall, maxLength: 0.5f,
|
||||||
predicate: (e) => e == targetWall.Value.HitEntity || !tagSystem.HasTag(e, "Wall"));
|
predicate: e => e == targetWall.Value.HitEntity || !tagSystem.HasTag(e, "Wall"));
|
||||||
|
|
||||||
return !adjWallRaycastResults.Any();
|
return !adjWallRaycastResults.Any();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,5 @@ public abstract class SharedAnchorableSystem : EntitySystem
|
|||||||
ToolComponent? usingTool = null)
|
ToolComponent? usingTool = null)
|
||||||
{
|
{
|
||||||
// Thanks tool system.
|
// Thanks tool system.
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ namespace Content.Shared.Construction.Steps
|
|||||||
{
|
{
|
||||||
[DataField("name")] public string Name { get; private set; } = string.Empty;
|
[DataField("name")] public string Name { get; private set; } = string.Empty;
|
||||||
|
|
||||||
[DataField("icon")] public SpriteSpecifier? Icon { get; private set; } = null;
|
[DataField("icon")] public SpriteSpecifier? Icon { get; private set; }
|
||||||
|
|
||||||
public override void DoExamine(ExaminedEvent examinedEvent)
|
public override void DoExamine(ExaminedEvent examinedEvent)
|
||||||
{
|
{
|
||||||
@@ -19,7 +19,7 @@ namespace Content.Shared.Construction.Steps
|
|||||||
|
|
||||||
public override ConstructionGuideEntry GenerateGuideEntry()
|
public override ConstructionGuideEntry GenerateGuideEntry()
|
||||||
{
|
{
|
||||||
return new ConstructionGuideEntry()
|
return new ConstructionGuideEntry
|
||||||
{
|
{
|
||||||
Localization = "construction-presenter-arbitrary-step",
|
Localization = "construction-presenter-arbitrary-step",
|
||||||
Arguments = new (string, object)[]{("name", Name)},
|
Arguments = new (string, object)[]{("name", Name)},
|
||||||
|
|||||||
@@ -57,7 +57,8 @@ namespace Content.Shared.Construction.Steps
|
|||||||
{
|
{
|
||||||
var type = GetType(node);
|
var type = GetType(node);
|
||||||
|
|
||||||
if (type == null) return new ErrorNode(node, "No construction graph step type found.", true);
|
if (type == null)
|
||||||
|
return new ErrorNode(node, "No construction graph step type found.");
|
||||||
|
|
||||||
return serializationManager.ValidateNode(type, node, context);
|
return serializationManager.ValidateNode(type, node, context);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace Content.Shared.Construction.Steps
|
|||||||
if (!entityManager.TryGetComponent(uid, out TagComponent? tags))
|
if (!entityManager.TryGetComponent(uid, out TagComponent? tags))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var tagSystem = EntitySystem.Get<TagSystem>();
|
var tagSystem = entityManager.EntitySysManager.GetEntitySystem<TagSystem>();
|
||||||
|
|
||||||
if (_allTags != null && !tagSystem.HasAllTags(tags, _allTags))
|
if (_allTags != null && !tagSystem.HasAllTags(tags, _allTags))
|
||||||
return false; // We don't have all the tags needed.
|
return false; // We don't have all the tags needed.
|
||||||
|
|||||||
@@ -29,6 +29,10 @@
|
|||||||
- type: Construction
|
- type: Construction
|
||||||
graph: Machine
|
graph: Machine
|
||||||
node: missingWires
|
node: missingWires
|
||||||
|
- type: ContainerContainer
|
||||||
|
containers:
|
||||||
|
machine_board: !type:Container
|
||||||
|
machine_parts: !type:Container
|
||||||
- type: Damageable
|
- type: Damageable
|
||||||
damageContainer: Inorganic
|
damageContainer: Inorganic
|
||||||
damageModifierSet: Metallic
|
damageModifierSet: Metallic
|
||||||
@@ -76,6 +80,7 @@
|
|||||||
- type: Construction
|
- type: Construction
|
||||||
graph: Machine
|
graph: Machine
|
||||||
node: machineFrame
|
node: machineFrame
|
||||||
|
defaultTarget: machine
|
||||||
- type: Damageable
|
- type: Damageable
|
||||||
damageContainer: Inorganic
|
damageContainer: Inorganic
|
||||||
damageModifierSet: Metallic
|
damageModifierSet: Metallic
|
||||||
@@ -90,6 +95,10 @@
|
|||||||
- !type:DoActsBehavior
|
- !type:DoActsBehavior
|
||||||
acts: ["Destruction"]
|
acts: ["Destruction"]
|
||||||
- type: MachineFrame
|
- type: MachineFrame
|
||||||
|
- type: ContainerContainer
|
||||||
|
containers:
|
||||||
|
machine_board: !type:Container
|
||||||
|
machine_parts: !type:Container
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
netsync: false
|
netsync: false
|
||||||
sprite: Structures/Machines/parts.rsi
|
sprite: Structures/Machines/parts.rsi
|
||||||
|
|||||||
Reference in New Issue
Block a user