Revenant 2: Electric Boogaloo (#11510)
* revenant 2: electric boogaloo * revevent * oversights * Update RevenantSystem.Abilities.cs * names * no shoote stouhg walls
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
using Content.Shared.Physics;
|
||||
using Robust.Shared.Physics;
|
||||
using System.Linq;
|
||||
using Content.Shared.Movement.Systems;
|
||||
using Content.Shared.Revenant.Components;
|
||||
|
||||
namespace Content.Shared.Revenant.EntitySystems;
|
||||
|
||||
/// <summary>
|
||||
/// Makes the revenant solid when the component is applied.
|
||||
/// Additionally applies a few visual effects.
|
||||
/// Used for status effect.
|
||||
/// </summary>
|
||||
public abstract class SharedCorporealSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly MovementSpeedModifierSystem _movement = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<CorporealComponent, ComponentStartup>(OnStartup);
|
||||
SubscribeLocalEvent<CorporealComponent, ComponentShutdown>(OnShutdown);
|
||||
SubscribeLocalEvent<CorporealComponent, RefreshMovementSpeedModifiersEvent>(OnRefresh);
|
||||
}
|
||||
|
||||
private void OnRefresh(EntityUid uid, CorporealComponent component, RefreshMovementSpeedModifiersEvent args)
|
||||
{
|
||||
args.ModifySpeed(component.MovementSpeedDebuff, component.MovementSpeedDebuff);
|
||||
}
|
||||
|
||||
public virtual void OnStartup(EntityUid uid, CorporealComponent component, ComponentStartup args)
|
||||
{
|
||||
_appearance.SetData(uid, RevenantVisuals.Corporeal, true);
|
||||
|
||||
if (TryComp<FixturesComponent>(uid, out var fixtures) && fixtures.FixtureCount >= 1)
|
||||
{
|
||||
var fixture = fixtures.Fixtures.Values.First();
|
||||
|
||||
fixture.CollisionMask = (int) (CollisionGroup.SmallMobMask | CollisionGroup.GhostImpassable);
|
||||
fixture.CollisionLayer = (int) CollisionGroup.SmallMobLayer;
|
||||
}
|
||||
_movement.RefreshMovementSpeedModifiers(uid);
|
||||
}
|
||||
|
||||
public virtual void OnShutdown(EntityUid uid, CorporealComponent component, ComponentShutdown args)
|
||||
{
|
||||
_appearance.SetData(uid, RevenantVisuals.Corporeal, false);
|
||||
|
||||
if (TryComp<FixturesComponent>(uid, out var fixtures) && fixtures.FixtureCount >= 1)
|
||||
{
|
||||
var fixture = fixtures.Fixtures.Values.First();
|
||||
|
||||
fixture.CollisionMask = (int) CollisionGroup.GhostImpassable;
|
||||
fixture.CollisionLayer = 0;
|
||||
}
|
||||
component.MovementSpeedDebuff = 1; //just so we can avoid annoying code elsewhere
|
||||
_movement.RefreshMovementSpeedModifiers(uid);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user