Implants buff (#798)

This commit is contained in:
BIGZi0348
2024-12-02 00:07:54 +03:00
committed by GitHub
4 changed files with 37 additions and 6 deletions

View File

@@ -11,6 +11,7 @@ using Content.Shared.Ensnaring.Components;
using Content.Shared.IdentityManagement;
using Content.Shared.StepTrigger.Systems;
using Content.Shared.Throwing;
using Content.Shared.Popups;
namespace Content.Server.Ensnaring;
@@ -151,9 +152,11 @@ public sealed partial class EnsnareableSystem
Dirty(component.Ensnared.Value, ensnareable);
component.Ensnared = null;
_popup.PopupEntity(Loc.GetString("ensnare-component-try-free-complete", ("ensnare", ensnare)), target, target, PopupType.Medium); // WD
UpdateAlert(target, ensnareable);
var ev = new EnsnareRemoveEvent(component.WalkSpeed, component.SprintSpeed);
RaiseLocalEvent(ensnare, ev);
RaiseLocalEvent(target, ev); // WD fix from ensnare to target
}
/// <summary>

View File

@@ -23,6 +23,9 @@ using Content.Shared.Movement.Pulling.Components;
using Content.Shared.Movement.Pulling.Systems;
using Robust.Shared.Collections;
using Robust.Shared.Map.Components;
using Content.Server.Ensnaring;
using Content.Shared.Ensnaring.Components;
using System.Linq;
namespace Content.Server.Implants;
@@ -41,6 +44,7 @@ public sealed class SubdermalImplantSystem : SharedSubdermalImplantSystem
[Dependency] private readonly EntityLookupSystem _lookupSystem = default!;
[Dependency] private readonly SharedMapSystem _mapSystem = default!;
[Dependency] private readonly IdentitySystem _identity = default!; // WD
[Dependency] private readonly EnsnareableSystem _ensnareable = default!; // WD
private EntityQuery<PhysicsComponent> _physicsQuery;
private HashSet<Entity<MapGridComponent>> _targetGrids = [];
@@ -84,11 +88,26 @@ public sealed class SubdermalImplantSystem : SharedSubdermalImplantSystem
private void OnFreedomImplant(EntityUid uid, SubdermalImplantComponent component, UseFreedomImplantEvent args)
{
if (!TryComp<CuffableComponent>(component.ImplantedEntity, out var cuffs) || cuffs.Container.ContainedEntities.Count < 1)
return;
// WD EDIT START
var ensnareCheck = TryComp<EnsnareableComponent>(component.ImplantedEntity, out var ensnareable) && ensnareable.Container.ContainedEntities.Count > 0;
if (ensnareCheck && ensnareable != null)
{
var ensnaringUid = ensnareable.Container.ContainedEntities.First();
if (TryComp<EnsnaringComponent>(ensnaringUid, out var ensnaringComp))
_ensnareable.ForceFree(ensnaringUid, ensnaringComp);
}
_cuffable.Uncuff(component.ImplantedEntity.Value, cuffs.LastAddedCuffs, cuffs.LastAddedCuffs);
args.Handled = true;
var cuffCheck = TryComp<CuffableComponent>(component.ImplantedEntity, out var cuffs) && cuffs.Container.ContainedEntities.Count > 0;
if (cuffCheck && cuffs != null && component.ImplantedEntity != null)
{
_cuffable.Uncuff(component.ImplantedEntity.Value, cuffs.LastAddedCuffs, cuffs.LastAddedCuffs);
}
if (ensnareCheck || cuffCheck)
{
args.Handled = true;
}
// WD EDIT END
}
private void OnActivateImplantEvent(EntityUid uid, SubdermalImplantComponent component, ActivateImplantEvent args)

View File

@@ -18,7 +18,7 @@ public sealed class NeuroStabilizationSystem : EntitySystem
private void BeforeStaminaDamage(Entity<NeuroStabilizationComponent> ent, ref BeforeStaminaDamageEvent args)
{
args.Cancelled = true;
Electrocute(ent, (int) MathF.Round(args.Value * 2f / 3f));
Electrocute(ent, (int) MathF.Round(args.Value * 2f / 4f));
}
public void Electrocute(EntityUid uid, int damage, StatusEffectsComponent? status = null)

View File

@@ -4,6 +4,8 @@ using Content.Shared.Speech.EntitySystems;
using Content.Shared.Standing;
using Content.Shared.StatusEffect;
using Content.Shared.Stunnable;
using Content.Shared._White.Implants.NeuroControl;
using Content.Shared.Electrocution;
using Robust.Shared.Timing;
namespace Content.Shared._White.Item.DelayedKnockdown;
@@ -14,6 +16,7 @@ public sealed class DelayedKnockdownOnHitSystem : EntitySystem
[Dependency] private readonly SharedJitteringSystem _jitter = default!;
[Dependency] private readonly SharedStutteringSystem _stutter = default!;
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly SharedElectrocutionSystem _electrocution = default!;
public override void Initialize()
{
@@ -36,6 +39,12 @@ public sealed class DelayedKnockdownOnHitSystem : EntitySystem
if (!TryComp(uid, out StandingStateComponent? standingState) || !standingState.CanLieDown)
continue;
if (HasComp<NeuroStabilizationComponent>(uid))
{
_electrocution.TryDoElectrocution(uid, null, 5, TimeSpan.FromSeconds(1), false, 0.5f, null, true);
continue;
}
if (jitterTime > TimeSpan.Zero)
_jitter.DoJitter(uid, jitterTime, true, status: statusEffects);
if (stutterTime > TimeSpan.Zero)