Merge pull request #865 from Zumorica/2020-04-28-tool-component
Tool refactor, multi tools
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Client.GameObjects.Components.Construction;
|
||||
using Content.Shared.Construction;
|
||||
using Content.Shared.GameObjects.Components.Interactable;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Interfaces.Placement;
|
||||
using Robust.Client.Interfaces.ResourceManagement;
|
||||
@@ -180,27 +181,27 @@ namespace Content.Client.Construction
|
||||
|
||||
break;
|
||||
case ConstructionStepTool tool:
|
||||
switch (tool.Tool)
|
||||
switch (tool.ToolQuality)
|
||||
{
|
||||
case ConstructionStepTool.ToolType.Wrench:
|
||||
case ToolQuality.Anchoring:
|
||||
icon = ResourceCache.GetResource<TextureResource>("/Textures/Objects/Tools/wrench.png");
|
||||
text = "Wrench";
|
||||
break;
|
||||
case ConstructionStepTool.ToolType.Crowbar:
|
||||
case ToolQuality.Prying:
|
||||
icon = ResourceCache.GetResource<TextureResource>("/Textures/Objects/Tools/crowbar.png");
|
||||
text = "Crowbar";
|
||||
break;
|
||||
case ConstructionStepTool.ToolType.Screwdriver:
|
||||
case ToolQuality.Screwing:
|
||||
icon = ResourceCache.GetResource<TextureResource>(
|
||||
"/Textures/Objects/Tools/screwdriver.png");
|
||||
text = "Screwdriver";
|
||||
break;
|
||||
case ConstructionStepTool.ToolType.Welder:
|
||||
case ToolQuality.Welding:
|
||||
icon = ResourceCache.GetResource<RSIResource>("/Textures/Objects/tools.rsi")
|
||||
.RSI["welder"].Frame0;
|
||||
text = $"Welding tool ({tool.Amount} fuel)";
|
||||
break;
|
||||
case ConstructionStepTool.ToolType.Wirecutters:
|
||||
case ToolQuality.Cutting:
|
||||
icon = ResourceCache.GetResource<TextureResource>(
|
||||
"/Textures/Objects/Tools/wirecutter.png");
|
||||
text = "Wirecutters";
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
using System;
|
||||
using Content.Client.UserInterface.Stylesheets;
|
||||
using Content.Client.Utility;
|
||||
using Content.Shared.GameObjects;
|
||||
using Content.Shared.GameObjects.Components.Interactable;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Interactable
|
||||
{
|
||||
[RegisterComponent]
|
||||
public class MultiToolComponent : Component, IItemStatus
|
||||
{
|
||||
private ToolQuality _behavior;
|
||||
private bool _statusShowBehavior;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)] private bool _uiUpdateNeeded;
|
||||
[ViewVariables] public bool StatusShowBehavior => _statusShowBehavior;
|
||||
[ViewVariables] public ToolQuality Behavior => _behavior;
|
||||
|
||||
public override string Name => "MultiTool";
|
||||
public override uint? NetID => ContentNetIDs.MULTITOOLS;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(ref _statusShowBehavior, "statusShowBehavior", true);
|
||||
}
|
||||
|
||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
||||
{
|
||||
if (!(curState is MultiToolComponentState tool)) return;
|
||||
|
||||
_behavior = tool.Quality;
|
||||
_uiUpdateNeeded = true;
|
||||
|
||||
}
|
||||
|
||||
public Control MakeControl() => new StatusControl(this);
|
||||
|
||||
private sealed class StatusControl : Control
|
||||
{
|
||||
private readonly MultiToolComponent _parent;
|
||||
private readonly RichTextLabel _label;
|
||||
|
||||
public StatusControl(MultiToolComponent parent)
|
||||
{
|
||||
_parent = parent;
|
||||
_label = new RichTextLabel {StyleClasses = {StyleNano.StyleClassItemStatus}};
|
||||
AddChild(_label);
|
||||
|
||||
parent._uiUpdateNeeded = true;
|
||||
}
|
||||
|
||||
protected override void Update(FrameEventArgs args)
|
||||
{
|
||||
base.Update(args);
|
||||
|
||||
if (!_parent._uiUpdateNeeded)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_parent._uiUpdateNeeded = false;
|
||||
|
||||
if(!_parent.StatusShowBehavior)
|
||||
_label.SetMarkup(string.Empty);
|
||||
else
|
||||
_label.SetMarkup(_parent.Behavior.ToString());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,39 +1,44 @@
|
||||
using System;
|
||||
using Content.Client.UserInterface;
|
||||
using System;
|
||||
using Content.Client.UserInterface.Stylesheets;
|
||||
using Content.Client.Utility;
|
||||
using Content.Shared.GameObjects;
|
||||
using Content.Shared.GameObjects.Components;
|
||||
using Content.Shared.GameObjects.Components.Interactable;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Client.GameObjects.Components
|
||||
namespace Content.Client.GameObjects.Components.Interactable
|
||||
{
|
||||
[RegisterComponent]
|
||||
public class WelderComponent : Component, IItemStatus
|
||||
public class WelderComponent : SharedToolComponent, IItemStatus
|
||||
{
|
||||
public override string Name => "Welder";
|
||||
public override uint? NetID => ContentNetIDs.WELDER;
|
||||
|
||||
private ToolQuality _behavior;
|
||||
[ViewVariables(VVAccess.ReadWrite)] private bool _uiUpdateNeeded;
|
||||
[ViewVariables] public float FuelCapacity { get; private set; }
|
||||
[ViewVariables] public float Fuel { get; private set; }
|
||||
[ViewVariables] public bool Activated { get; private set; }
|
||||
[ViewVariables] public override ToolQuality Qualities => _behavior;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)] private bool _uiUpdateNeeded;
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
}
|
||||
|
||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
||||
{
|
||||
if (!(curState is WelderComponentState cast))
|
||||
if (!(curState is WelderComponentState weld))
|
||||
return;
|
||||
|
||||
FuelCapacity = cast.FuelCapacity;
|
||||
Fuel = cast.Fuel;
|
||||
Activated = cast.Activated;
|
||||
|
||||
FuelCapacity = weld.FuelCapacity;
|
||||
Fuel = weld.Fuel;
|
||||
Activated = weld.Activated;
|
||||
_behavior = weld.Quality;
|
||||
_uiUpdateNeeded = true;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Content.Server.GameObjects.Components.Interactable.Tools;
|
||||
using Content.Server.GameObjects.Components.Interactable;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.GameObjects.Components.Interactable;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -12,31 +12,26 @@ using Robust.Shared.Utility;
|
||||
namespace Content.Server.GameObjects.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
public class WrenchableComponent : Component, IInteractUsing
|
||||
public class AnchorableComponent : Component, IInteractUsing
|
||||
{
|
||||
public override string Name => "Wrenchable";
|
||||
private AudioSystem _audioSystem;
|
||||
public override string Name => "Anchorable";
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
_audioSystem = EntitySystem.Get<AudioSystem>();
|
||||
Owner.EnsureComponent<PhysicsComponent>();
|
||||
}
|
||||
|
||||
public bool InteractUsing(InteractUsingEventArgs eventArgs)
|
||||
{
|
||||
if (!eventArgs.Using.HasComponent<WrenchComponent>())
|
||||
{
|
||||
if (!Owner.TryGetComponent(out PhysicsComponent physics)
|
||||
|| !eventArgs.AttackWith.TryGetComponent(out ToolComponent tool))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Owner.TryGetComponent(out PhysicsComponent physics))
|
||||
{
|
||||
if (!tool.UseTool(eventArgs.User, Owner, ToolQuality.Anchoring))
|
||||
return false;
|
||||
}
|
||||
|
||||
physics.Anchored = !physics.Anchored;
|
||||
_audioSystem.Play("/Audio/items/ratchet.ogg", Owner);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,12 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.GameObjects.Components.Interactable.Tools;
|
||||
using Content.Server.GameObjects.Components.Interactable;
|
||||
using Content.Server.GameObjects.Components.Stack;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.Construction;
|
||||
using Content.Shared.GameObjects.Components;
|
||||
using Content.Shared.GameObjects.Components.Interactable;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Server.Interfaces.GameObjects;
|
||||
@@ -64,7 +65,7 @@ namespace Content.Server.GameObjects.Components.Construction
|
||||
|
||||
var stage = Prototype.Stages[Stage];
|
||||
|
||||
if (TryProcessStep(stage.Forward, eventArgs.Using))
|
||||
if (TryProcessStep(stage.Forward, eventArgs.Using, eventArgs.User))
|
||||
{
|
||||
Stage++;
|
||||
if (Stage == Prototype.Stages.Count - 1)
|
||||
@@ -84,7 +85,7 @@ namespace Content.Server.GameObjects.Components.Construction
|
||||
}
|
||||
}
|
||||
|
||||
else if (TryProcessStep(stage.Backward, eventArgs.Using))
|
||||
else if (TryProcessStep(stage.Backward, eventArgs.Using, eventArgs.User))
|
||||
{
|
||||
Stage--;
|
||||
if (Stage == 0)
|
||||
@@ -120,7 +121,7 @@ namespace Content.Server.GameObjects.Components.Construction
|
||||
|
||||
}
|
||||
|
||||
bool TryProcessStep(ConstructionStep step, IEntity slapped)
|
||||
bool TryProcessStep(ConstructionStep step, IEntity slapped, IEntity user)
|
||||
{
|
||||
if (step == null)
|
||||
{
|
||||
@@ -143,52 +144,16 @@ namespace Content.Server.GameObjects.Components.Construction
|
||||
sound.Play("/Audio/items/deconstruct.ogg", Transform.GridPosition);
|
||||
return true;
|
||||
case ConstructionStepTool toolStep:
|
||||
switch (toolStep.Tool)
|
||||
{
|
||||
case ToolType.Crowbar:
|
||||
if (slapped.HasComponent<CrowbarComponent>())
|
||||
{
|
||||
sound.Play("/Audio/items/crowbar.ogg", Transform.GridPosition);
|
||||
return true;
|
||||
}
|
||||
if (!slapped.TryGetComponent<ToolComponent>(out var tool))
|
||||
return false;
|
||||
case ToolType.Welder:
|
||||
if (slapped.TryGetComponent(out WelderComponent welder) && welder.TryUse(toolStep.Amount))
|
||||
{
|
||||
if (_random.NextDouble() > 0.5)
|
||||
sound.Play("/Audio/items/welder.ogg", Transform.GridPosition);
|
||||
else
|
||||
sound.Play("/Audio/items/welder2.ogg", Transform.GridPosition);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case ToolType.Wrench:
|
||||
if (slapped.HasComponent<WrenchComponent>())
|
||||
{
|
||||
sound.Play("/Audio/items/ratchet.ogg", Transform.GridPosition);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case ToolType.Screwdriver:
|
||||
if (slapped.HasComponent<ScrewdriverComponent>())
|
||||
{
|
||||
if (_random.NextDouble() > 0.5)
|
||||
sound.Play("/Audio/items/screwdriver.ogg", Transform.GridPosition);
|
||||
else
|
||||
sound.Play("/Audio/items/screwdriver2.ogg", Transform.GridPosition);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case ToolType.Wirecutters:
|
||||
if (slapped.HasComponent<WirecutterComponent>())
|
||||
{
|
||||
sound.Play("/Audio/items/wirecutter.ogg", Transform.GridPosition);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
default:
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
// 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();
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using Content.Server.GameObjects.Components.Interactable.Tools;
|
||||
using Content.Server.GameObjects.Components.Interactable;
|
||||
using Content.Server.GameObjects.Components.Power;
|
||||
using Content.Server.GameObjects.Components.VendingMachines;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.GameObjects.Components.Doors;
|
||||
using Content.Shared.GameObjects.Components.Interactable;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -201,8 +202,11 @@ namespace Content.Server.GameObjects.Components.Doors
|
||||
|
||||
public bool InteractUsing(InteractUsingEventArgs eventArgs)
|
||||
{
|
||||
if (eventArgs.Using.HasComponent<CrowbarComponent>())
|
||||
{
|
||||
if (!eventArgs.AttackWith.TryGetComponent<ToolComponent>(out var tool))
|
||||
return false;
|
||||
|
||||
if (!tool.UseTool(eventArgs.User, Owner, ToolQuality.Prying)) return false;
|
||||
|
||||
if (IsPowered())
|
||||
{
|
||||
var notify = IoCManager.Resolve<IServerNotifyManager>();
|
||||
@@ -211,17 +215,12 @@ namespace Content.Server.GameObjects.Components.Doors
|
||||
}
|
||||
|
||||
if (State == DoorState.Closed)
|
||||
{
|
||||
Open();
|
||||
}
|
||||
else if(State == DoorState.Open)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
using Content.Server.GameObjects.Components.Damage;
|
||||
using Content.Server.GameObjects.Components.Interactable.Tools;
|
||||
using Content.Server.GameObjects.Components.Interactable;
|
||||
using Content.Server.GameObjects.Components.Power;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Server.Utility;
|
||||
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;
|
||||
@@ -103,27 +104,24 @@ namespace Content.Server.GameObjects.Components.Gravity
|
||||
|
||||
public bool InteractUsing(InteractUsingEventArgs eventArgs)
|
||||
{
|
||||
if (!eventArgs.Using.TryGetComponent<WelderComponent>(out var welder)) return false;
|
||||
if (!eventArgs.Using.TryGetComponent(out WelderComponent tool))
|
||||
return false;
|
||||
|
||||
if (!tool.UseTool(eventArgs.User, Owner, ToolQuality.Welding, 5f))
|
||||
return false;
|
||||
|
||||
if (welder.TryUse(5.0f))
|
||||
{
|
||||
// Repair generator
|
||||
var damagable = Owner.GetComponent<DamageableComponent>();
|
||||
var damageable = Owner.GetComponent<DamageableComponent>();
|
||||
var breakable = Owner.GetComponent<BreakableComponent>();
|
||||
damagable.HealAllDamage();
|
||||
damageable.HealAllDamage();
|
||||
breakable.broken = false;
|
||||
_intact = true;
|
||||
|
||||
var notifyManager = IoCManager.Resolve<IServerNotifyManager>();
|
||||
|
||||
EntitySystem.Get<AudioSystem>().Play("/Audio/items/welder2.ogg", Owner);
|
||||
notifyManager.PopupMessage(Owner, eventArgs.User, Loc.GetString("You repair the gravity generator with the welder"));
|
||||
|
||||
return true;
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnBreak(BreakageEventArgs eventArgs)
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
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;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Serialization;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Interactable
|
||||
{
|
||||
/// <summary>
|
||||
/// Not to be confused with Multitool (power)
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public class MultiToolComponent : Component, IUse
|
||||
{
|
||||
public class ToolEntry : IExposeData
|
||||
{
|
||||
private string _state;
|
||||
private string _sound;
|
||||
private string _soundCollection;
|
||||
private string _texture;
|
||||
private string _sprite;
|
||||
private string _changeSound;
|
||||
|
||||
public ToolQuality Behavior { get; private set; }
|
||||
public string State => _state;
|
||||
public string Texture => _texture;
|
||||
public string Sprite => _sprite;
|
||||
public string Sound => _sound;
|
||||
public string SoundCollection => _soundCollection;
|
||||
public string ChangeSound => _changeSound;
|
||||
|
||||
public void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
serializer.DataField(this, x => Behavior, "behavior", ToolQuality.None);
|
||||
serializer.DataField(ref _state, "state", string.Empty);
|
||||
serializer.DataField(ref _sprite, "sprite", string.Empty);
|
||||
serializer.DataField(ref _texture, "texture", string.Empty);
|
||||
serializer.DataField(ref _sound, "useSound", string.Empty);
|
||||
serializer.DataField(ref _soundCollection, "useSoundCollection", string.Empty);
|
||||
serializer.DataField(ref _changeSound, "changeSound", string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma warning disable 649
|
||||
[Dependency] private IEntitySystemManager _entitySystemManager;
|
||||
#pragma warning restore 649
|
||||
|
||||
public override string Name => "MultiTool";
|
||||
public override uint? NetID => ContentNetIDs.MULTITOOLS;
|
||||
private List<ToolEntry> _tools;
|
||||
private int _currentTool = 0;
|
||||
|
||||
private AudioSystem _audioSystem;
|
||||
private ToolComponent _tool;
|
||||
private SpriteComponent _sprite;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
Owner.TryGetComponent(out _tool);
|
||||
Owner.TryGetComponent(out _sprite);
|
||||
|
||||
_audioSystem = _entitySystemManager.GetEntitySystem<AudioSystem>();
|
||||
|
||||
SetTool();
|
||||
}
|
||||
|
||||
public void Cycle()
|
||||
{
|
||||
_currentTool = (_currentTool + 1) % _tools.Count;
|
||||
SetTool();
|
||||
var current = _tools[_currentTool];
|
||||
if(!string.IsNullOrEmpty(current.ChangeSound))
|
||||
_audioSystem.Play(current.ChangeSound, Owner);
|
||||
}
|
||||
|
||||
private void SetTool()
|
||||
{
|
||||
if (_tool == null) return;
|
||||
|
||||
var current = _tools[_currentTool];
|
||||
|
||||
_tool.UseSound = current.Sound;
|
||||
_tool.UseSoundCollection = current.SoundCollection;
|
||||
_tool.Qualities = current.Behavior;
|
||||
|
||||
if (_sprite == null) return;
|
||||
|
||||
if (string.IsNullOrEmpty(current.Texture))
|
||||
if (!string.IsNullOrEmpty(current.Sprite))
|
||||
_sprite.LayerSetState(0, current.State, current.Sprite);
|
||||
else
|
||||
_sprite.LayerSetState(0, current.State);
|
||||
else
|
||||
_sprite.LayerSetTexture(0, current.Texture);
|
||||
|
||||
Dirty();
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(ref _tools, "tools", new List<ToolEntry>());
|
||||
}
|
||||
|
||||
public bool UseEntity(UseEntityEventArgs eventArgs)
|
||||
{
|
||||
Cycle();
|
||||
return true;
|
||||
}
|
||||
|
||||
public override ComponentState GetComponentState()
|
||||
{
|
||||
return new MultiToolComponentState(_tool.Qualities);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.GameObjects.Components.Interactable;
|
||||
using Content.Shared.Maps;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Interactable
|
||||
{
|
||||
[RegisterComponent]
|
||||
public class TilePryingComponent : Component, IAfterAttack
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private IEntitySystemManager _entitySystemManager;
|
||||
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager;
|
||||
[Dependency] private readonly IMapManager _mapManager;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager;
|
||||
[Dependency] private readonly IRobustRandom _robustRandom;
|
||||
#pragma warning restore 649
|
||||
|
||||
public override string Name => "TilePrying";
|
||||
private bool _toolComponentNeeded = true;
|
||||
|
||||
public void AfterAttack(AfterAttackEventArgs eventArgs)
|
||||
{
|
||||
TryPryTile(eventArgs.User, eventArgs.ClickLocation);
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(ref _toolComponentNeeded, "toolComponentNeeded", true);
|
||||
}
|
||||
|
||||
public void TryPryTile(IEntity user, GridCoordinates clickLocation)
|
||||
{
|
||||
if (!Owner.TryGetComponent<ToolComponent>(out var tool) && _toolComponentNeeded)
|
||||
return;
|
||||
|
||||
var mapGrid = _mapManager.GetGrid(clickLocation.GridID);
|
||||
var tile = mapGrid.GetTileRef(clickLocation);
|
||||
|
||||
var coordinates = mapGrid.GridTileToLocal(tile.GridIndices);
|
||||
|
||||
if (!_entitySystemManager.GetEntitySystem<InteractionSystem>().InRangeUnobstructed(user.Transform.MapPosition, coordinates.ToMapPos(_mapManager), ignoredEnt:user))
|
||||
return;
|
||||
|
||||
var tileDef = (ContentTileDefinition)_tileDefinitionManager[tile.Tile.TypeId];
|
||||
|
||||
if (!tileDef.CanCrowbar) return;
|
||||
|
||||
if (_toolComponentNeeded && !tool.UseTool(user, null, ToolQuality.Prying))
|
||||
return;
|
||||
|
||||
var underplating = _tileDefinitionManager["underplating"];
|
||||
mapGrid.SetTile(clickLocation, new Tile(underplating.TileId));
|
||||
|
||||
//Actually spawn the relevant tile item at the right position and give it some offset to the corner.
|
||||
var tileItem = Owner.EntityManager.SpawnEntity(tileDef.ItemDropPrototypeName, coordinates);
|
||||
tileItem.Transform.WorldPosition += (0.2f, 0.2f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
// Only unused on .NET Core due to KeyValuePair.Deconstruct
|
||||
// ReSharper disable once RedundantUsingDirective
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection.Metadata.Ecma335;
|
||||
using Content.Server.GameObjects.Components.Chemistry;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.GameObjects;
|
||||
using Content.Shared.GameObjects.Components;
|
||||
using Content.Shared.GameObjects.Components.Interactable;
|
||||
using Content.Shared.Maps;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Interactable
|
||||
{
|
||||
[RegisterComponent]
|
||||
public class ToolComponent : SharedToolComponent
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private IEntitySystemManager _entitySystemManager;
|
||||
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager;
|
||||
[Dependency] private readonly IMapManager _mapManager;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager;
|
||||
[Dependency] private readonly IRobustRandom _robustRandom;
|
||||
#pragma warning restore 649
|
||||
|
||||
private AudioSystem _audioSystem;
|
||||
private InteractionSystem _interactionSystem;
|
||||
private SpriteComponent _spriteComponent;
|
||||
|
||||
protected ToolQuality _qualities = ToolQuality.Anchoring;
|
||||
|
||||
[ViewVariables]
|
||||
public override ToolQuality Qualities
|
||||
{
|
||||
get => _qualities;
|
||||
set
|
||||
{
|
||||
_qualities = value;
|
||||
Dirty();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// For tool interactions that have a delay before action this will modify the rate, time to wait is divided by this value
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float SpeedModifier { get; set; } = 1;
|
||||
|
||||
public string UseSound { get; set; }
|
||||
|
||||
public string UseSoundCollection { get; set; }
|
||||
|
||||
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();
|
||||
|
||||
_audioSystem = _entitySystemManager.GetEntitySystem<AudioSystem>();
|
||||
_interactionSystem = _entitySystemManager.GetEntitySystem<InteractionSystem>();
|
||||
Owner.TryGetComponent(out _spriteComponent);
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
if (serializer.Reading)
|
||||
{
|
||||
var qualities = serializer.ReadDataField("qualities", new List<ToolQuality>());
|
||||
foreach (var quality in qualities)
|
||||
{
|
||||
AddQuality(quality);
|
||||
}
|
||||
}
|
||||
serializer.DataField(this, mod => SpeedModifier, "speed", 1);
|
||||
serializer.DataField(this, use => UseSound, "useSound", string.Empty);
|
||||
serializer.DataField(this, collection => UseSoundCollection, "useSoundCollection", string.Empty);
|
||||
}
|
||||
|
||||
public virtual bool UseTool(IEntity user, IEntity target, ToolQuality toolQualityNeeded)
|
||||
{
|
||||
if (!HasQuality(toolQualityNeeded) || !ActionBlockerSystem.CanInteract(user))
|
||||
return false;
|
||||
|
||||
PlayUseSound();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void PlaySoundCollection(string name, float volume=-5f)
|
||||
{
|
||||
var soundCollection = _prototypeManager.Index<SoundCollectionPrototype>(name);
|
||||
var file = _robustRandom.Pick(soundCollection.PickFiles);
|
||||
_entitySystemManager.GetEntitySystem<AudioSystem>()
|
||||
.Play(file, Owner, AudioHelpers.WithVariation(0.15f).WithVolume(volume));
|
||||
}
|
||||
|
||||
public void PlayUseSound(float volume=-5f)
|
||||
{
|
||||
if(string.IsNullOrEmpty(UseSoundCollection))
|
||||
_audioSystem.Play(UseSound, Owner, AudioHelpers.WithVariation(0.15f).WithVolume(volume));
|
||||
else
|
||||
PlaySoundCollection(UseSoundCollection, volume);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
// Only unused on .NET Core due to KeyValuePair.Deconstruct
|
||||
// ReSharper disable once RedundantUsingDirective
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Interactable.Tools
|
||||
{
|
||||
public abstract class ToolComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// For tool interactions that have a delay before action this will modify the rate, time to wait is divided by this value
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float SpeedModifier
|
||||
{
|
||||
get => _speedModifier;
|
||||
set => _speedModifier = value;
|
||||
}
|
||||
private float _speedModifier = 1;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref _speedModifier, "Speed", 1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Status modifier which determines whether or not we can act as a tool at this time
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool CanUse()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.Maps;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Interactable.Tools
|
||||
{
|
||||
[RegisterComponent]
|
||||
public class CrowbarComponent : ToolComponent, IAfterInteract
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager;
|
||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
|
||||
[Dependency] private readonly IMapManager _mapManager;
|
||||
#pragma warning restore 649
|
||||
|
||||
/// <summary>
|
||||
/// Tool that can be used to crowbar things apart, such as deconstructing
|
||||
/// </summary>
|
||||
public override string Name => "Crowbar";
|
||||
|
||||
public void AfterInteract(AfterInteractEventArgs eventArgs)
|
||||
{
|
||||
if (!InteractionChecks.InRangeUnobstructed(eventArgs)) return;
|
||||
|
||||
var mapGrid = _mapManager.GetGrid(eventArgs.ClickLocation.GridID);
|
||||
var tile = mapGrid.GetTileRef(eventArgs.ClickLocation);
|
||||
var coordinates = mapGrid.GridTileToLocal(tile.GridIndices);
|
||||
var tileDef = (ContentTileDefinition)_tileDefinitionManager[tile.Tile.TypeId];
|
||||
if (tileDef.CanCrowbar)
|
||||
{
|
||||
var underplating = _tileDefinitionManager["underplating"];
|
||||
mapGrid.SetTile(eventArgs.ClickLocation, new Tile(underplating.TileId));
|
||||
_entitySystemManager.GetEntitySystem<AudioSystem>().Play("/Audio/items/crowbar.ogg", Owner);
|
||||
//Actually spawn the relevant tile item at the right position and give it some offset to the corner.
|
||||
var tileItem = Owner.EntityManager.SpawnEntity(tileDef.ItemDropPrototypeName, coordinates);
|
||||
tileItem.Transform.WorldPosition += (0.2f, 0.2f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Interactable.Tools
|
||||
{
|
||||
/// <summary>
|
||||
/// Tool used for interfacing/hacking into configurable computers
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public class MultitoolComponent : ToolComponent
|
||||
{
|
||||
public override string Name => "Multitool";
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Interactable.Tools
|
||||
{
|
||||
[RegisterComponent]
|
||||
public class ScrewdriverComponent : ToolComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Tool that interacts with technical components that need to be screwed in
|
||||
/// </summary>
|
||||
public override string Name => "Screwdriver";
|
||||
}
|
||||
}
|
||||
@@ -1,217 +0,0 @@
|
||||
using System;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.GameObjects;
|
||||
using Content.Shared.GameObjects.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Interactable.Tools
|
||||
{
|
||||
/// <summary>
|
||||
/// Tool used to weld metal together, light things on fire, or melt into constituent parts
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
class WelderComponent : ToolComponent, IUse, IExamine
|
||||
{
|
||||
SpriteComponent spriteComponent;
|
||||
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager;
|
||||
[Dependency] private readonly IRobustRandom _robustRandom;
|
||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
|
||||
#pragma warning restore 649
|
||||
|
||||
public override string Name => "Welder";
|
||||
public override uint? NetID => ContentNetIDs.WELDER;
|
||||
|
||||
/// <summary>
|
||||
/// Maximum fuel capacity the welder can hold
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float FuelCapacity
|
||||
{
|
||||
get => _fuelCapacity;
|
||||
set
|
||||
{
|
||||
_fuelCapacity = value;
|
||||
Dirty();
|
||||
}
|
||||
}
|
||||
|
||||
private float _fuelCapacity = 50;
|
||||
|
||||
/// <summary>
|
||||
/// Fuel the welder has to do tasks
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float Fuel
|
||||
{
|
||||
get => _fuel;
|
||||
set
|
||||
{
|
||||
_fuel = value;
|
||||
Dirty();
|
||||
}
|
||||
}
|
||||
|
||||
private float _fuel = 0;
|
||||
private bool _activated = false;
|
||||
|
||||
/// <summary>
|
||||
/// Default Cost of using the welder fuel for an action
|
||||
/// </summary>
|
||||
public const float DefaultFuelCost = 5;
|
||||
|
||||
/// <summary>
|
||||
/// Rate at which we expunge fuel from ourselves when activated
|
||||
/// </summary>
|
||||
public const float FuelLossRate = 0.2f;
|
||||
|
||||
/// <summary>
|
||||
/// Status of welder, whether it is ignited
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public bool Activated
|
||||
{
|
||||
get => _activated;
|
||||
private set
|
||||
{
|
||||
_activated = value;
|
||||
Dirty();
|
||||
}
|
||||
}
|
||||
|
||||
//private string OnSprite { get; set; }
|
||||
//private string OffSprite { get; set; }
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
spriteComponent = Owner.GetComponent<SpriteComponent>();
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref _fuelCapacity, "Capacity", 50);
|
||||
serializer.DataField(ref _fuel, "Fuel", FuelCapacity);
|
||||
serializer.DataField(ref _activated, "Activated", false);
|
||||
}
|
||||
|
||||
public void OnUpdate(float frameTime)
|
||||
{
|
||||
if (!Activated)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Fuel = Math.Max(Fuel - (FuelLossRate * frameTime), 0);
|
||||
|
||||
if (Fuel == 0)
|
||||
{
|
||||
ToggleStatus();
|
||||
}
|
||||
}
|
||||
|
||||
public bool TryUse(float value)
|
||||
{
|
||||
if (!Activated || !CanUse(value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Fuel -= value;
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CanUse(float value)
|
||||
{
|
||||
return Fuel > value;
|
||||
}
|
||||
|
||||
public override bool CanUse()
|
||||
{
|
||||
return CanUse(DefaultFuelCost);
|
||||
}
|
||||
|
||||
public bool CanActivate()
|
||||
{
|
||||
return Fuel > 0;
|
||||
}
|
||||
|
||||
public bool UseEntity(UseEntityEventArgs eventArgs)
|
||||
{
|
||||
return ToggleStatus();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deactivates welding tool if active, activates welding tool if possible
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool ToggleStatus()
|
||||
{
|
||||
if (Activated)
|
||||
{
|
||||
Activated = false;
|
||||
// Layer 1 is the flame.
|
||||
spriteComponent.LayerSetVisible(1, false);
|
||||
PlaySoundCollection("welder_off", -5);
|
||||
return true;
|
||||
}
|
||||
else if (CanActivate())
|
||||
{
|
||||
Activated = true;
|
||||
spriteComponent.LayerSetVisible(1, true);
|
||||
PlaySoundCollection("welder_on", -5);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void IExamine.Examine(FormattedMessage message)
|
||||
{
|
||||
var loc = IoCManager.Resolve<ILocalizationManager>();
|
||||
if (Activated)
|
||||
{
|
||||
message.AddMarkup(loc.GetString("[color=orange]Lit[/color]\n"));
|
||||
}
|
||||
else
|
||||
{
|
||||
message.AddText(loc.GetString("Not lit\n"));
|
||||
}
|
||||
|
||||
message.AddMarkup(loc.GetString("Fuel: [color={0}]{1}/{2}[/color].",
|
||||
Fuel < FuelCapacity / 4f ? "darkorange" : "orange", Math.Round(Fuel), FuelCapacity));
|
||||
}
|
||||
|
||||
private void PlaySoundCollection(string name, float volume)
|
||||
{
|
||||
var soundCollection = _prototypeManager.Index<SoundCollectionPrototype>(name);
|
||||
var file = _robustRandom.Pick(soundCollection.PickFiles);
|
||||
_entitySystemManager.GetEntitySystem<AudioSystem>()
|
||||
.Play(file, AudioParams.Default.WithVolume(volume));
|
||||
}
|
||||
|
||||
public override ComponentState GetComponentState()
|
||||
{
|
||||
return new WelderComponentState(FuelCapacity, Fuel, Activated);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Interactable.Tools
|
||||
{
|
||||
/// <summary>
|
||||
/// Tool that can be used for some cutting interactions such as wires or hacking
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public class WirecutterComponent : ToolComponent
|
||||
{
|
||||
public override string Name => "Wirecutter";
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Interactable.Tools
|
||||
{
|
||||
/// <summary>
|
||||
/// Wrenches bolts, and interacts with things that have been bolted
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public class WrenchComponent : ToolComponent
|
||||
{
|
||||
public override string Name => "Wrench";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
using System;
|
||||
using Content.Server.GameObjects.Components.Chemistry;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.GameObjects;
|
||||
using Content.Shared.GameObjects.Components.Interactable;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Interactable
|
||||
{
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(ToolComponent))]
|
||||
public class WelderComponent : ToolComponent, IExamine, IUse
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private IEntitySystemManager _entitySystemManager;
|
||||
[Dependency] private IServerNotifyManager _notifyManager;
|
||||
#pragma warning restore 649
|
||||
|
||||
public override string Name => "Welder";
|
||||
public override uint? NetID => ContentNetIDs.WELDER;
|
||||
|
||||
/// <summary>
|
||||
/// Default Cost of using the welder fuel for an action
|
||||
/// </summary>
|
||||
public const float DefaultFuelCost = 10;
|
||||
|
||||
/// <summary>
|
||||
/// Rate at which we expunge fuel from ourselves when activated
|
||||
/// </summary>
|
||||
public const float FuelLossRate = 0.5f;
|
||||
|
||||
private bool _welderLit = false;
|
||||
private WelderSystem _welderSystem;
|
||||
private SpriteComponent _spriteComponent;
|
||||
private SolutionComponent _solutionComponent;
|
||||
|
||||
[ViewVariables]
|
||||
public float Fuel => _solutionComponent?.Solution.GetReagentQuantity("chem.WeldingFuel").Float() ?? 0f;
|
||||
|
||||
[ViewVariables]
|
||||
public float FuelCapacity => _solutionComponent?.MaxVolume.Float() ?? 0f;
|
||||
|
||||
/// <summary>
|
||||
/// Status of welder, whether it is ignited
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public bool WelderLit
|
||||
{
|
||||
get => _welderLit;
|
||||
private set
|
||||
{
|
||||
_welderLit = value;
|
||||
Dirty();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
AddQuality(ToolQuality.Welding);
|
||||
|
||||
_welderSystem = _entitySystemManager.GetEntitySystem<WelderSystem>();
|
||||
|
||||
Owner.TryGetComponent(out _solutionComponent);
|
||||
Owner.TryGetComponent(out _spriteComponent);
|
||||
}
|
||||
|
||||
public override ComponentState GetComponentState()
|
||||
{
|
||||
return new WelderComponentState(FuelCapacity, Fuel, WelderLit);
|
||||
}
|
||||
|
||||
public override bool UseTool(IEntity user, IEntity target, ToolQuality toolQualityNeeded)
|
||||
{
|
||||
var canUse = base.UseTool(user, target, toolQualityNeeded);
|
||||
|
||||
return toolQualityNeeded.HasFlag(ToolQuality.Welding) ? canUse && TryWeld(DefaultFuelCost, user) : canUse;
|
||||
}
|
||||
|
||||
public bool UseTool(IEntity user, IEntity target, ToolQuality toolQualityNeeded, float fuelConsumed)
|
||||
{
|
||||
return base.UseTool(user, target, toolQualityNeeded) && TryWeld(fuelConsumed, user);
|
||||
}
|
||||
|
||||
private bool TryWeld(float value, IEntity user = null)
|
||||
{
|
||||
if (!WelderLit)
|
||||
{
|
||||
_notifyManager.PopupMessage(Owner, user, Loc.GetString("The welder is turned off!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!CanWeld(value))
|
||||
{
|
||||
_notifyManager.PopupMessage(Owner, user, Loc.GetString("The welder does not have enough fuel for that!"));
|
||||
}
|
||||
|
||||
if (_solutionComponent == null)
|
||||
return false;
|
||||
|
||||
return _solutionComponent.TryRemoveReagent("chem.WeldingFuel", ReagentUnit.New(value));
|
||||
}
|
||||
|
||||
private bool CanWeld(float value)
|
||||
{
|
||||
return Fuel > value || Qualities != ToolQuality.Welding;
|
||||
}
|
||||
|
||||
private bool CanLitWelder()
|
||||
{
|
||||
return Fuel > 0 || Qualities != ToolQuality.Welding;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deactivates welding tool if active, activates welding tool if possible
|
||||
/// </summary>
|
||||
private bool ToggleWelderStatus(IEntity user = null)
|
||||
{
|
||||
if (WelderLit)
|
||||
{
|
||||
WelderLit = false;
|
||||
// Layer 1 is the flame.
|
||||
_spriteComponent.LayerSetVisible(1, false);
|
||||
PlaySoundCollection("WelderOff", -5);
|
||||
_welderSystem.Unsubscribe(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!CanLitWelder())
|
||||
{
|
||||
_notifyManager.PopupMessage(Owner, user, Loc.GetString("The welder has no fuel left!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
WelderLit = true;
|
||||
_spriteComponent.LayerSetVisible(1, true);
|
||||
PlaySoundCollection("WelderOn", -5);
|
||||
_welderSystem.Subscribe(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool UseEntity(UseEntityEventArgs eventArgs)
|
||||
{
|
||||
return ToggleWelderStatus(eventArgs.User);
|
||||
}
|
||||
|
||||
public void Examine(FormattedMessage message)
|
||||
{
|
||||
if (WelderLit)
|
||||
{
|
||||
message.AddMarkup(Loc.GetString("[color=orange]Lit[/color]\n"));
|
||||
}
|
||||
else
|
||||
{
|
||||
message.AddText(Loc.GetString("Not lit\n"));
|
||||
}
|
||||
|
||||
message.AddMarkup(Loc.GetString("Fuel: [color={0}]{1}/{2}[/color].",
|
||||
Fuel < FuelCapacity / 4f ? "darkorange" : "orange", Math.Round(Fuel), FuelCapacity));
|
||||
}
|
||||
|
||||
public void OnUpdate(float frameTime)
|
||||
{
|
||||
if (!HasQuality(ToolQuality.Welding) || !WelderLit)
|
||||
return;
|
||||
|
||||
_solutionComponent.TryRemoveReagent("chem.WeldingFuel", ReagentUnit.New(FuelLossRate * frameTime));
|
||||
|
||||
if (Fuel == 0)
|
||||
ToggleWelderStatus();
|
||||
|
||||
Dirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
using System.Linq;
|
||||
using Content.Server.GameObjects.Components.Interactable.Tools;
|
||||
using Content.Server.GameObjects.Components.Interactable;
|
||||
using Content.Server.GameObjects.Components.Stack;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.GameObjects.Components.Interactable;
|
||||
using Content.Server.Utility;
|
||||
using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -141,8 +142,9 @@ namespace Content.Server.GameObjects.Components.Power
|
||||
|
||||
public bool InteractUsing(InteractUsingEventArgs eventArgs)
|
||||
{
|
||||
if (eventArgs.Using.TryGetComponent(out WirecutterComponent wirecutter))
|
||||
{
|
||||
if (!eventArgs.Using.TryGetComponent(out ToolComponent tool)) return false;
|
||||
if (!tool.UseTool(eventArgs.User, Owner, ToolQuality.Cutting)) return false;
|
||||
|
||||
Owner.Delete();
|
||||
var droppedEnt = Owner.EntityManager.SpawnEntity("CableStack", eventArgs.ClickLocation);
|
||||
|
||||
@@ -151,7 +153,5 @@ namespace Content.Server.GameObjects.Components.Power
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.GameObjects.Components.Interactable.Tools;
|
||||
using Content.Server.GameObjects.Components.Interactable;
|
||||
using Content.Server.GameObjects.Components.VendingMachines;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Server.Interfaces.GameObjects;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.GameObjects.Components;
|
||||
using Content.Shared.GameObjects.Components.Interactable;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameObjects.Components.UserInterface;
|
||||
@@ -245,30 +246,31 @@ namespace Content.Server.GameObjects.Components
|
||||
}
|
||||
|
||||
var activeHandEntity = handsComponent.GetActiveHand?.Owner;
|
||||
activeHandEntity.TryGetComponent<ToolComponent>(out var tool);
|
||||
switch (msg.Action)
|
||||
{
|
||||
case WiresAction.Cut:
|
||||
if (activeHandEntity?.HasComponent<WirecutterComponent>() != true)
|
||||
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;
|
||||
}
|
||||
_audioSystem.Play("/Audio/items/wirecutter.ogg", Owner);
|
||||
tool.PlayUseSound();
|
||||
wire.IsCut = true;
|
||||
UpdateUserInterface();
|
||||
break;
|
||||
case WiresAction.Mend:
|
||||
if (activeHandEntity?.HasComponent<WirecutterComponent>() != true)
|
||||
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;
|
||||
}
|
||||
_audioSystem.Play("/Audio/items/wirecutter.ogg", Owner);
|
||||
tool.PlayUseSound();
|
||||
wire.IsCut = false;
|
||||
UpdateUserInterface();
|
||||
break;
|
||||
case WiresAction.Pulse:
|
||||
if (activeHandEntity?.HasComponent<MultitoolComponent>() != true)
|
||||
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;
|
||||
@@ -298,14 +300,14 @@ namespace Content.Server.GameObjects.Components
|
||||
|
||||
bool IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
||||
{
|
||||
if (!eventArgs.Using.HasComponent<ScrewdriverComponent>())
|
||||
{
|
||||
if (!eventArgs.Using.TryGetComponent<ToolComponent>(out var tool))
|
||||
return false;
|
||||
if (!tool.UseTool(eventArgs.User, Owner, ToolQuality.Screwing))
|
||||
return false;
|
||||
}
|
||||
|
||||
IsPanelOpen = !IsPanelOpen;
|
||||
EntitySystem.Get<AudioSystem>()
|
||||
.Play(IsPanelOpen ? "/Audio/machines/screwdriveropen.ogg" : "/Audio/machines/screwdriverclose.ogg");
|
||||
.Play(IsPanelOpen ? "/Audio/machines/screwdriveropen.ogg" : "/Audio/machines/screwdriverclose.ogg", Owner);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Content.Server.GameObjects.Components.Interactable;
|
||||
using Content.Server.GameObjects.Components.Mobs;
|
||||
using Content.Server.GameObjects.Components.Timing;
|
||||
using Content.Server.Interfaces.GameObjects;
|
||||
using Content.Shared.GameObjects.Components.Interactable;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.GameObjects.Components.Inventory;
|
||||
using Content.Shared.Input;
|
||||
|
||||
@@ -1,22 +1,32 @@
|
||||
using Content.Server.GameObjects.Components.Interactable.Tools;
|
||||
using Robust.Shared.GameObjects;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.GameObjects.Components.Interactable;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
|
||||
namespace Content.Server.GameObjects.EntitySystems
|
||||
{
|
||||
class WelderSystem : EntitySystem
|
||||
/// <summary>
|
||||
/// Despite the name, it's only really used for the welder logic in tools. Go figure.
|
||||
/// </summary>
|
||||
public class WelderSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
private readonly HashSet<WelderComponent> _activeWelders = new HashSet<WelderComponent>();
|
||||
|
||||
public bool Subscribe(WelderComponent welder)
|
||||
{
|
||||
EntityQuery = new TypeEntityQuery(typeof(WelderComponent));
|
||||
return _activeWelders.Add(welder);
|
||||
}
|
||||
|
||||
public bool Unsubscribe(WelderComponent welder)
|
||||
{
|
||||
return _activeWelders.Remove(welder);
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
foreach (var entity in RelevantEntities)
|
||||
foreach (var tool in _activeWelders.ToArray())
|
||||
{
|
||||
var comp = entity.GetComponent<WelderComponent>();
|
||||
comp.OnUpdate(frameTime);
|
||||
tool.OnUpdate(frameTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ using YamlDotNet.RepresentationModel;
|
||||
|
||||
namespace Content.Shared.Audio
|
||||
{
|
||||
[Prototype("sound_collection")]
|
||||
[Prototype("soundCollection")]
|
||||
public sealed class SoundCollectionPrototype : IPrototype, IIndexedPrototype
|
||||
{
|
||||
public string ID { get; private set; }
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Shared.GameObjects.Components.Interactable;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -138,7 +139,7 @@ namespace Content.Shared.Construction
|
||||
if (step.TryGetNode("tool", out node))
|
||||
{
|
||||
return new ConstructionStepTool(
|
||||
node.AsEnum<ConstructionStepTool.ToolType>(),
|
||||
node.AsEnum<ToolQuality>(),
|
||||
amount
|
||||
);
|
||||
}
|
||||
@@ -190,20 +191,11 @@ namespace Content.Shared.Construction
|
||||
|
||||
public class ConstructionStepTool : ConstructionStep
|
||||
{
|
||||
public readonly ToolType Tool;
|
||||
public readonly ToolQuality ToolQuality;
|
||||
|
||||
public ConstructionStepTool(ToolType tool, int amount) : base(amount)
|
||||
public ConstructionStepTool(ToolQuality toolQuality, int amount) : base(amount)
|
||||
{
|
||||
Tool = tool;
|
||||
}
|
||||
|
||||
public enum ToolType
|
||||
{
|
||||
Wrench,
|
||||
Welder,
|
||||
Screwdriver,
|
||||
Crowbar,
|
||||
Wirecutters,
|
||||
ToolQuality = toolQuality;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Interactable
|
||||
{
|
||||
[Flags]
|
||||
public enum ToolQuality : byte
|
||||
{
|
||||
None = 0,
|
||||
Anchoring = 1,
|
||||
Prying = 1 << 1,
|
||||
Screwing = 1 << 2,
|
||||
Cutting = 1 << 3,
|
||||
Welding = 1 << 4,
|
||||
Multitool = 1 << 5,
|
||||
}
|
||||
|
||||
public class SharedToolComponent : Component
|
||||
{
|
||||
public override string Name => "Tool";
|
||||
|
||||
public virtual ToolQuality Qualities { get; set; }
|
||||
}
|
||||
|
||||
[NetSerializable, Serializable]
|
||||
public class MultiToolComponentState : ComponentState
|
||||
{
|
||||
public ToolQuality Quality { get; }
|
||||
|
||||
public MultiToolComponentState(ToolQuality quality) : base(ContentNetIDs.MULTITOOLS)
|
||||
{
|
||||
Quality = quality;
|
||||
}
|
||||
}
|
||||
|
||||
[NetSerializable, Serializable]
|
||||
public class WelderComponentState : ComponentState
|
||||
{
|
||||
public float FuelCapacity { get; }
|
||||
public float Fuel { get; }
|
||||
public bool Activated { get; }
|
||||
public ToolQuality Quality { get; }
|
||||
|
||||
public WelderComponentState(float fuelCapacity, float fuel, bool activated) : base(ContentNetIDs.WELDER)
|
||||
{
|
||||
FuelCapacity = fuelCapacity;
|
||||
Fuel = fuel;
|
||||
Activated = activated;
|
||||
Quality = ToolQuality.Welding;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components
|
||||
{
|
||||
[NetSerializable, Serializable]
|
||||
public class WelderComponentState : ComponentState
|
||||
{
|
||||
public float FuelCapacity { get; }
|
||||
public float Fuel { get; }
|
||||
public bool Activated { get; }
|
||||
|
||||
public WelderComponentState(float fuelCapacity, float fuel, bool activated) : base(ContentNetIDs.WELDER)
|
||||
{
|
||||
FuelCapacity = fuelCapacity;
|
||||
Fuel = fuel;
|
||||
Activated = activated;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,6 @@
|
||||
public const uint MICROWAVE = 1040;
|
||||
public const uint GRAVITY_GENERATOR = 1041;
|
||||
public const uint SURGERY = 1042;
|
||||
|
||||
public const uint MULTITOOLS = 1043;
|
||||
}
|
||||
}
|
||||
|
||||
BIN
Resources/Audio/items/change_drill.ogg
Normal file
BIN
Resources/Audio/items/change_drill.ogg
Normal file
Binary file not shown.
BIN
Resources/Audio/items/change_jaws.ogg
Normal file
BIN
Resources/Audio/items/change_jaws.ogg
Normal file
Binary file not shown.
BIN
Resources/Audio/items/drill_hit.ogg
Normal file
BIN
Resources/Audio/items/drill_hit.ogg
Normal file
Binary file not shown.
BIN
Resources/Audio/items/drill_use.ogg
Normal file
BIN
Resources/Audio/items/drill_use.ogg
Normal file
Binary file not shown.
BIN
Resources/Audio/items/jaws_cut.ogg
Normal file
BIN
Resources/Audio/items/jaws_cut.ogg
Normal file
Binary file not shown.
BIN
Resources/Audio/items/jaws_pry.ogg
Normal file
BIN
Resources/Audio/items/jaws_pry.ogg
Normal file
Binary file not shown.
@@ -20,7 +20,7 @@
|
||||
- type: Computer
|
||||
- type: PowerDevice
|
||||
priority: High
|
||||
- type: Wrenchable
|
||||
- type: Anchorable
|
||||
|
||||
- type: Sprite
|
||||
sprite: Buildings/computer.rsi
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
- type: PowerDevice
|
||||
priority: Low
|
||||
- type: Wires
|
||||
- type: Wrenchable
|
||||
- type: Anchorable
|
||||
|
||||
- type: entity
|
||||
parent: VendingMachine
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
- type: Appearance
|
||||
visuals:
|
||||
- type: PowerChargerVisualizer2D
|
||||
- type: Wrenchable
|
||||
- type: Anchorable
|
||||
- type: Physics
|
||||
mass: 5
|
||||
- type: Clickable
|
||||
@@ -148,7 +148,7 @@
|
||||
- type: Appearance
|
||||
visuals:
|
||||
- type: PowerChargerVisualizer2D
|
||||
- type: Wrenchable
|
||||
- type: Anchorable
|
||||
- type: Physics
|
||||
mass: 5
|
||||
- type: Clickable
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
id: Wirecutter
|
||||
description: This kills the wire.
|
||||
components:
|
||||
- type: Wirecutter
|
||||
- type: Sprite
|
||||
sprite: Objects/Tools/wirecutters.rsi
|
||||
layers:
|
||||
@@ -15,6 +14,10 @@
|
||||
state: cutters-map
|
||||
- type: ItemCooldown
|
||||
- type: MeleeWeapon
|
||||
- type: Tool
|
||||
qualities:
|
||||
- Cutting
|
||||
useSound: /Audio/items/wirecutter.ogg
|
||||
- type: RandomToolColor
|
||||
state: cutters
|
||||
colors:
|
||||
@@ -32,12 +35,14 @@
|
||||
id: Screwdriver
|
||||
description: Industrial grade torque in a small screwdriving package
|
||||
components:
|
||||
- type: Screwdriver
|
||||
- type: Sprite
|
||||
sprite: Objects/Tools/screwdriver.rsi
|
||||
layers:
|
||||
- state: screwdriver-map
|
||||
- state: screwdriver-screwybits
|
||||
- type: Icon
|
||||
sprite: Objects/Tools/screwdriver.rsi
|
||||
state: screwdriver
|
||||
|
||||
- type: Icon
|
||||
sprite: Objects/Tools/screwdriver.rsi
|
||||
@@ -45,9 +50,12 @@
|
||||
|
||||
- type: Item
|
||||
sprite: Objects/Tools/screwdriver.rsi
|
||||
|
||||
- type: ItemCooldown
|
||||
- type: MeleeWeapon
|
||||
- type: Tool
|
||||
qualities:
|
||||
- Screwing
|
||||
useSoundCollection: Screwdriver
|
||||
- type: RandomToolColor
|
||||
state: screwdriver
|
||||
colors:
|
||||
@@ -59,14 +67,12 @@
|
||||
cyan: "#18a2d5"
|
||||
yellow: "#ffa500"
|
||||
|
||||
|
||||
- type: entity
|
||||
name: Welding Tool
|
||||
parent: BaseItem
|
||||
id: Welder
|
||||
description: Melts anything as long as it's fueled, don't forget your eye protection!
|
||||
components:
|
||||
- type: Welder
|
||||
- type: Sprite
|
||||
sprite: Objects/Tools/welder.rsi
|
||||
layers:
|
||||
@@ -74,13 +80,21 @@
|
||||
- state: welder_flame
|
||||
shader: unshaded
|
||||
visible: false
|
||||
|
||||
- type: Icon
|
||||
sprite: Objects/Tools/welder.rsi
|
||||
state: welder
|
||||
- type: ItemCooldown
|
||||
- type: MeleeWeapon
|
||||
- type: ItemStatus
|
||||
- type: Solution
|
||||
maxVol: 100
|
||||
caps: 9
|
||||
contents:
|
||||
reagents:
|
||||
- ReagentId: chem.WeldingFuel
|
||||
Quantity: 100
|
||||
- type: Welder
|
||||
useSoundCollection: Welder
|
||||
|
||||
- type: entity
|
||||
name: Wrench
|
||||
@@ -88,24 +102,16 @@
|
||||
id: Wrench
|
||||
description: A common tool for assembly and disassembly, righty tighty lefty loosey
|
||||
components:
|
||||
- type: Wrench
|
||||
- type: Sprite
|
||||
texture: Objects/Tools/wrench.png
|
||||
- type: Icon
|
||||
texture: Objects/Tools/wrench.png
|
||||
- type: ItemCooldown
|
||||
- type: MeleeWeapon
|
||||
|
||||
- type: sound_collection
|
||||
id: welder_on
|
||||
files:
|
||||
- /Audio/items/lighter1.ogg
|
||||
- /Audio/items/lighter2.ogg
|
||||
|
||||
- type: sound_collection
|
||||
id: welder_off
|
||||
files:
|
||||
- /Audio/effects/zzzt.ogg
|
||||
- type: Tool
|
||||
qualities:
|
||||
- Anchoring
|
||||
useSound: /Audio/items/ratchet.ogg
|
||||
|
||||
- type: entity
|
||||
name: Crowbar
|
||||
@@ -113,13 +119,17 @@
|
||||
id: Crowbar
|
||||
description: A multipurpose tool to pry open doors and fight interdimensional invaders
|
||||
components:
|
||||
- type: Crowbar
|
||||
- type: Sprite
|
||||
texture: Objects/Tools/crowbar.png
|
||||
- type: Icon
|
||||
texture: Objects/Tools/crowbar.png
|
||||
- type: ItemCooldown
|
||||
- type: MeleeWeapon
|
||||
- type: Tool
|
||||
qualities:
|
||||
- Prying
|
||||
useSound: /Audio/items/crowbar.ogg
|
||||
- type: TilePrying
|
||||
|
||||
- type: entity
|
||||
name: Multitool
|
||||
@@ -127,14 +137,73 @@
|
||||
id: Multitool
|
||||
description: An advanced tool to copy, store, and send electrical pulses and signals through wires and machines
|
||||
components:
|
||||
- type: Multitool
|
||||
- type: Sprite
|
||||
sprite: Objects/Tools/multitool.rsi
|
||||
state: multitool
|
||||
|
||||
- type: Icon
|
||||
sprite: Objects/Tools/multitool.rsi
|
||||
state: multitool
|
||||
|
||||
- type: Item
|
||||
sprite: Objects/Tools/multitool.rsi
|
||||
- type: Tool
|
||||
qualities:
|
||||
- Multitool
|
||||
|
||||
- type: entity
|
||||
name: Jaws of life
|
||||
parent: BaseItem
|
||||
id: JawsOfLife
|
||||
description: A set of jaws of life, compressed through the magic of science.
|
||||
components:
|
||||
- type: Sprite
|
||||
sprite: Objects/Tools/jaws_of_life.rsi
|
||||
state: jaws_pry
|
||||
- type: Icon
|
||||
sprite: Objects/Tools/jaws_of_life.rsi
|
||||
state: jaws_pry
|
||||
- type: Item
|
||||
sprite: Objects/Tools/jaws_of_life.rsi
|
||||
- type: TilePrying
|
||||
- type: Tool
|
||||
qualities:
|
||||
- Prying
|
||||
statusShowBehavior: true
|
||||
- type: MultiTool
|
||||
tools:
|
||||
- behavior: Prying
|
||||
state: jaws_pry
|
||||
useSound: /Audio/items/jaws_pry.ogg
|
||||
changeSound: /Audio/items/change_jaws.ogg
|
||||
- behavior: Cutting
|
||||
state: jaws_cutter
|
||||
useSound: /Audio/items/jaws_cut.ogg
|
||||
changeSound: /Audio/items/change_jaws.ogg
|
||||
|
||||
- type: entity
|
||||
name: Power Drill
|
||||
parent: BaseItem
|
||||
id: PowerDrill
|
||||
description: A simple powered hand drill.
|
||||
components:
|
||||
- type: Sprite
|
||||
sprite: Objects/Tools/drill.rsi
|
||||
state: drill_screw
|
||||
- type: Icon
|
||||
sprite: Objects/Tools/drill.rsi
|
||||
state: drill_screw
|
||||
- type: Item
|
||||
sprite: Objects/Tools/drill.rsi
|
||||
- type: Tool
|
||||
qualities:
|
||||
- Screwing
|
||||
statusShowBehavior: true
|
||||
- type: MultiTool
|
||||
tools:
|
||||
- behavior: Screwing
|
||||
state: drill_screw
|
||||
useSound: /Audio/items/drill_use.ogg
|
||||
changeSound: /Audio/items/change_drill.ogg
|
||||
- behavior: Anchoring
|
||||
state: drill_bolt
|
||||
useSound: /Audio/items/drill_use.ogg
|
||||
changeSound: /Audio/items/change_drill.ogg
|
||||
|
||||
@@ -105,3 +105,9 @@
|
||||
name: Unstable Mutagen
|
||||
desc: Causes mutations when injected into living people or plants. High doses may be lethal, especially in humans.
|
||||
color: "#77b58e"
|
||||
|
||||
- type: reagent
|
||||
id: chem.WeldingFuel
|
||||
name: Welding Fuel
|
||||
desc: Used by welders to weld.
|
||||
color: "#a76b1c"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
- type: sound_collection
|
||||
- type: soundCollection
|
||||
id: dice
|
||||
files:
|
||||
- /Audio/items/dice/dice1.ogg
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
- type: sound_collection
|
||||
- type: soundCollection
|
||||
id: footstep_carpet
|
||||
files:
|
||||
- /Audio/effects/footsteps/carpet1.ogg
|
||||
@@ -7,7 +7,7 @@
|
||||
- /Audio/effects/footsteps/carpet4.ogg
|
||||
- /Audio/effects/footsteps/carpet5.ogg
|
||||
|
||||
- type: sound_collection
|
||||
- type: soundCollection
|
||||
id: footstep_wood
|
||||
files:
|
||||
- /Audio/effects/footsteps/wood1.ogg
|
||||
@@ -16,7 +16,7 @@
|
||||
- /Audio/effects/footsteps/wood4.ogg
|
||||
- /Audio/effects/footsteps/wood5.ogg
|
||||
|
||||
- type: sound_collection
|
||||
- type: soundCollection
|
||||
id: footstep_catwalk
|
||||
files:
|
||||
- /Audio/effects/footsteps/catwalk1.ogg
|
||||
@@ -25,7 +25,7 @@
|
||||
- /Audio/effects/footsteps/catwalk4.ogg
|
||||
- /Audio/effects/footsteps/catwalk5.ogg
|
||||
|
||||
- type: sound_collection
|
||||
- type: soundCollection
|
||||
id: footstep_floor
|
||||
files:
|
||||
- /Audio/effects/footsteps/floor1.ogg
|
||||
@@ -34,7 +34,7 @@
|
||||
- /Audio/effects/footsteps/floor4.ogg
|
||||
- /Audio/effects/footsteps/floor5.ogg
|
||||
|
||||
- type: sound_collection
|
||||
- type: soundCollection
|
||||
id: footstep_hull
|
||||
files:
|
||||
- /Audio/effects/footsteps/hull1.ogg
|
||||
@@ -43,7 +43,7 @@
|
||||
- /Audio/effects/footsteps/hull4.ogg
|
||||
- /Audio/effects/footsteps/hull5.ogg
|
||||
|
||||
- type: sound_collection
|
||||
- type: soundCollection
|
||||
id: footstep_plating
|
||||
files:
|
||||
- /Audio/effects/footsteps/plating1.ogg
|
||||
@@ -52,7 +52,7 @@
|
||||
- /Audio/effects/footsteps/plating4.ogg
|
||||
- /Audio/effects/footsteps/plating5.ogg
|
||||
|
||||
- type: sound_collection
|
||||
- type: soundCollection
|
||||
id: footstep_tile
|
||||
files:
|
||||
- /Audio/effects/footsteps/tile1.ogg
|
||||
@@ -61,19 +61,19 @@
|
||||
- /Audio/effects/footsteps/tile4.ogg
|
||||
- /Audio/effects/footsteps/tile5.ogg
|
||||
|
||||
- type: sound_collection
|
||||
- type: soundCollection
|
||||
id: footstep_clown
|
||||
files:
|
||||
- /Audio/effects/footsteps/clownstep1.ogg
|
||||
- /Audio/effects/footsteps/clownstep2.ogg
|
||||
|
||||
- type: sound_collection
|
||||
- type: soundCollection
|
||||
id: footstep_heavy
|
||||
files:
|
||||
- /Audio/effects/footsteps/suitstep1.ogg
|
||||
- /Audio/effects/footsteps/suitstep2.ogg
|
||||
|
||||
- type: sound_collection
|
||||
- type: soundCollection
|
||||
id: footstep_asteroid
|
||||
files:
|
||||
- /Audio/effects/footsteps/asteroid1.ogg
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
- type: sound_collection
|
||||
- type: soundCollection
|
||||
id: glassbreak
|
||||
files:
|
||||
- /Audio/effects/glassbreak1.ogg
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
- type: sound_collection
|
||||
- type: soundCollection
|
||||
id: keyboard
|
||||
files:
|
||||
- /Audio/machines/keyboard/keyboard1.ogg
|
||||
- /Audio/machines/keyboard/keyboard2.ogg
|
||||
- /Audio/machines/keyboard/keyboard3.ogg
|
||||
- /Audio/machines/keyboard/keyboard4.ogg
|
||||
|
||||
22
Resources/Prototypes/SoundCollections/tools.yml
Normal file
22
Resources/Prototypes/SoundCollections/tools.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
- type: soundCollection
|
||||
id: WelderOn
|
||||
files:
|
||||
- /Audio/items/lighter1.ogg
|
||||
- /Audio/items/lighter2.ogg
|
||||
|
||||
- type: soundCollection
|
||||
id: WelderOff
|
||||
files:
|
||||
- /Audio/effects/zzzt.ogg
|
||||
|
||||
- type: soundCollection
|
||||
id: Welder
|
||||
files:
|
||||
- /Audio/items/welder.ogg
|
||||
- /Audio/items/welder2.ogg
|
||||
|
||||
- type: soundCollection
|
||||
id: Screwdriver
|
||||
files:
|
||||
- /Audio/items/screwdriver.ogg
|
||||
- /Audio/items/screwdriver2.ogg
|
||||
BIN
Resources/Textures/Objects/Tools/drill.rsi/drill_bolt.png
Normal file
BIN
Resources/Textures/Objects/Tools/drill.rsi/drill_bolt.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 839 B |
BIN
Resources/Textures/Objects/Tools/drill.rsi/drill_screw.png
Normal file
BIN
Resources/Textures/Objects/Tools/drill.rsi/drill_screw.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 831 B |
1
Resources/Textures/Objects/Tools/drill.rsi/meta.json
Normal file
1
Resources/Textures/Objects/Tools/drill.rsi/meta.json
Normal file
@@ -0,0 +1 @@
|
||||
{"version": 1, "size": {"x": 32, "y": 32}, "license": "CC BY-SA 3.0", "copyright": "Taken from https://github.com/tgstation/tgstation at commit ea59fb4b810decbb5996b36d8876614b57c3d189", "states": [{"name": "drill_bolt", "directions": 1, "delays": [[1.0]]}, {"name": "drill_screw", "directions": 1, "delays": [[1.0]]}]}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 667 B |
BIN
Resources/Textures/Objects/Tools/jaws_of_life.rsi/jaws_pry.png
Normal file
BIN
Resources/Textures/Objects/Tools/jaws_of_life.rsi/jaws_pry.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 644 B |
@@ -0,0 +1 @@
|
||||
{"version": 1, "size": {"x": 32, "y": 32}, "license": "CC BY-SA 3.0", "copyright": "Taken from https://github.com/tgstation/tgstation at commit ea59fb4b810decbb5996b36d8876614b57c3d189", "states": [{"name": "jaws_cutter", "directions": 1, "delays": [[1.0]]}, {"name": "jaws_pry", "directions": 1, "delays": [[1.0]]}]}
|
||||
@@ -56,5 +56,8 @@
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=prefs/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Soundfont/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=soundfonts/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=swsl/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=underplating/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Wirecutter/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Stunnable/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=swsl/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
|
||||
Reference in New Issue
Block a user