@@ -25,6 +25,13 @@ namespace Content.Client
|
|||||||
factory.RegisterIgnore("PowerStorage");
|
factory.RegisterIgnore("PowerStorage");
|
||||||
factory.RegisterIgnore("PowerGenerator");
|
factory.RegisterIgnore("PowerGenerator");
|
||||||
|
|
||||||
|
factory.RegisterIgnore("Wirecutter");
|
||||||
|
factory.RegisterIgnore("Screwdriver");
|
||||||
|
factory.RegisterIgnore("Multitool");
|
||||||
|
factory.RegisterIgnore("Welder");
|
||||||
|
factory.RegisterIgnore("Wrench");
|
||||||
|
factory.RegisterIgnore("Crowbar");
|
||||||
|
|
||||||
factory.Register<HandsComponent>();
|
factory.Register<HandsComponent>();
|
||||||
factory.RegisterReference<HandsComponent, IHandsComponent>();
|
factory.RegisterReference<HandsComponent, IHandsComponent>();
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,13 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="EntryPoint.cs" />
|
<Compile Include="EntryPoint.cs" />
|
||||||
<Compile Include="GameObjects\Components\Doors\ServerDoorComponent.cs" />
|
<Compile Include="GameObjects\Components\Doors\ServerDoorComponent.cs" />
|
||||||
|
<Compile Include="GameObjects\Components\Interactable\Tools\BaseTool.cs" />
|
||||||
|
<Compile Include="GameObjects\Components\Interactable\Tools\CrowbarComponent.cs" />
|
||||||
|
<Compile Include="GameObjects\Components\Interactable\Tools\MultitoolComponent.cs" />
|
||||||
|
<Compile Include="GameObjects\Components\Interactable\Tools\ScrewdriverComponent.cs" />
|
||||||
|
<Compile Include="GameObjects\Components\Interactable\Tools\WelderComponent.cs" />
|
||||||
|
<Compile Include="GameObjects\Components\Interactable\Tools\WirecutterComponent.cs" />
|
||||||
|
<Compile Include="GameObjects\Components\Interactable\Tools\WrenchComponent.cs" />
|
||||||
<Compile Include="GameObjects\Components\Power\PowerStorageComponent.cs" />
|
<Compile Include="GameObjects\Components\Power\PowerStorageComponent.cs" />
|
||||||
<Compile Include="GameObjects\Components\Power\PowerGeneratorComponent.cs" />
|
<Compile Include="GameObjects\Components\Power\PowerGeneratorComponent.cs" />
|
||||||
<Compile Include="GameObjects\Components\Power\PowerDevice.cs" />
|
<Compile Include="GameObjects\Components\Power\PowerDevice.cs" />
|
||||||
@@ -108,7 +115,5 @@
|
|||||||
<ContentAssemblies Include="$(OutputPath)Content.Server.pdb" Condition="'$(Configuration)' == 'Debug'" />
|
<ContentAssemblies Include="$(OutputPath)Content.Server.pdb" Condition="'$(Configuration)' == 'Debug'" />
|
||||||
<ContentAssemblies Include="$(OutputPath)Content.Shared.pdb" Condition="'$(Configuration)' == 'Debug'" />
|
<ContentAssemblies Include="$(OutputPath)Content.Shared.pdb" Condition="'$(Configuration)' == 'Debug'" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup />
|
||||||
<Folder Include="GameObjects\Components\Interactable\" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
</Project>
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
using Content.Server.GameObjects;
|
using Content.Server.GameObjects;
|
||||||
using Content.Server.GameObjects.Components.Power;
|
using Content.Server.GameObjects.Components.Power;
|
||||||
|
using Content.Server.GameObjects.Components.Interactable.Tools;
|
||||||
using Content.Server.Interfaces.GameObjects;
|
using Content.Server.Interfaces.GameObjects;
|
||||||
using SS14.Server;
|
using SS14.Server;
|
||||||
using SS14.Server.Interfaces;
|
using SS14.Server.Interfaces;
|
||||||
@@ -8,7 +9,6 @@ using SS14.Server.Interfaces.Chat;
|
|||||||
using SS14.Server.Interfaces.Maps;
|
using SS14.Server.Interfaces.Maps;
|
||||||
using SS14.Server.Interfaces.Player;
|
using SS14.Server.Interfaces.Player;
|
||||||
using SS14.Server.Player;
|
using SS14.Server.Player;
|
||||||
using SS14.Shared;
|
|
||||||
using SS14.Shared.Console;
|
using SS14.Shared.Console;
|
||||||
using SS14.Shared.ContentPack;
|
using SS14.Shared.ContentPack;
|
||||||
using SS14.Shared.Enums;
|
using SS14.Shared.Enums;
|
||||||
@@ -57,12 +57,22 @@ namespace Content.Server
|
|||||||
factory.Register<DestructibleComponent>();
|
factory.Register<DestructibleComponent>();
|
||||||
factory.Register<TemperatureComponent>();
|
factory.Register<TemperatureComponent>();
|
||||||
factory.Register<ServerDoorComponent>();
|
factory.Register<ServerDoorComponent>();
|
||||||
|
|
||||||
|
//Power Components
|
||||||
factory.Register<PowerTransferComponent>();
|
factory.Register<PowerTransferComponent>();
|
||||||
factory.Register<PowerProviderComponent>();
|
factory.Register<PowerProviderComponent>();
|
||||||
factory.Register<PowerNodeComponent>();
|
factory.Register<PowerNodeComponent>();
|
||||||
factory.Register<PowerStorageComponent>();
|
factory.Register<PowerStorageComponent>();
|
||||||
factory.Register<PowerDeviceComponent>();
|
factory.Register<PowerDeviceComponent>();
|
||||||
factory.Register<PowerGeneratorComponent>();
|
factory.Register<PowerGeneratorComponent>();
|
||||||
|
|
||||||
|
//Tools
|
||||||
|
factory.Register<MultitoolComponent>();
|
||||||
|
factory.Register<WirecutterComponent>();
|
||||||
|
factory.Register<WrenchComponent>();
|
||||||
|
factory.Register<WelderComponent>();
|
||||||
|
factory.Register<ScrewdriverComponent>();
|
||||||
|
factory.Register<CrowbarComponent>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
using SS14.Shared.GameObjects;
|
||||||
|
using SS14.Shared.Utility;
|
||||||
|
using YamlDotNet.RepresentationModel;
|
||||||
|
|
||||||
|
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>
|
||||||
|
public float SpeedModifier { get; set; } = 1;
|
||||||
|
|
||||||
|
public override void LoadParameters(YamlMappingNode mapping)
|
||||||
|
{
|
||||||
|
if (mapping.TryGetNode("Speed", out YamlNode node))
|
||||||
|
{
|
||||||
|
SpeedModifier = node.AsFloat();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Content.Server.GameObjects.Components.Interactable.Tools
|
||||||
|
{
|
||||||
|
public class CrowbarComponent : ToolComponent
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Tool that can be used to crowbar things apart, such as deconstructing
|
||||||
|
/// </summary>
|
||||||
|
public override string Name => "Crowbar";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Content.Server.GameObjects.Components.Interactable.Tools
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Tool used for interfacing/hacking into configurable computers
|
||||||
|
/// </summary>
|
||||||
|
public class MultitoolComponent : ToolComponent
|
||||||
|
{
|
||||||
|
public override string Name => "Multitool";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Content.Server.GameObjects.Components.Interactable.Tools
|
||||||
|
{
|
||||||
|
public class ScrewdriverComponent : ToolComponent
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Tool that interacts with technical components that need to be screwed in
|
||||||
|
/// </summary>
|
||||||
|
public override string Name => "Screwdriver";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,129 @@
|
|||||||
|
using System;
|
||||||
|
using SS14.Shared.Interfaces.GameObjects;
|
||||||
|
using SS14.Shared.Utility;
|
||||||
|
using YamlDotNet.RepresentationModel;
|
||||||
|
using SS14.Server.GameObjects;
|
||||||
|
|
||||||
|
namespace Content.Server.GameObjects.Components.Interactable.Tools
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Tool used to weld metal together, light things on fire, or melt into constituent parts
|
||||||
|
/// </summary>
|
||||||
|
class WelderComponent : ToolComponent, EntitySystems.IUse
|
||||||
|
{
|
||||||
|
public override string Name => "Welder";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Maximum fuel capacity the welder can hold
|
||||||
|
/// </summary>
|
||||||
|
public float FuelCapacity { get; set; } = 50;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fuel the welder has to do tasks
|
||||||
|
/// </summary>
|
||||||
|
public float Fuel { get; set; } = 0;
|
||||||
|
|
||||||
|
/// <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>
|
||||||
|
public bool Activated { get; private set; } = false;
|
||||||
|
|
||||||
|
//private string OnSprite { get; set; }
|
||||||
|
//private string OffSprite { get; set; }
|
||||||
|
|
||||||
|
public override void LoadParameters(YamlMappingNode mapping)
|
||||||
|
{
|
||||||
|
base.LoadParameters(mapping);
|
||||||
|
|
||||||
|
if (mapping.TryGetNode("Capacity", out YamlNode node))
|
||||||
|
{
|
||||||
|
FuelCapacity = node.AsFloat();
|
||||||
|
}
|
||||||
|
|
||||||
|
//if (mapping.TryGetNode("On", out node))
|
||||||
|
//{
|
||||||
|
// OnSprite = node.AsString();
|
||||||
|
//}
|
||||||
|
|
||||||
|
//if (mapping.TryGetNode("Off", out node))
|
||||||
|
//{
|
||||||
|
// OffSprite = node.AsString();
|
||||||
|
//}
|
||||||
|
|
||||||
|
if (mapping.TryGetNode("Fuel", out node))
|
||||||
|
{
|
||||||
|
Fuel = node.AsFloat();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Fuel = FuelCapacity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Update(float frameTime)
|
||||||
|
{
|
||||||
|
Fuel = Math.Min(Fuel - FuelLossRate, 0);
|
||||||
|
|
||||||
|
if(Activated && Fuel == 0)
|
||||||
|
{
|
||||||
|
ToggleStatus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanUse(float value)
|
||||||
|
{
|
||||||
|
return Fuel > value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool CanUse()
|
||||||
|
{
|
||||||
|
return CanUse(DefaultFuelCost);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanActivate()
|
||||||
|
{
|
||||||
|
return Fuel > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool UseEntity(IEntity user)
|
||||||
|
{
|
||||||
|
return ToggleStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deactivates welding tool if active, activates welding tool if possible
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool ToggleStatus()
|
||||||
|
{
|
||||||
|
if(Activated)
|
||||||
|
{
|
||||||
|
Activated = false;
|
||||||
|
|
||||||
|
//TODO : Change sprite on deactivation
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(CanActivate())
|
||||||
|
{
|
||||||
|
Activated = true;
|
||||||
|
|
||||||
|
//TODO : Change sprite on activation
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Content.Server.GameObjects.Components.Interactable.Tools
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Tool that can be used for some cutting interactions such as wires or hacking
|
||||||
|
/// </summary>
|
||||||
|
public class WirecutterComponent : ToolComponent
|
||||||
|
{
|
||||||
|
public override string Name => "Wirecutter";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Content.Server.GameObjects.Components.Interactable.Tools
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Wrenches bolts, and interacts with things that have been bolted
|
||||||
|
/// </summary>
|
||||||
|
public class WrenchComponent : ToolComponent
|
||||||
|
{
|
||||||
|
public override string Name => "Wrench";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -49,7 +49,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
public void UserInteraction(object sender, EntityEventArgs arg)
|
public void UserInteraction(object sender, EntityEventArgs arg)
|
||||||
{
|
{
|
||||||
ClickedOnEntityEventArgs e = (ClickedOnEntityEventArgs)arg;
|
ClickedOnEntityEventArgs e = (ClickedOnEntityEventArgs)arg;
|
||||||
if (e.MouseButton != Clicktype.Left)
|
if (e.MouseButton != ClickType.Left)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IEntity user = EntityManager.GetEntity(e.Clicker);
|
IEntity user = EntityManager.GetEntity(e.Clicker);
|
||||||
|
|||||||
71
Resources/Prototypes/Entities/Tools.yml
Normal file
71
Resources/Prototypes/Entities/Tools.yml
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
- type: entity
|
||||||
|
name: Wirecutter
|
||||||
|
parent: BaseItem
|
||||||
|
id: Wirecutter
|
||||||
|
components:
|
||||||
|
- type: Wirecutter
|
||||||
|
- type: WearableAnimatedSprite
|
||||||
|
notWornSprite: wirecutter
|
||||||
|
sprite: wirecutter
|
||||||
|
- type: Icon
|
||||||
|
icon: wirecutter
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
name: Screwdriver
|
||||||
|
parent: BaseItem
|
||||||
|
id: Screwdriver
|
||||||
|
components:
|
||||||
|
- type: Screwdriver
|
||||||
|
- type: WearableAnimatedSprite
|
||||||
|
notWornSprite: screwdriver
|
||||||
|
sprite: screwdriver
|
||||||
|
- type: Icon
|
||||||
|
icon: screwdriver
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
name: Welder
|
||||||
|
parent: BaseItem
|
||||||
|
id: Welder
|
||||||
|
components:
|
||||||
|
- type: Welder
|
||||||
|
- type: WearableAnimatedSprite
|
||||||
|
notWornSprite: welder
|
||||||
|
sprite: welder
|
||||||
|
- type: Icon
|
||||||
|
icon: welder
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
name: Wrench
|
||||||
|
parent: BaseItem
|
||||||
|
id: Wrench
|
||||||
|
components:
|
||||||
|
- type: Wrench
|
||||||
|
- type: WearableAnimatedSprite
|
||||||
|
notWornSprite: wrench
|
||||||
|
sprite: wrench
|
||||||
|
- type: Icon
|
||||||
|
icon: wrench
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
name: Crowbar
|
||||||
|
parent: BaseItem
|
||||||
|
id: Crowbar
|
||||||
|
components:
|
||||||
|
- type: Crowbar
|
||||||
|
- type: WearableAnimatedSprite
|
||||||
|
notWornSprite: crowbar
|
||||||
|
sprite: crowbar
|
||||||
|
- type: Icon
|
||||||
|
icon: crowbar
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
name: Multitool
|
||||||
|
parent: BaseItem
|
||||||
|
id: Multitool
|
||||||
|
components:
|
||||||
|
- type: Multitool
|
||||||
|
- type: WearableAnimatedSprite
|
||||||
|
notWornSprite: multitool
|
||||||
|
sprite: multitool
|
||||||
|
- type: Icon
|
||||||
|
icon: multitool
|
||||||
BIN
Resources/textures/Objects/crowbar.png
Normal file
BIN
Resources/textures/Objects/crowbar.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 200 B |
BIN
Resources/textures/Objects/multitool.png
Normal file
BIN
Resources/textures/Objects/multitool.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 197 B |
BIN
Resources/textures/Objects/screwdriver.png
Normal file
BIN
Resources/textures/Objects/screwdriver.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 177 B |
BIN
Resources/textures/Objects/welder.png
Normal file
BIN
Resources/textures/Objects/welder.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 330 B |
BIN
Resources/textures/Objects/wirecutter.png
Normal file
BIN
Resources/textures/Objects/wirecutter.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 216 B |
BIN
Resources/textures/Objects/wrench.png
Normal file
BIN
Resources/textures/Objects/wrench.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 230 B |
Reference in New Issue
Block a user