mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-10 02:41:18 +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>
84 lines
3.1 KiB
C#
84 lines
3.1 KiB
C#
using Content.Shared.Interaction.Components;
|
|
using Content.Shared.Movement.Components;
|
|
using Content.Shared.Random.Helpers;
|
|
using Robust.Shared.Physics;
|
|
using Robust.Shared.Physics.Components;
|
|
using Robust.Shared.Physics.Systems;
|
|
using Robust.Shared.Timing;
|
|
|
|
namespace Content.Shared.EntityEffects.Effects.Smite;
|
|
|
|
/// <summary>
|
|
/// Launches this entity as a spinning dynamic physics body.
|
|
/// </summary>
|
|
/// <inheritdoc cref="EntityEffectSystem{T, TEffect}"/>
|
|
public sealed partial class FlingEntityEffectSystem : EntityEffectSystem<PhysicsComponent, Fling>
|
|
{
|
|
[Dependency] private FixtureSystem _fixtures = default!;
|
|
[Dependency] private SharedPhysicsSystem _physics = default!;
|
|
[Dependency] private IGameTiming _timing = default!;
|
|
[Dependency] private SharedTransformSystem _transform = default!;
|
|
|
|
protected override void Effect(Entity<PhysicsComponent> entity, ref EntityEffectEvent<Fling> args)
|
|
{
|
|
if (!TryComp<FixturesComponent>(entity, out var fixtures))
|
|
return;
|
|
|
|
// Input movers must stop using mob movement, otherwise the mover controller asserts on dynamic bodies.
|
|
if (HasComp<InputMoverComponent>(entity))
|
|
EnsureComp<BlockMovementComponent>(entity);
|
|
|
|
var fling = args.Effect;
|
|
|
|
_transform.Unanchor(entity);
|
|
_physics.SetBodyType(entity, BodyType.Dynamic, fixtures, entity.Comp);
|
|
_physics.SetBodyStatus(entity, entity.Comp, BodyStatus.InAir);
|
|
_physics.WakeBody(entity, manager: fixtures, body: entity.Comp);
|
|
|
|
foreach (var fixture in fixtures.Fixtures.Values)
|
|
{
|
|
if (fling.NonSolid)
|
|
_physics.SetHard(entity, fixture, false, fixtures);
|
|
|
|
if (fling.Restitution.HasValue && fixture.Hard)
|
|
_physics.SetRestitution(entity, fixture, fling.Restitution.Value, false, fixtures);
|
|
}
|
|
|
|
if (fling.Restitution.HasValue)
|
|
_fixtures.FixtureUpdate(entity, manager: fixtures, body: entity.Comp);
|
|
|
|
var random = SharedRandomExtensions.PredictedRandom(_timing, GetNetEntity(entity));
|
|
_physics.SetLinearVelocity(entity, random.NextVector2(fling.Speed, fling.Speed), manager: fixtures, body: entity.Comp);
|
|
_physics.SetAngularVelocity(entity, fling.AngularVelocity, manager: fixtures, body: entity.Comp);
|
|
_physics.SetLinearDamping(entity, entity.Comp, 0f);
|
|
_physics.SetAngularDamping(entity, entity.Comp, 0f);
|
|
}
|
|
}
|
|
|
|
/// <inheritdoc cref="EntityEffect"/>
|
|
public sealed partial class Fling : EntityEffectBase<Fling>
|
|
{
|
|
/// <summary>
|
|
/// Maximum magnitude of the random linear velocity applied on launch.
|
|
/// </summary>
|
|
[DataField]
|
|
public float Speed = 1.5f;
|
|
|
|
/// <summary>
|
|
/// Angular velocity applied on launch in radians per second.
|
|
/// </summary>
|
|
[DataField]
|
|
public float AngularVelocity = MathF.PI * 12f;
|
|
|
|
/// <summary>
|
|
/// Restitution applied to hard fixtures, making the entity bounce.
|
|
/// </summary>
|
|
[DataField]
|
|
public float? Restitution = 1.1f;
|
|
|
|
/// <summary>
|
|
/// Make all fixtures non-solid so the entity passes through obstacles.
|
|
/// </summary>
|
|
[DataField]
|
|
public bool NonSolid;
|
|
}
|