[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>
This commit is contained in:
81
Content.Server/StationEvents/Events/SpaceNinjaSpawn.cs
Normal file
81
Content.Server/StationEvents/Events/SpaceNinjaSpawn.cs
Normal file
@@ -0,0 +1,81 @@
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.GameTicking.Rules;
|
||||
using Content.Server.GameTicking.Rules.Configurations;
|
||||
using Content.Server.Ninja.Systems;
|
||||
using Content.Server.StationEvents.Components;
|
||||
using Content.Server.Station.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using System.Linq;
|
||||
|
||||
namespace Content.Server.StationEvents.Events;
|
||||
|
||||
/// <summary>
|
||||
/// Event for spawning a Space Ninja mid-game.
|
||||
/// </summary>
|
||||
public sealed class SpaceNinjaSpawn : StationEventSystem
|
||||
{
|
||||
[Dependency] private readonly NinjaSystem _ninja = default!;
|
||||
[Dependency] private readonly IPrototypeManager _proto = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly GameTicker _ticker = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
|
||||
public override string Prototype => "SpaceNinjaSpawn";
|
||||
|
||||
public override void Started()
|
||||
{
|
||||
base.Started();
|
||||
|
||||
if (StationSystem.Stations.Count == 0)
|
||||
{
|
||||
Sawmill.Error("No stations exist, cannot spawn space ninja!");
|
||||
return;
|
||||
}
|
||||
|
||||
var station = _random.Pick(StationSystem.Stations);
|
||||
if (!TryComp<StationDataComponent>(station, out var stationData))
|
||||
{
|
||||
Sawmill.Error("Chosen station isn't a station, cannot spawn space ninja!");
|
||||
return;
|
||||
}
|
||||
|
||||
// find a station grid
|
||||
var gridUid = StationSystem.GetLargestGrid(stationData);
|
||||
if (gridUid == null || !TryComp<MapGridComponent>(gridUid, out var grid))
|
||||
{
|
||||
Sawmill.Error("Chosen station has no grids, cannot spawn space ninja!");
|
||||
return;
|
||||
}
|
||||
|
||||
// figure out its AABB size and use that as a guide to how far ninja should be
|
||||
var config = (NinjaRuleConfiguration) Configuration;
|
||||
var size = grid.LocalAABB.Size.Length / 2;
|
||||
var distance = size + config.SpawnDistance;
|
||||
var angle = _random.NextAngle();
|
||||
// position relative to station center
|
||||
var location = angle.ToVec() * distance;
|
||||
|
||||
// create the spawner, the ninja will appear when a ghost has picked the role
|
||||
var xform = Transform(gridUid.Value);
|
||||
var position = _transform.GetWorldPosition(xform) + location;
|
||||
var coords = new MapCoordinates(position, xform.MapID);
|
||||
Sawmill.Info($"Creating ninja spawnpoint at {coords}");
|
||||
var spawner = Spawn("SpawnPointGhostSpaceNinja", coords);
|
||||
|
||||
// tell the player where the station is when they pick the role
|
||||
_ninja.SetNinjaStationGrid(spawner, gridUid.Value);
|
||||
|
||||
// start traitor rule incase it isn't, for the sweet greentext
|
||||
var rule = _proto.Index<GameRulePrototype>("Traitor");
|
||||
_ticker.StartGameRule(rule);
|
||||
}
|
||||
|
||||
public override void Added()
|
||||
{
|
||||
Sawmill.Info("Added space ninja spawn rule");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user