Skip to content

Commit

Permalink
fix: fixed runed door repulsing
Browse files Browse the repository at this point in the history
Signed-off-by: Remuchi <[email protected]>
  • Loading branch information
Remuchi committed Nov 6, 2024
1 parent 15e9a2f commit 9044f00
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
3 changes: 1 addition & 2 deletions Content.Shared/Repulsor/RepulseComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ public sealed partial class RepulseComponent : Component
public TimeSpan StunDuration = TimeSpan.FromSeconds(3);
}

public sealed class BeforeRepulseEvent(EntityUid origin, EntityUid target) : CancellableEntityEventArgs
public sealed class BeforeRepulseEvent(EntityUid target) : CancellableEntityEventArgs
{
public EntityUid Origin = origin;
public EntityUid Target = target;
}
6 changes: 4 additions & 2 deletions Content.Shared/Repulsor/RepulseSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Shared.Interaction;
using Content.Shared.Standing;
using Content.Shared.Stunnable;
using Robust.Shared.Physics.Events;
using Robust.Shared.Physics.Systems;
Expand Down Expand Up @@ -34,7 +35,8 @@ private void OnHandInteract(Entity<RepulseComponent> repulsor, ref InteractHandE

public void Repulse(Entity<RepulseComponent> repulsor, EntityUid user)
{
var ev = new BeforeRepulseEvent(repulsor, user);
var ev = new BeforeRepulseEvent(user);
RaiseLocalEvent(repulsor, ev);
if (ev.Cancelled)
return;

Expand All @@ -43,6 +45,6 @@ public void Repulse(Entity<RepulseComponent> repulsor, EntityUid user)

_physics.ApplyLinearImpulse(user, impulse);
_stunSystem.TryStun(user, repulsor.Comp.StunDuration, true);
_stunSystem.TryKnockdown(user, repulsor.Comp.KnockdownDuration, true);
_stunSystem.TryKnockdown(user, repulsor.Comp.KnockdownDuration, true, DropHeldItemsBehavior.DropIfStanding);
}
}
14 changes: 9 additions & 5 deletions Content.Shared/WhiteDream/BloodCult/RunedDoor/RunedDoorSystem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Content.Shared.Doors;
using Content.Shared.Prying.Components;
using Content.Shared.Repulsor;
using Content.Shared.WhiteDream.BloodCult.BloodCultist;
using Content.Shared.WhiteDream.BloodCult.Constructs;

Expand All @@ -14,6 +15,7 @@ public override void Initialize()
SubscribeLocalEvent<RunedDoorComponent, BeforeDoorOpenedEvent>(OnBeforeDoorOpened);
SubscribeLocalEvent<RunedDoorComponent, BeforeDoorClosedEvent>(OnBeforeDoorClosed);
SubscribeLocalEvent<RunedDoorComponent, BeforePryEvent>(OnBeforePry);
SubscribeLocalEvent<RunedDoorComponent, BeforeRepulseEvent>(BefoRepulse);
}

private void OnBeforeDoorOpened(Entity<RunedDoorComponent> door, ref BeforeDoorOpenedEvent args)
Expand All @@ -22,9 +24,7 @@ private void OnBeforeDoorOpened(Entity<RunedDoorComponent> door, ref BeforeDoorO
return;

if (!CanInteract(user))
{
args.Cancel();
}
}

private void OnBeforeDoorClosed(Entity<RunedDoorComponent> door, ref BeforeDoorClosedEvent args)
Expand All @@ -33,16 +33,20 @@ private void OnBeforeDoorClosed(Entity<RunedDoorComponent> door, ref BeforeDoorC
return;

if (!CanInteract(user))
{
args.Cancel();
}
}

private void OnBeforePry(Entity<RunedDoorComponent> ent, ref BeforePryEvent args)
private void OnBeforePry(Entity<RunedDoorComponent> door, ref BeforePryEvent args)
{
args.Cancelled = true;
}

private void BefoRepulse(Entity<RunedDoorComponent> door, ref BeforeRepulseEvent args)
{
if (HasComp<BloodCultistComponent>(args.Target) || HasComp<ConstructComponent>(args.Target))
args.Cancel();
}

private bool CanInteract(EntityUid user)
{
return HasComp<BloodCultistComponent>(user) || HasComp<ConstructComponent>(user);
Expand Down
3 changes: 3 additions & 0 deletions Resources/Textures/WhiteDream/BloodCult/actions.rsi/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
{
"name": "final_reckoning"
},
{
"name": "gone"
},
{
"name": "lesser_construct"
},
Expand Down

0 comments on commit 9044f00

Please sign in to comment.