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

@@ -4,6 +4,7 @@ using Content.Server.Buckle.Components;
using Content.Server.Chat.Managers;
using Content.Server.Popups;
using Content.Server.Storage.Components;
using Content.Server.Tools;
using Content.Server.Tools.Components;
using Content.Shared.Audio;
using Content.Shared.Body.Components;
@@ -13,7 +14,8 @@ using Content.Shared.Interaction;
using Content.Shared.Popups;
using Content.Shared.Sound;
using Content.Shared.Toilet;
using Content.Shared.Tool;
using Content.Shared.Tools;
using Content.Shared.Tools.Components;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
@@ -22,6 +24,7 @@ using Robust.Shared.Localization;
using Robust.Shared.Player;
using Robust.Shared.Random;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Utility;
using Robust.Shared.ViewVariables;
@@ -37,6 +40,9 @@ namespace Content.Server.Toilet
private bool _isPrying = false;
[DataField("pryingQuality", customTypeSerializer:typeof(PrototypeIdSerializer<ToolQualityPrototype>))]
private string _pryingQuality = "Prying";
[ViewVariables] public bool LidOpen { get; private set; }
[ViewVariables] public bool IsSeatUp { get; private set; }
@@ -62,14 +68,14 @@ namespace Content.Server.Toilet
{
// are player trying place or lift of cistern lid?
if (eventArgs.Using.TryGetComponent(out ToolComponent? tool)
&& tool!.HasQuality(ToolQuality.Prying))
&& tool.Qualities.Contains(_pryingQuality))
{
// check if someone is already prying this toilet
if (_isPrying)
return false;
_isPrying = true;
if (!await tool.UseTool(eventArgs.User, Owner, PryLidTime, ToolQuality.Prying))
if (!await EntitySystem.Get<ToolSystem>().UseTool(eventArgs.Using.Uid, eventArgs.User.Uid, Owner.Uid, 0f, PryLidTime, _pryingQuality))
{
_isPrying = false;
return false;