Files
tbd-station-14/Content.Shared/Ninja/Components/NinjaSuitComponent.cs
deltanedas c1cda0dbf8 [Antag] add space ninja as midround antag (#14069)
* start of space ninja midround antag

* suit has powercell, can be upgraded only (not replaced with equal or worse battery)

* add doorjacking to ninja gloves, power cell, doorjack objective (broken), tweaks

* 💀

* add basic suit power display that uses stamina rsi

* add draining apc/sub/smes - no wires yet

* add research downloading

* ninja starts implanted, move some stuff to yaml

* add Automated field to OnUseTimerTrigger

* implement spider charge and objective

* fix client crash when taking suit off, some refactor

* add survive condition and tweak locale

* add comms console icon for objective

* add calling in a threat - currently revenant and dragon

* combine all glove abilities

* locale

* spark sounds when draining, refactoring

* toggle is actually toggle now

* prevent crash if disabling stealth with outline

* add antag ctrl for ninja, hopefully show greentext

* fix greentext and some other things

* disabling gloves if taken off or suit taken off

* basic energy katana, change ninja loadout

* recallable katana, refactoring

* start of dash - not done yet

* katana dashing ability

* merge upstream + compiling, make AutomatedTimer its own component

* docs and stuff

* partial refactor of glove abilities, still need to move handling

* make dooremaggedevent by ref

* move bunch of stuff to shared - broken

* clean ninja antag verb

* doc

* mark rule config fields as required

* fix client crash

* wip systems refactor

* big refactor of systems

* fuck

* make TryDoElectrocution callable from shared

* finish refactoring?

* no guns

* start with internals on

* clean up glove abilities, add range check

* create soap, in place of ninja throwing stars

* add emp suit ability

* able to eat chefs stolen food in space

* stuff, tell client when un/cloaked but there is bug with gloves

* fix prediction breaking gloves on client

* ninja soap despawns after a minute

* ninja spawns outside the station now, with gps + station coords to navigate

* add cooldown to stun ability

* cant use glove abilities in combat mode

* require empty hand to use glove abilities

* use ghost role spawner

* Update Content.Server/Ninja/Systems/NinjaSuitSystem.cs

Co-authored-by: keronshb <54602815+keronshb@users.noreply.github.com>

* some review changes

* show powercell charge on examine

* new is needed

* address some reviews

* ninja starts with jetpack, i hope

* partial feedback

* uhh

* pro

* remove pirate from threats list

* use doafter refactor

* pro i gave skeleton jetpack

* some stuff

* use auto gen state

* mr handy

* use EntityQueryEnumerator

* cleanup

* spider charge target anti-troll

* mmmmmm

---------

Co-authored-by: deltanedas <deltanedas@laptop>
Co-authored-by: deltanedas <user@zenith>
Co-authored-by: deltanedas <@deltanedas:kde.org>
Co-authored-by: keronshb <54602815+keronshb@users.noreply.github.com>
2023-04-17 01:33:27 -06:00

149 lines
5.1 KiB
C#

using Content.Shared.Actions;
using Content.Shared.Actions.ActionTypes;
using Content.Shared.Ninja.Systems;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Utility;
namespace Content.Shared.Ninja.Components;
// TODO: ResourcePath -> ResPath when thing gets merged
/// <summary>
/// Component for ninja suit abilities and power consumption.
/// As an implementation detail, dashing with katana is a suit action which isn't ideal.
/// </summary>
[Access(typeof(SharedNinjaSuitSystem))]
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class NinjaSuitComponent : Component
{
[ViewVariables, AutoNetworkedField]
public bool Cloaked = false;
/// <summary>
/// The action for toggling suit phase cloak ability
/// </summary>
[DataField("togglePhaseCloakAction")]
public InstantAction TogglePhaseCloakAction = new()
{
UseDelay = TimeSpan.FromSeconds(5), // have to plan un/cloaking ahead of time
DisplayName = "action-name-toggle-phase-cloak",
Description = "action-desc-toggle-phase-cloak",
Priority = -9,
Event = new TogglePhaseCloakEvent()
};
/// <summary>
/// Battery charge used passively, in watts. Will last 1000 seconds on a small-capacity power cell.
/// </summary>
[DataField("passiveWattage")]
public float PassiveWattage = 0.36f;
/// <summary>
/// Battery charge used while cloaked, stacks with passive. Will last 200 seconds while cloaked on a small-capacity power cell.
/// </summary>
[DataField("cloakWattage")]
public float CloakWattage = 1.44f;
/// <summary>
/// The action for creating throwing soap, in place of ninja throwing stars since embedding doesn't exist.
/// </summary>
[DataField("createSoapAction")]
public InstantAction CreateSoapAction = new()
{
UseDelay = TimeSpan.FromSeconds(10),
Icon = new SpriteSpecifier.Rsi(new ResourcePath("Objects/Specific/Janitorial/soap.rsi"), "soap"),
ItemIconStyle = ItemActionIconStyle.NoItem,
DisplayName = "action-name-create-soap",
Description = "action-desc-create-soap",
Priority = -10,
Event = new CreateSoapEvent()
};
/// <summary>
/// Battery charge used to create a throwing soap. Can do it 25 times on a small-capacity power cell.
/// </summary>
[DataField("soapCharge")]
public float SoapCharge = 14.4f;
/// <summary>
/// Soap item to create with the action
/// </summary>
[DataField("soapPrototype", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string SoapPrototype = "SoapNinja";
/// <summary>
/// The action for recalling a bound energy katana
/// </summary>
[DataField("recallkatanaAction")]
public InstantAction RecallKatanaAction = new()
{
UseDelay = TimeSpan.FromSeconds(1),
Icon = new SpriteSpecifier.Rsi(new ResourcePath("Objects/Weapons/Melee/energykatana.rsi"), "icon"),
ItemIconStyle = ItemActionIconStyle.NoItem,
DisplayName = "action-name-recall-katana",
Description = "action-desc-recall-katana",
Priority = -11,
Event = new RecallKatanaEvent()
};
/// <summary>
/// The action for dashing somewhere using katana
/// </summary>
[DataField("katanaDashAction")]
public WorldTargetAction KatanaDashAction = new()
{
Icon = new SpriteSpecifier.Rsi(new ResourcePath("Objects/Magic/magicactions.rsi"), "blink"),
ItemIconStyle = ItemActionIconStyle.NoItem,
DisplayName = "action-name-katana-dash",
Description = "action-desc-katana-dash",
Priority = -12,
Event = new KatanaDashEvent(),
// doing checks manually
CheckCanAccess = false,
Range = 0f
};
/// <summary>
/// The action for creating an EMP burst
/// </summary>
[DataField("empAction")]
public InstantAction EmpAction = new()
{
Icon = new SpriteSpecifier.Rsi(new ResourcePath("Objects/Weapons/Grenades/empgrenade.rsi"), "icon"),
ItemIconStyle = ItemActionIconStyle.BigAction,
DisplayName = "action-name-em-burst",
Description = "action-desc-em-burst",
Priority = -13,
Event = new NinjaEmpEvent()
};
/// <summary>
/// Battery charge used to create an EMP burst. Can do it 2 times on a small-capacity power cell.
/// </summary>
[DataField("empCharge")]
public float EmpCharge = 180f;
/// <summary>
/// Range of the EMP in tiles.
/// </summary>
[DataField("empRange")]
public float EmpRange = 6f;
/// <summary>
/// Power consumed from batteries by the EMP
/// </summary>
[DataField("empConsumption")]
public float EmpConsumption = 100000f;
}
public sealed class TogglePhaseCloakEvent : InstantActionEvent { }
public sealed class CreateSoapEvent : InstantActionEvent { }
public sealed class RecallKatanaEvent : InstantActionEvent { }
public sealed class NinjaEmpEvent : InstantActionEvent { }