Makes tools and welders ECS, add ToolQualityPrototype. (#4741)

This commit is contained in:
Vera Aguilera Puerto
2021-10-07 13:01:27 +02:00
committed by GitHub
parent f2760d0002
commit 365c7da4dc
44 changed files with 1144 additions and 863 deletions

View File

@@ -5,7 +5,7 @@ using Content.Server.Tools.Components;
using Content.Shared.Interaction;
using Content.Shared.Popups;
using Content.Shared.Sound;
using Content.Shared.Tool;
using Content.Shared.Tools.Components;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
@@ -13,7 +13,9 @@ using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Map;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.AME.Components
{
@@ -25,18 +27,23 @@ namespace Content.Server.AME.Components
[Dependency] private readonly IServerEntityManager _serverEntityManager = default!;
public override string Name => "AMEPart";
[DataField("unwrapSound")] private SoundSpecifier _unwrapSound = new SoundPathSpecifier("/Audio/Effects/unwrap.ogg");
[DataField("unwrapSound")]
private SoundSpecifier _unwrapSound = new SoundPathSpecifier("/Audio/Effects/unwrap.ogg");
[DataField("qualityNeeded", customTypeSerializer:typeof(PrototypeIdSerializer<EntityPrototype>))]
private string _qualityNeeded = "Pulsing";
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs args)
{
if (!args.User.TryGetComponent<IHandsComponent>(out var hands))
{
Owner.PopupMessage(args.User, Loc.GetString("ame-part-component-interact-using-no-hands"));
return true;
return false;
}
if (!args.Using.TryGetComponent<ToolComponent>(out var multitool) || multitool.Qualities != ToolQuality.Multitool)
return true;
if (!args.Using.TryGetComponent<ToolComponent>(out var tool) || !tool.Qualities.Contains(_qualityNeeded))
return false;
if (!_mapManager.TryGetGrid(args.ClickLocation.GetGridId(_serverEntityManager), out var mapGrid))
return false; // No AME in space.
@@ -53,7 +60,7 @@ namespace Content.Server.AME.Components
SoundSystem.Play(Filter.Pvs(Owner), _unwrapSound.GetSound(), Owner);
Owner.Delete();
Owner.QueueDelete();
return true;
}