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:
Nemanja
2022-09-28 22:30:48 -04:00
committed by GitHub
parent a9dd9257d8
commit 3c3ee60dd2
25 changed files with 427 additions and 203 deletions

View File

@@ -1,51 +1,17 @@
using Content.Server.Visible;
using Content.Shared.Physics;
using Content.Shared.Revenant;
using Content.Shared.Movement;
using Content.Server.Visible;
using Content.Shared.Revenant.Components;
using Content.Shared.Revenant.EntitySystems;
using Robust.Server.GameObjects;
using Robust.Server.GameStates;
using Robust.Shared.Physics;
using System.Linq;
using Content.Shared.Movement.Systems;
namespace Content.Server.Revenant.EntitySystems;
/// <summary>
/// Makes the revenant solid when the component is applied.
/// Additionally applies a few visual effects.
/// Used for status effect.
/// </summary>
public sealed class CorporealSystem : EntitySystem
public sealed class CorporealSystem : SharedCorporealSystem
{
[Dependency] private readonly VisibilitySystem _visibilitySystem = default!;
[Dependency] private readonly MovementSpeedModifierSystem _movement = default!;
public override void Initialize()
public override void OnStartup(EntityUid uid, CorporealComponent component, ComponentStartup args)
{
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);
}
private void OnStartup(EntityUid uid, CorporealComponent component, ComponentStartup args)
{
if (TryComp<AppearanceComponent>(uid, out var app))
app.SetData(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;
}
base.OnStartup(uid, component, args);
if (TryComp<VisibilityComponent>(uid, out var visibility))
{
@@ -53,21 +19,11 @@ public sealed class CorporealSystem : EntitySystem
_visibilitySystem.AddLayer(visibility, (int) VisibilityFlags.Normal, false);
_visibilitySystem.RefreshVisibility(visibility);
}
_movement.RefreshMovementSpeedModifiers(uid);
}
private void OnShutdown(EntityUid uid, CorporealComponent component, ComponentShutdown args)
public override void OnShutdown(EntityUid uid, CorporealComponent component, ComponentShutdown args)
{
if (TryComp<AppearanceComponent>(uid, out var app))
app.SetData(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;
}
base.OnShutdown(uid, component, args);
if (TryComp<VisibilityComponent>(uid, out var visibility))
{

View File

@@ -1,7 +1,9 @@
using Content.Server.Mind.Components;
using Content.Server.Revenant.Components;
using Content.Shared.Examine;
using Content.Shared.MobState;
using Content.Shared.MobState.Components;
using Content.Shared.Revenant.Components;
using Robust.Shared.Random;
namespace Content.Server.Revenant.EntitySystems;

View File

@@ -0,0 +1,29 @@
using Content.Server.Beam;
using Content.Shared.Revenant.Components;
using Content.Shared.Revenant.EntitySystems;
namespace Content.Server.Revenant.EntitySystems;
/// <summary>
/// This handles...
/// </summary>
public sealed class RevenantOverloadedLightsSystem : SharedRevenantOverloadedLightsSystem
{
[Dependency] private readonly BeamSystem _beam = default!;
protected override void OnZap(RevenantOverloadedLightsComponent component)
{
if (component.Target == null)
return;
var lxform = Transform(component.Owner);
var txform = Transform(component.Target.Value);
if (!lxform.Coordinates.TryDistance(EntityManager, txform.Coordinates, out var distance))
return;
if (distance > component.ZapRange)
return;
_beam.TryCreateBeam(component.Owner, component.Target.Value, component.ZapBeamEntityId);
}
}

View File

@@ -20,24 +20,25 @@ using Content.Server.Disease.Components;
using Content.Shared.Item;
using Content.Shared.Bed.Sleep;
using Content.Shared.MobState;
using Content.Server.Explosion.EntitySystems;
using System.Linq;
using Content.Server.Beam;
using Content.Server.Emag;
using Content.Server.Humanoid;
using Content.Server.Revenant.Components;
using Content.Server.Store.Components;
using Content.Shared.FixedPoint;
using Content.Shared.Revenant.Components;
using Robust.Shared.Physics.Components;
using Robust.Shared.Utility;
namespace Content.Server.Revenant.EntitySystems;
public sealed partial class RevenantSystem : EntitySystem
public sealed partial class RevenantSystem
{
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly ThrowingSystem _throwing = default!;
[Dependency] private readonly EntityStorageSystem _entityStorage = default!;
[Dependency] private readonly DiseaseSystem _disease = default!;
[Dependency] private readonly ExplosionSystem _explosion = default!;
[Dependency] private readonly EmagSystem _emag = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly GhostSystem _ghost = default!;
@@ -181,8 +182,10 @@ public sealed partial class RevenantSystem : EntitySystem
essence.Harvested = true;
ChangeEssenceAmount(uid, essence.EssenceAmount, component);
if (TryComp<StoreComponent>(uid, out var store))
{
_store.TryAddCurrency(new Dictionary<string, FixedPoint2>()
{ {component.StolenEssenceCurrencyPrototype, essence.EssenceAmount} }, store);
{ {component.StolenEssenceCurrencyPrototype, essence.EssenceAmount} }, store);
}
if (!TryComp<MobStateComponent>(args.Target, out var mobstate))
return;
@@ -198,7 +201,7 @@ public sealed partial class RevenantSystem : EntitySystem
if (damage == null)
return;
DamageSpecifier dspec = new();
dspec.DamageDict.Add("Cellular", damage.Value);
dspec.DamageDict.Add("Poison", damage.Value);
_damage.TryChangeDamage(args.Target, dspec, true);
}
@@ -280,22 +283,28 @@ public sealed partial class RevenantSystem : EntitySystem
args.Handled = true;
var xform = Transform(uid);
var poweredLights = GetEntityQuery<PoweredLightComponent>();
var mobState = GetEntityQuery<MobStateComponent>();
var lookup = _lookup.GetEntitiesInRange(uid, component.OverloadRadius);
//TODO: feels like this might be a sin and a half
foreach (var ent in lookup)
{
if (!poweredLights.HasComponent(ent))
if (!mobState.HasComponent(ent) || !_mobState.IsAlive(ent))
continue;
var ev = new GhostBooEvent(); //light go flicker
RaiseLocalEvent(ent, ev);
var nearbyLights = _lookup.GetEntitiesInRange(ent, component.OverloadZapRadius)
.Where(e => poweredLights.HasComponent(e) && !HasComp<RevenantOverloadedLightsComponent>(e) &&
_interact.InRangeUnobstructed(e, uid, -1)).ToArray();
if (_random.Prob(component.OverloadBreakChance))
{
//values
_explosion.QueueExplosion(ent, "RevenantElectric", 15, 3, 5, canCreateVacuum: false);
}
if (!nearbyLights.Any())
continue;
//get the closest light
var allLight = nearbyLights.OrderBy(e =>
Transform(e).Coordinates.TryDistance(EntityManager, xform.Coordinates, out var dist) ? component.OverloadZapRadius : dist);
var comp = EnsureComp<RevenantOverloadedLightsComponent>(allLight.First());
comp.Target = ent; //who they gon fire at?
}
}
@@ -310,10 +319,11 @@ public sealed partial class RevenantSystem : EntitySystem
args.Handled = true;
var emo = GetEntityQuery<DiseaseCarrierComponent>();
foreach (var ent in _lookup.GetEntitiesInRange(uid, component.BlightRadius))
{
if (emo.TryGetComponent(ent, out var comp))
_disease.TryInfect(comp, component.BlightDiseasePrototypeId);
_disease.TryAddDisease(ent, component.BlightDiseasePrototypeId, comp);
}
}
private void OnMalfunctionAction(EntityUid uid, RevenantComponent component, RevenantMalfunctionActionEvent args)
@@ -327,6 +337,8 @@ public sealed partial class RevenantSystem : EntitySystem
args.Handled = true;
foreach (var ent in _lookup.GetEntitiesInRange(uid, component.MalfunctionRadius))
{
_emag.DoEmag(ent, ent); //it emags itself. spooky.
}
}
}

