Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Spatison committed Dec 8, 2024
1 parent c048249 commit 752f710
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,6 @@ private void FreePenetrated(EntityUid uid, PenetratedProjectileComponent compone
_penetrated.FreePenetrated(penetratedUid);

if (TryComp<EmbeddableProjectileComponent>(uid, out var embeddable))
_projectile.Embed(uid, penetratedUid, null, embeddable, false);
_projectile.Embed(uid, penetratedUid, null, embeddable, null, false);
}
}
13 changes: 10 additions & 3 deletions Content.Shared/Projectiles/SharedProjectileSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Content.Shared.Interaction;
using Content.Shared.Physics;
using Content.Shared.Popups;
using Content.Shared.Targeting;
using Content.Shared.Throwing;
using Content.Shared.UserInterface;
using Robust.Shared.Audio.Systems;
Expand Down Expand Up @@ -150,7 +151,7 @@ private void OnEmbedProjectileHit(EntityUid uid, EmbeddableProjectileComponent c
}
}

public void Embed(EntityUid uid, EntityUid target, EntityUid? user, EmbeddableProjectileComponent component, bool raiseEvent = true) // WD EDIT
public void Embed(EntityUid uid, EntityUid target, EntityUid? user, EmbeddableProjectileComponent component, TargetBodyPart? targetPart = null, bool raiseEvent = true) // WD EDIT
{
// WD EDIT START
if (!TryComp<PhysicsComponent>(uid, out var physics)
Expand Down Expand Up @@ -224,7 +225,6 @@ private void OnAttemptPacifiedThrow(Entity<EmbeddableProjectileComponent> ent, r
args.Cancel("pacified-cannot-throw-embed");
}


private void OnExamined(EntityUid uid, EmbeddableProjectileComponent component, ExaminedEvent args)
{
if (!(component.Target is {} target))
Expand Down Expand Up @@ -276,18 +276,25 @@ private bool AttemptEmbedRemove(EntityUid uid, EntityUid user, EmbeddableProject
|| physics.BodyType != BodyType.Static)
return false;

if (component.Target is {} targetUid)
_popup.PopupClient(Loc.GetString("throwing-embed-remove-alert-owner", ("item", uid), ("other", user)),
user, targetUid);

_doAfter.TryStartDoAfter(new DoAfterArgs(EntityManager, user, component.RemovalTime.Value,
new RemoveEmbeddedProjectileEvent(), eventTarget: uid, target: uid)
{
DistanceThreshold = SharedInteractionSystem.InteractionRange,
BreakOnUserMove = true,
BreakOnTargetMove = true,
NeedHand = true,
});

return true;
}

private void FreePenetrated(EntityUid uid, PenetratedProjectileComponent? penetratedProjectile = null)
{
if (!Resolve(uid, ref penetratedProjectile)
if (!Resolve(uid, ref penetratedProjectile, false)
|| !penetratedProjectile.PenetratedUid.HasValue)
return;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- type: entity
name: energy sword
parent: BaseItem
id: EnergySword
id: EnergySwordBase
description: A very loud & dangerous sword with a beam made of pure, concentrated plasma. Cuts through unarmored targets like butter.
abstract: true
components:
Expand Down

0 comments on commit 752f710

Please sign in to comment.