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

@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Content.Server.Tools;
using Content.Server.Ghost.Components;
using Content.Server.Tools.Components;
using Content.Shared.ActionBlocker;
@@ -14,7 +15,8 @@ using Content.Shared.Placeable;
using Content.Shared.Popups;
using Content.Shared.Sound;
using Content.Shared.Storage;
using Content.Shared.Tool;
using Content.Shared.Tools;
using Content.Shared.Tools.Components;
using Content.Shared.Verbs;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
@@ -26,6 +28,7 @@ using Robust.Shared.Maths;
using Robust.Shared.Physics;
using Robust.Shared.Player;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.ViewVariables;
namespace Content.Server.Storage.Components
@@ -64,6 +67,9 @@ namespace Content.Server.Storage.Components
[DataField("open")]
private bool _open;
[DataField("weldingQuality", customTypeSerializer:typeof(PrototypeIdSerializer<ToolQualityPrototype>))]
private string _weldingQuality = "Welding";
[DataField("CanWeldShut")]
private bool _canWeldShut = true;
@@ -393,7 +399,7 @@ namespace Content.Server.Storage.Components
return false;
}
if (!eventArgs.Using.TryGetComponent(out WelderComponent? tool) || !tool.WelderLit)
if (!eventArgs.Using.TryGetComponent(out WelderComponent? tool) || !tool.Lit)
{
_beingWelded = false;
return false;
@@ -404,7 +410,9 @@ namespace Content.Server.Storage.Components
_beingWelded = true;
if (!await tool.UseTool(eventArgs.User, Owner, 1f, ToolQuality.Welding, 1f))
var toolSystem = EntitySystem.Get<ToolSystem>();
if (!await toolSystem.UseTool(eventArgs.Using.Uid, eventArgs.User.Uid, Owner.Uid, 1f, 1f, _weldingQuality))
{
_beingWelded = false;
return false;