View File

@@ -15,14 +15,13 @@ using Content.Shared.Examine;
using Robust.Shared.Prototypes;
using Content.Shared.Actions.ActionTypes;
using Content.Shared.Tag;
using Content.Server.Polymorph.Systems;
using Content.Server.Store.Components;
using Content.Server.Store.Systems;
using Content.Shared.FixedPoint;
using Robust.Shared.Player;
using Content.Shared.Movement.Systems;
using Content.Shared.Maps;
using Content.Shared.Physics;
using Content.Shared.Revenant.Components;
namespace Content.Server.Revenant.EntitySystems;
@@ -36,14 +35,12 @@ public sealed partial class RevenantSystem : EntitySystem
[Dependency] private readonly DoAfterSystem _doAfter = default!;
[Dependency] private readonly EntityLookupSystem _lookup = default!;
[Dependency] private readonly MobStateSystem _mobState = default!;
[Dependency] private readonly PolymorphableSystem _polymorphable = default!;
[Dependency] private readonly PhysicsSystem _physics = default!;
[Dependency] private readonly StatusEffectsSystem _statusEffects = default!;
[Dependency] private readonly SharedInteractionSystem _interact = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly SharedStunSystem _stun = default!;
[Dependency] private readonly TagSystem _tag = default!;
[Dependency] private readonly MovementSpeedModifierSystem _movement = default!;
[Dependency] private readonly StoreSystem _store = default!;
public override void Initialize()
@@ -89,8 +86,6 @@ public sealed partial class RevenantSystem : EntitySystem
{
if (args.Key == "Stun")
_appearance.SetData(uid, RevenantVisuals.Stunned, false);
else if (args.Key == "Corporeal")
_movement.RefreshMovementSpeedModifiers(uid);
}
private void OnExamine(EntityUid uid, RevenantComponent component, ExaminedEvent args)
@@ -124,16 +119,15 @@ public sealed partial class RevenantSystem : EntitySystem
if (regenCap)
FixedPoint2.Min(component.Essence, component.EssenceRegenCap);
if (TryComp<StoreComponent>(uid, out var store))
_store.UpdateUserInterface(uid, store);
_alerts.ShowAlert(uid, AlertType.Essence, (short) Math.Clamp(Math.Round(component.Essence.Float() / 10f), 0, 16));
if (component.Essence <= 0)
{
component.Essence = component.EssenceRegenCap;
_polymorphable.PolymorphEntity(uid, "Ectoplasm");
QueueDel(uid);
}
if (TryComp<StoreComponent>(uid, out var store))
_store.UpdateUserInterface(uid, store);
return true;
}