Skip to content

Commit

Permalink
break lights via defile ability
Browse files Browse the repository at this point in the history
Теперь ревенант не просто моргает лампочками, а бьет их!
  • Loading branch information
lexaSvarshik committed Sep 23, 2024
1 parent 61f8793 commit 8a47af4
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions Content.Server/Revenant/EntitySystems/RevenantSystem.Abilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Content.Shared.Tag;
using Content.Server.Storage.Components;
using Content.Server.Light.Components;
using Content.Server.Light.EntitySystems; //ss220 revenant buff
using Content.Server.Ghost;
using Robust.Shared.Physics;
using Content.Shared.Throwing;
Expand Down Expand Up @@ -43,6 +44,7 @@ public sealed partial class RevenantSystem
[Dependency] private readonly TileSystem _tile = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
[Dependency] private readonly PoweredLightSystem _poweredLight = default!; //ss220 revenant buff

private void InitializeAbilities()
{
Expand Down Expand Up @@ -241,6 +243,7 @@ private void OnDefileAction(EntityUid uid, RevenantComponent component, Revenant
}

var lookup = _lookup.GetEntitiesInRange(uid, component.DefileRadius, LookupFlags.Approximate | LookupFlags.Static);
var entities = _lookup.GetEntitiesInRange(uid, component.DefileRadius); //ss220 revenant buff //new one for lights breaking
var tags = GetEntityQuery<TagComponent>();
var entityStorage = GetEntityQuery<EntityStorageComponent>();
var items = GetEntityQuery<ItemComponent>();
Expand Down Expand Up @@ -269,10 +272,23 @@ private void OnDefileAction(EntityUid uid, RevenantComponent component, Revenant
TryComp<PhysicsComponent>(ent, out var phys) && phys.BodyType != BodyType.Static)
_throwing.TryThrow(ent, _random.NextAngle().ToWorldVec());

//ss220 Revenant buff start
//flicker lights
if (lights.HasComponent(ent))
_ghost.DoGhostBooEvent(ent);
//if (lights.HasComponent(ent))
// _ghost.DoGhostBooEvent(ent);
}
//break lights in defile radius
foreach (var entity in entities)
{
if (!_random.Prob(component.DefileEffectChance + 0.3f)) //slightly bigger chance to destroy a light, 80%
continue;

if (!lights.TryGetComponent(entity, out var lightComp))
continue;

_poweredLight.TryDestroyBulb(entity, lightComp);
}
//ss220 Revenant buff end
}

private void OnOverloadLightsAction(EntityUid uid, RevenantComponent component, RevenantOverloadLightsActionEvent args)
Expand Down

0 comments on commit 8a47af4

Please sign in to comment.