Files
tbd-station-14/Content.Shared/Ninja/Components/NinjaGlovesComponent.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

152 lines
4.4 KiB
C#

using Content.Shared.Actions;
using Content.Shared.Actions.ActionTypes;
using Content.Shared.DoAfter;
using Content.Shared.Ninja.Systems;
using Content.Shared.Tag;
using Content.Shared.Toggleable;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Utility;
using System.Threading;
namespace Content.Shared.Ninja.Components;
/// <summary>
/// Component for toggling glove powers.
/// Powers being enabled is controlled by GlovesEnabledComponent
/// </summary>
[Access(typeof(SharedNinjaGlovesSystem))]
[RegisterComponent, NetworkedComponent]
public sealed class NinjaGlovesComponent : Component
{
/// <summary>
/// Entity of the ninja using these gloves, usually means enabled
/// </summary>
[ViewVariables]
public EntityUid? User;
/// <summary>
/// The action for toggling ninja gloves abilities
/// </summary>
[DataField("toggleAction")]
public InstantAction ToggleAction = new()
{
DisplayName = "action-name-toggle-ninja-gloves",
Description = "action-desc-toggle-ninja-gloves",
Priority = -13,
Event = new ToggleActionEvent()
};
}
/// <summary>
/// Component for emagging doors on click, when gloves are enabled.
/// Only works on entities with DoorComponent.
/// </summary>
[RegisterComponent]
public sealed class NinjaDoorjackComponent : Component
{
/// <summary>
/// The tag that marks an entity as immune to doorjacking
/// </summary>
[DataField("emagImmuneTag", customTypeSerializer: typeof(PrototypeIdSerializer<TagPrototype>))]
public string EmagImmuneTag = "EmagImmune";
}
/// <summary>
/// Component for stunning mobs on click, when gloves are enabled.
/// Knocks them down for a bit and deals shock damage.
/// </summary>
[RegisterComponent]
public sealed class NinjaStunComponent : Component
{
/// <summary>
/// Joules required in the suit to stun someone. Defaults to 10 uses on a small battery.
/// </summary>
[DataField("stunCharge")]
public float StunCharge = 36.0f;
/// <summary>
/// Shock damage dealt when stunning someone
/// </summary>
[DataField("stunDamage")]
public int StunDamage = 5;
/// <summary>
/// Time that someone is stunned for, stacks if done multiple times.
/// </summary>
[DataField("stunTime")]
public TimeSpan StunTime = TimeSpan.FromSeconds(3);
}
/// <summary>
/// Component for draining power from APCs/substations/SMESes, when gloves are enabled.
/// </summary>
[RegisterComponent]
public sealed class NinjaDrainComponent : Component
{
/// <summary>
/// Conversion rate between joules in a device and joules added to suit.
/// Should be very low since powercells store nothing compared to even an APC.
/// </summary>
[DataField("drainEfficiency")]
public float DrainEfficiency = 0.001f;
/// <summary>
/// Time that the do after takes to drain charge from a battery, in seconds
/// </summary>
[DataField("drainTime")]
public float DrainTime = 1f;
[DataField("sparkSound")]
public SoundSpecifier SparkSound = new SoundCollectionSpecifier("sparks");
}
/// <summary>
/// Component for downloading research nodes from a R&D server, when gloves are enabled.
/// Requirement for greentext.
/// </summary>
[RegisterComponent]
public sealed class NinjaDownloadComponent : Component
{
/// <summary>
/// Time taken to download research from a server
/// </summary>
[DataField("downloadTime")]
public float DownloadTime = 20f;
}
/// <summary>
/// Component for hacking a communications console to call in a threat.
/// Called threat is rolled from the ninja gamerule config.
/// </summary>
[RegisterComponent]
public sealed class NinjaTerrorComponent : Component
{
/// <summary>
/// Time taken to hack the console
/// </summary>
[DataField("terrorTime")]
public float TerrorTime = 20f;
}
/// <summary>
/// DoAfter event for drain ability.
/// </summary>
[Serializable, NetSerializable]
public sealed class DrainDoAfterEvent : SimpleDoAfterEvent { }
/// <summary>
/// DoAfter event for research download ability.
/// </summary>
[Serializable, NetSerializable]
public sealed class DownloadDoAfterEvent : SimpleDoAfterEvent { }
/// <summary>
/// DoAfter event for comms console terror ability.
/// </summary>
[Serializable, NetSerializable]
public sealed class TerrorDoAfterEvent : SimpleDoAfterEvent { }