mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* Add prototype-backed admin verb framework * Add reusable admin verb operations * Add smite-specific admin operations * Migrate admin smites to prototypes * More docs for god of docs * We dont have prediction here, so... * Final cleanup * Fix adminSmite * Add segment display control * Add generic thermoregulator * Add thermobath systems * Replace hotplate with thermobath * Refine thermobath layout * move simple smites to effects * move comps to effects * move add action to effect * move add mind role to effect * move add user interfaces to effect * move godmode to effect * move eye zoom to effect * move speed swap to effect * move spill bloodstream to effect * move remove organs to effect * move cream pie to effect * move slip to effect * fix server effect usings * move homing rod to effect * move locker stuff to effect * move tabletop dimension to effect * move pinball to effect * move yeet to effect * move silicon laws to effect * move ghost kick to effect * remove admin operations * revert sht * remove BOM * use admin verb prototypes for smites * add heart attack smite prototype * docs update * fix AdminSmiteVomitOrgans * split and move to shared * move to shared * move to shared and predict * PredictedQueueDel * fix Popup * fix HomingRod * port DeleteEntityEntityEffectSystem * fix StuffIntoLockerEntityEffectSystem * upd * fix eye * fix movement * fix!! * fix and doc * Add admin verb category prototype * upd AdminVerbPrototype * split verbs * SuperSuperSuperBonk * Update PopupMessageEntityEffectSystem.cs * fields --------- Co-authored-by: Pok245 <113675512+Pok27@users.noreply.github.com>
85 lines
2.7 KiB
C#
85 lines
2.7 KiB
C#
using Content.Server.Administration.Components;
|
|
using Content.Shared.Climbing.Components;
|
|
using Content.Shared.Climbing.Systems;
|
|
using Content.Shared.Mobs;
|
|
using Content.Shared.Mobs.Systems;
|
|
using Robust.Shared.Timing;
|
|
|
|
namespace Content.Server.Administration.Systems;
|
|
|
|
public sealed partial class SuperBonkSystem : EntitySystem
|
|
{
|
|
[Dependency] private SharedTransformSystem _transformSystem = default!;
|
|
[Dependency] private ClimbSystem _climbSystem = default!;
|
|
[Dependency] private MobStateSystem _mobState = default!;
|
|
[Dependency] private IGameTiming _timing = default!;
|
|
|
|
[Dependency] private EntityQuery<TransformComponent> _transformQuery;
|
|
|
|
[SubscribeLocalEvent]
|
|
private void OnStartup(Entity<SuperBonkComponent> ent, ref ComponentStartup args)
|
|
{
|
|
var (uid, component) = ent;
|
|
|
|
if (component.StopWhenDead && _mobState.IsDead(uid))
|
|
{
|
|
RemCompDeferred<SuperBonkComponent>(uid);
|
|
return;
|
|
}
|
|
|
|
component.NextBonk = _timing.CurTime + component.BonkCooldown;
|
|
|
|
var tables = EntityQueryEnumerator<BonkableComponent>();
|
|
var bonks = new List<EntityUid>();
|
|
while (tables.MoveNext(out var table, out _))
|
|
{
|
|
bonks.Add(table);
|
|
}
|
|
|
|
component.Tables = bonks.GetEnumerator();
|
|
if (!component.Tables.MoveNext())
|
|
RemCompDeferred<SuperBonkComponent>(uid);
|
|
}
|
|
|
|
[SubscribeLocalEvent]
|
|
private void OnMobStateChanged(Entity<SuperBonkComponent> ent, ref MobStateChangedEvent args)
|
|
{
|
|
var (uid, component) = ent;
|
|
|
|
if (component.StopWhenDead && args.NewMobState == MobState.Dead)
|
|
RemCompDeferred<SuperBonkComponent>(uid);
|
|
}
|
|
|
|
public override void Update(float frameTime)
|
|
{
|
|
base.Update(frameTime);
|
|
var comps = EntityQueryEnumerator<SuperBonkComponent>();
|
|
|
|
while (comps.MoveNext(out var uid, out var comp))
|
|
{
|
|
if (comp.NextBonk > _timing.CurTime)
|
|
continue;
|
|
|
|
if (!TryBonk(uid, comp.Tables.Current) || !comp.Tables.MoveNext())
|
|
{
|
|
RemComp<SuperBonkComponent>(uid);
|
|
continue;
|
|
}
|
|
|
|
comp.NextBonk += comp.BonkCooldown;
|
|
}
|
|
}
|
|
|
|
private bool TryBonk(EntityUid uid, EntityUid tableUid)
|
|
{
|
|
// It would be very weird for something without a transform component to have a bonk component
|
|
// but just in case because I don't want to crash the server.
|
|
if (!_transformQuery.HasComp(tableUid))
|
|
return false;
|
|
|
|
_transformSystem.SetCoordinates(uid, Transform(tableUid).Coordinates);
|
|
_climbSystem.Bonk(tableUid, uid);
|
|
|
|
return true;
|
|
}
|
|
}
|