Refactor a bunch of stuff.
This commit is contained in:
@@ -10,7 +10,7 @@ using Robust.Shared.IoC;
|
||||
namespace Content.Server.GameObjects.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
public class AnchorableComponent : Component, IWrenchAct
|
||||
public class AnchorableComponent : Component, IAttackBy
|
||||
{
|
||||
public override string Name => "Anchorable";
|
||||
|
||||
@@ -20,15 +20,16 @@ namespace Content.Server.GameObjects.Components
|
||||
Owner.EnsureComponent<PhysicsComponent>();
|
||||
}
|
||||
|
||||
public bool WrenchAct(WrenchActEventArgs eventArgs)
|
||||
public bool AttackBy(AttackByEventArgs eventArgs)
|
||||
{
|
||||
if (!Owner.TryGetComponent(out PhysicsComponent physics))
|
||||
{
|
||||
if (!Owner.TryGetComponent(out PhysicsComponent physics)
|
||||
|| !eventArgs.AttackWith.TryGetComponent(out ToolComponent tool))
|
||||
return false;
|
||||
|
||||
if (!tool.UseTool(eventArgs.User, Owner, ToolQuality.Anchoring))
|
||||
return false;
|
||||
}
|
||||
|
||||
physics.Anchored = !physics.Anchored;
|
||||
eventArgs.ToolComponent.PlayUseSound();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Content.Server.GameObjects.Components.Construction
|
||||
|
||||
var stage = Prototype.Stages[Stage];
|
||||
|
||||
if (TryProcessStep(stage.Forward, eventArgs.AttackWith))
|
||||
if (TryProcessStep(stage.Forward, eventArgs.AttackWith, eventArgs.User))
|
||||
{
|
||||
Stage++;
|
||||
if (Stage == Prototype.Stages.Count - 1)
|
||||
@@ -83,7 +83,7 @@ namespace Content.Server.GameObjects.Components.Construction
|
||||
}
|
||||
}
|
||||
|
||||
else if (TryProcessStep(stage.Backward, eventArgs.AttackWith))
|
||||
else if (TryProcessStep(stage.Backward, eventArgs.AttackWith, eventArgs.User))
|
||||
{
|
||||
Stage--;
|
||||
if (Stage == 0)
|
||||
@@ -119,7 +119,7 @@ namespace Content.Server.GameObjects.Components.Construction
|
||||
|
||||
}
|
||||
|
||||
bool TryProcessStep(ConstructionStep step, IEntity slapped)
|
||||
bool TryProcessStep(ConstructionStep step, IEntity slapped, IEntity user)
|
||||
{
|
||||
if (step == null)
|
||||
{
|
||||
@@ -144,10 +144,13 @@ namespace Content.Server.GameObjects.Components.Construction
|
||||
case ConstructionStepTool toolStep:
|
||||
if (!slapped.TryGetComponent<ToolComponent>(out var tool))
|
||||
return false;
|
||||
if (toolStep.Tool != tool.Behavior) return false;
|
||||
if (toolStep.Tool == Tool.Welder && !((WelderComponent)tool).TryWeld(toolStep.Amount)) return false;
|
||||
tool.PlayUseSound();
|
||||
return true;
|
||||
|
||||
// Handle welder manually since tool steps specify fuel amount needed, for some reason.
|
||||
if (toolStep.ToolQuality.HasFlag(ToolQuality.Welding))
|
||||
return slapped.TryGetComponent<WelderComponent>(out var welder)
|
||||
&& welder.UseTool(user, Owner, toolStep.ToolQuality, toolStep.Amount);
|
||||
|
||||
return tool.UseTool(user, Owner, toolStep.ToolQuality);
|
||||
|
||||
default:
|
||||
throw new NotImplementedException();
|
||||
|
||||
@@ -204,7 +204,7 @@ namespace Content.Server.GameObjects.Components.Doors
|
||||
if (!eventArgs.AttackWith.TryGetComponent<ToolComponent>(out var tool))
|
||||
return false;
|
||||
|
||||
if (tool.Behavior != Tool.Crowbar) return false;
|
||||
if (!tool.UseTool(eventArgs.User, Owner, ToolQuality.Prying)) return false;
|
||||
|
||||
if (IsPowered())
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Server.GameObjects.Components.Power;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Shared.GameObjects.Components.Gravity;
|
||||
using Content.Shared.GameObjects.Components.Interactable;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameObjects.Components.UserInterface;
|
||||
@@ -19,7 +20,7 @@ using Robust.Shared.Serialization;
|
||||
namespace Content.Server.GameObjects.Components.Gravity
|
||||
{
|
||||
[RegisterComponent]
|
||||
public class GravityGeneratorComponent: SharedGravityGeneratorComponent, IWelderAct, IBreakAct, IAttackHand
|
||||
public class GravityGeneratorComponent: SharedGravityGeneratorComponent, IAttackBy, IBreakAct, IAttackHand
|
||||
{
|
||||
private BoundUserInterface _userInterface;
|
||||
|
||||
@@ -98,10 +99,14 @@ namespace Content.Server.GameObjects.Components.Gravity
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool WelderAct(WelderActEventArgs eventArgs)
|
||||
public bool AttackBy(AttackByEventArgs eventArgs)
|
||||
{
|
||||
var welder = eventArgs.WelderComponent;
|
||||
if (!welder.TryWeld(5.0f)) return false;
|
||||
if (!eventArgs.AttackWith.TryGetComponent(out WelderComponent tool))
|
||||
return false;
|
||||
|
||||
if (!tool.UseTool(eventArgs.User, Owner, ToolQuality.Welding, 5f))
|
||||
return false;
|
||||
|
||||
// Repair generator
|
||||
var damageable = Owner.GetComponent<DamageableComponent>();
|
||||
var breakable = Owner.GetComponent<BreakableComponent>();
|
||||
@@ -116,7 +121,6 @@ namespace Content.Server.GameObjects.Components.Gravity
|
||||
notifyManager.PopupMessage(Owner, eventArgs.User, Loc.GetString("You repair the gravity generator with the welder"));
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public void OnBreak(BreakageEventArgs eventArgs)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.GameObjects;
|
||||
using Content.Shared.GameObjects.Components.Interactable;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
@@ -26,7 +27,7 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
private string _sprite;
|
||||
private string _changeSound;
|
||||
|
||||
public Tool Behavior { get; private set; }
|
||||
public ToolQuality Behavior { get; private set; }
|
||||
public string State => _state;
|
||||
public string Texture => _texture;
|
||||
public string Sprite => _sprite;
|
||||
@@ -37,7 +38,7 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
public void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
if(serializer.Reading)
|
||||
Behavior = (Tool)serializer.ReadStringEnumKey("behavior");
|
||||
Behavior = (ToolQuality)serializer.ReadStringEnumKey("behavior");
|
||||
serializer.DataField(ref _state, "state", string.Empty);
|
||||
serializer.DataField(ref _sprite, "sprite", string.Empty);
|
||||
serializer.DataField(ref _texture, "texture", string.Empty);
|
||||
@@ -52,6 +53,7 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
#pragma warning restore 649
|
||||
|
||||
public override string Name => "MultiTool";
|
||||
public override uint? NetID => ContentNetIDs.MULTITOOLS;
|
||||
private List<ToolEntry> _tools;
|
||||
private int _currentTool = 0;
|
||||
|
||||
@@ -87,7 +89,7 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
|
||||
_tool.UseSound = current.Sound;
|
||||
_tool.UseSoundCollection = current.SoundCollection;
|
||||
_tool.Behavior = current.Behavior;
|
||||
_tool.Qualities = current.Behavior;
|
||||
|
||||
if (_sprite == null) return;
|
||||
|
||||
@@ -98,6 +100,8 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
_sprite.LayerSetState(0, current.State);
|
||||
else
|
||||
_sprite.LayerSetTexture(0, current.Texture);
|
||||
|
||||
Dirty();
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
@@ -111,5 +115,10 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
Cycle();
|
||||
return true;
|
||||
}
|
||||
|
||||
public override ComponentState GetComponentState()
|
||||
{
|
||||
return new MultiToolComponentState(_tool.Qualities);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// ReSharper disable once RedundantUsingDirective
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection.Metadata.Ecma335;
|
||||
using Content.Server.GameObjects.Components.Chemistry;
|
||||
@@ -46,18 +47,18 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
private InteractionSystem _interactionSystem;
|
||||
private SpriteComponent _spriteComponent;
|
||||
|
||||
protected Tool _behavior = Tool.Wrench;
|
||||
protected ToolQuality _qualities = ToolQuality.Anchoring;
|
||||
private string _useSound;
|
||||
private string _useSoundCollection;
|
||||
private float _speedModifier = 1;
|
||||
|
||||
[ViewVariables]
|
||||
public override Tool Behavior
|
||||
public override ToolQuality Qualities
|
||||
{
|
||||
get => _behavior;
|
||||
get => _qualities;
|
||||
set
|
||||
{
|
||||
_behavior = value;
|
||||
_qualities = value;
|
||||
Dirty();
|
||||
}
|
||||
}
|
||||
@@ -84,6 +85,23 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
set => _useSoundCollection = value;
|
||||
}
|
||||
|
||||
public void AddQuality(ToolQuality quality)
|
||||
{
|
||||
_qualities |= quality;
|
||||
Dirty();
|
||||
}
|
||||
|
||||
public void RemoveQuality(ToolQuality quality)
|
||||
{
|
||||
_qualities &= ~quality;
|
||||
Dirty();
|
||||
}
|
||||
|
||||
public bool HasQuality(ToolQuality quality)
|
||||
{
|
||||
return _qualities.HasFlag(quality);
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
@@ -99,13 +117,10 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
|
||||
if (serializer.Reading)
|
||||
{
|
||||
try
|
||||
var qualities = serializer.ReadDataField("qualities", new List<ToolQuality>());
|
||||
foreach (var quality in qualities)
|
||||
{
|
||||
_behavior = (Tool)serializer.ReadStringEnumKey("behavior");
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
AddQuality(quality);
|
||||
}
|
||||
}
|
||||
serializer.DataField(ref _speedModifier, "speed", 1);
|
||||
@@ -113,22 +128,11 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
serializer.DataField(ref _useSoundCollection, "useSoundCollection", string.Empty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Status modifier which determines whether or not we can act as a tool at this time
|
||||
/// </summary>
|
||||
public virtual bool CanUse(float resource)
|
||||
public virtual bool UseTool(IEntity user, IEntity target, ToolQuality toolQualityNeeded)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
PlayUseSound();
|
||||
|
||||
/// <summary>
|
||||
/// Method which will try to use the current tool and consume resources/power if applicable.
|
||||
/// </summary>
|
||||
/// <param name="resource">The amount of resource</param>
|
||||
/// <returns>Whether the tool could be used or not.</returns>
|
||||
public virtual bool TryUse(float resource = 0f)
|
||||
{
|
||||
return true;
|
||||
return ActionBlockerSystem.CanInteract(user) && HasQuality(toolQualityNeeded);
|
||||
}
|
||||
|
||||
protected void PlaySoundCollection(string name, float volume=-5f)
|
||||
@@ -147,17 +151,9 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
PlaySoundCollection(UseSoundCollection, 0f);
|
||||
}
|
||||
|
||||
public override ComponentState GetComponentState()
|
||||
{
|
||||
return new ToolComponentState(Behavior);
|
||||
}
|
||||
|
||||
public void AfterAttack(AfterAttackEventArgs eventArgs)
|
||||
{
|
||||
if (eventArgs.Attacked != null && RaiseToolAct(eventArgs))
|
||||
return;
|
||||
|
||||
if (Behavior != Tool.Crowbar)
|
||||
if (Qualities != ToolQuality.Prying)
|
||||
return;
|
||||
|
||||
var mapGrid = _mapManager.GetGrid(eventArgs.ClickLocation.GridID);
|
||||
@@ -180,101 +176,5 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
var tileItem = Owner.EntityManager.SpawnEntity(tileDef.ItemDropPrototypeName, coordinates);
|
||||
tileItem.Transform.WorldPosition += (0.2f, 0.2f);
|
||||
}
|
||||
|
||||
private bool RaiseToolAct(AfterAttackEventArgs eventArgs)
|
||||
{
|
||||
var attacked = eventArgs.Attacked;
|
||||
var clickLocation = eventArgs.ClickLocation;
|
||||
var user = eventArgs.User;
|
||||
|
||||
switch (Behavior)
|
||||
{
|
||||
case Tool.Wrench:
|
||||
var wrenchList = attacked.GetAllComponents<IWrenchAct>().ToList();
|
||||
var wrenchAttackBy = new WrenchActEventArgs()
|
||||
{ User = user, ClickLocation = clickLocation, AttackWith = Owner };
|
||||
|
||||
foreach (var comp in wrenchList)
|
||||
{
|
||||
if (comp.WrenchAct(wrenchAttackBy))
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case Tool.Crowbar:
|
||||
var crowbarList = attacked.GetAllComponents<ICrowbarAct>().ToList();
|
||||
var crowbarAttackBy = new CrowbarActEventArgs()
|
||||
{ User = user, ClickLocation = clickLocation, AttackWith = Owner };
|
||||
|
||||
foreach (var comp in crowbarList)
|
||||
{
|
||||
if (comp.CrowbarAct(crowbarAttackBy))
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case Tool.Screwdriver:
|
||||
var screwdriverList = attacked.GetAllComponents<IScrewdriverAct>().ToList();
|
||||
var screwdriverAttackBy = new ScrewdriverActEventArgs()
|
||||
{ User = user, ClickLocation = clickLocation, AttackWith = Owner };
|
||||
|
||||
foreach (var comp in screwdriverList)
|
||||
{
|
||||
if (comp.ScrewdriverAct(screwdriverAttackBy))
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case Tool.Wirecutter:
|
||||
var wirecutterList = attacked.GetAllComponents<IWirecutterAct>().ToList();
|
||||
var wirecutterAttackBy = new WirecutterActEventArgs()
|
||||
{ User = user, ClickLocation = clickLocation, AttackWith = Owner };
|
||||
|
||||
foreach (var comp in wirecutterList)
|
||||
{
|
||||
if (comp.WirecutterAct(wirecutterAttackBy))
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
case Tool.Welder:
|
||||
var welderList = attacked.GetAllComponents<IWelderAct>().ToList();
|
||||
var welder = (WelderComponent) this;
|
||||
var welderAttackBy = new WelderActEventArgs()
|
||||
{
|
||||
User = user, ClickLocation = clickLocation, AttackWith = Owner,
|
||||
Fuel = welder.Fuel, FuelCapacity = welder.FuelCapacity
|
||||
};
|
||||
|
||||
foreach (var comp in welderList)
|
||||
{
|
||||
if (comp.WelderAct(welderAttackBy))
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case Tool.Multitool:
|
||||
var multitoolList = attacked.GetAllComponents<IMultitoolAct>().ToList();
|
||||
var multitoolAttackBy = new MultitoolActEventArgs()
|
||||
{ User = user, ClickLocation = clickLocation, AttackWith = Owner };
|
||||
|
||||
foreach (var comp in multitoolList)
|
||||
{
|
||||
if (comp.MultitoolAct(multitoolAttackBy))
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private IEntitySystemManager _entitySystemManager;
|
||||
[Dependency] private readonly IRobustRandom _robustRandom;
|
||||
#pragma warning restore 649
|
||||
|
||||
public override string Name => "Welder";
|
||||
@@ -38,7 +37,6 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
public const float FuelLossRate = 0.5f;
|
||||
|
||||
private bool _welderLit = false;
|
||||
|
||||
private WelderSystem _welderSystem;
|
||||
private SpriteComponent _spriteComponent;
|
||||
private SolutionComponent _solutionComponent;
|
||||
@@ -67,7 +65,7 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
_behavior = Tool.Welder;
|
||||
AddQuality(ToolQuality.Welding);
|
||||
|
||||
_welderSystem = _entitySystemManager.GetEntitySystem<WelderSystem>();
|
||||
|
||||
@@ -80,41 +78,40 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
return new WelderComponentState(FuelCapacity, Fuel, WelderLit);
|
||||
}
|
||||
|
||||
public bool CanUse()
|
||||
public override bool UseTool(IEntity user, IEntity target, ToolQuality toolQualityNeeded)
|
||||
{
|
||||
return CanWeld(DefaultFuelCost);
|
||||
var canUse = base.UseTool(user, target, toolQualityNeeded);
|
||||
|
||||
return toolQualityNeeded.HasFlag(ToolQuality.Welding) ? canUse && TryWeld(DefaultFuelCost) : canUse;
|
||||
}
|
||||
|
||||
public bool TryUse()
|
||||
public bool UseTool(IEntity user, IEntity target, ToolQuality toolQualityNeeded, float fuelConsumed)
|
||||
{
|
||||
return TryWeld(DefaultFuelCost);
|
||||
return base.UseTool(user, target, toolQualityNeeded) && TryWeld(fuelConsumed);
|
||||
}
|
||||
|
||||
public bool TryWeld(float value)
|
||||
private bool TryWeld(float value)
|
||||
{
|
||||
if (!WelderLit || !CanWeld(value) || _solutionComponent == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return _solutionComponent.TryRemoveReagent("chem.WeldingFuel", ReagentUnit.New(value));
|
||||
}
|
||||
|
||||
public bool CanWeld(float value)
|
||||
private bool CanWeld(float value)
|
||||
{
|
||||
return Fuel > value || Behavior != Tool.Welder;
|
||||
return Fuel > value || Qualities != ToolQuality.Welding;
|
||||
}
|
||||
|
||||
public bool CanLitWelder()
|
||||
private bool CanLitWelder()
|
||||
{
|
||||
return Fuel > 0 || Behavior != Tool.Welder;
|
||||
return Fuel > 0 || Qualities != ToolQuality.Welding;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deactivates welding tool if active, activates welding tool if possible
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool ToggleWelderStatus()
|
||||
private bool ToggleWelderStatus()
|
||||
{
|
||||
if (WelderLit)
|
||||
{
|
||||
@@ -157,17 +154,13 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
|
||||
public void OnUpdate(float frameTime)
|
||||
{
|
||||
if (Behavior != Tool.Welder || !WelderLit)
|
||||
{
|
||||
if (!HasQuality(ToolQuality.Welding) || !WelderLit)
|
||||
return;
|
||||
}
|
||||
|
||||
_solutionComponent.TryRemoveReagent("chem.WeldingFuel", ReagentUnit.New(FuelLossRate * frameTime));
|
||||
|
||||
if (Fuel == 0)
|
||||
{
|
||||
ToggleWelderStatus();
|
||||
}
|
||||
|
||||
Dirty();
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ namespace Content.Server.GameObjects.Components.Power
|
||||
public bool AttackBy(AttackByEventArgs eventArgs)
|
||||
{
|
||||
if (!eventArgs.AttackWith.TryGetComponent(out ToolComponent tool)) return false;
|
||||
if (tool.Behavior != Tool.Wirecutter) return false;
|
||||
if (!tool.UseTool(eventArgs.User, Owner, ToolQuality.Cutting)) return false;
|
||||
|
||||
Owner.Delete();
|
||||
var droppedEnt = Owner.EntityManager.SpawnEntity("CableStack", eventArgs.ClickLocation);
|
||||
|
||||
@@ -248,7 +248,7 @@ namespace Content.Server.GameObjects.Components
|
||||
switch (msg.Action)
|
||||
{
|
||||
case WiresAction.Cut:
|
||||
if (tool == null || tool.Behavior != Tool.Wirecutter)
|
||||
if (tool == null || !tool.HasQuality(ToolQuality.Cutting))
|
||||
{
|
||||
_notifyManager.PopupMessage(Owner.Transform.GridPosition, player, _localizationManager.GetString("You need to hold a wirecutter in your hand!"));
|
||||
return;
|
||||
@@ -258,7 +258,7 @@ namespace Content.Server.GameObjects.Components
|
||||
UpdateUserInterface();
|
||||
break;
|
||||
case WiresAction.Mend:
|
||||
if (tool == null || tool.Behavior != Tool.Wirecutter)
|
||||
if (tool == null || !tool.HasQuality(ToolQuality.Cutting))
|
||||
{
|
||||
_notifyManager.PopupMessage(Owner.Transform.GridPosition, player, _localizationManager.GetString("You need to hold a wirecutter in your hand!"));
|
||||
return;
|
||||
@@ -268,7 +268,7 @@ namespace Content.Server.GameObjects.Components
|
||||
UpdateUserInterface();
|
||||
break;
|
||||
case WiresAction.Pulse:
|
||||
if (tool == null || tool.Behavior != Tool.Multitool)
|
||||
if (tool == null || !tool.HasQuality(ToolQuality.Multitool))
|
||||
{
|
||||
_notifyManager.PopupMessage(Owner.Transform.GridPosition, player, _localizationManager.GetString("You need to hold a multitool in your hand!"));
|
||||
return;
|
||||
@@ -300,13 +300,13 @@ namespace Content.Server.GameObjects.Components
|
||||
{
|
||||
if (!eventArgs.AttackWith.TryGetComponent<ToolComponent>(out var tool))
|
||||
return false;
|
||||
if (tool.Behavior != Tool.Screwdriver)
|
||||
if (!tool.UseTool(eventArgs.User, Owner, ToolQuality.Screwing))
|
||||
return false;
|
||||
|
||||
IsPanelOpen = !IsPanelOpen;
|
||||
IoCManager.Resolve<IEntitySystemManager>()
|
||||
.GetEntitySystem<AudioSystem>()
|
||||
.Play(IsPanelOpen ? "/Audio/machines/screwdriveropen.ogg" : "/Audio/machines/screwdriverclose.ogg");
|
||||
.Play(IsPanelOpen ? "/Audio/machines/screwdriveropen.ogg" : "/Audio/machines/screwdriverclose.ogg", Owner);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user