Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Trown Item / Брошенный Предмет #44

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Content.Shared/Throwing/ThrownItemComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,7 @@ public sealed partial class ThrownItemComponent : Component
/// </summary>
[DataField]
public Vector2? OriginalScale = null;

public readonly List<EntityUid> Processed = new(); // WD EDIT
}
}
11 changes: 9 additions & 2 deletions Content.Shared/Throwing/ThrownItemSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,13 @@ private void HandleCollision(EntityUid uid, ThrownItemComponent component, ref S
if (args.OtherEntity == component.Thrower)
return;

// WD EDIT START
if (component.Processed.Contains(args.OtherEntity))
return;
// WD EDIT END

ThrowCollideInteraction(component, args.OurEntity, args.OtherEntity);
component.Processed.Add(args.OtherEntity); // WD EDIT
}

private void PreventCollision(EntityUid uid, ThrownItemComponent component, ref PreventCollideEvent args)
Expand Down Expand Up @@ -110,6 +116,7 @@ public void StopThrow(EntityUid uid, ThrownItemComponent thrownItemComponent)

EntityManager.EventBus.RaiseLocalEvent(uid, new StopThrowEvent { User = thrownItemComponent.Thrower }, true);
EntityManager.RemoveComponent<ThrownItemComponent>(uid);
thrownItemComponent.Processed.Clear(); // WD EDIT
}

public void LandComponent(EntityUid uid, ThrownItemComponent thrownItem, PhysicsComponent physics, bool playSound)
Expand Down Expand Up @@ -137,10 +144,10 @@ public void ThrowCollideInteraction(ThrownItemComponent component, EntityUid thr
_adminLogger.Add(LogType.ThrowHit, LogImpact.Low,
$"{ToPrettyString(thrown):thrown} thrown by {ToPrettyString(component.Thrower.Value):thrower} hit {ToPrettyString(target):target}.");

if (component.Thrower is not null)// Nyano - Summary: Gotta check if there was a thrower.
if (component.Thrower is not null)// Nyano - Summary: Gotta check if there was a thrower.
RaiseLocalEvent(target, new ThrowHitByEvent(component.Thrower.Value, thrown, target, component), true); // Nyano - Summary: Gotta update for who threw it.
else
RaiseLocalEvent(target, new ThrowHitByEvent(null, thrown, target, component), true); // Nyano - Summary: No thrower.
RaiseLocalEvent(target, new ThrowHitByEvent(null, thrown, target, component), true); // Nyano - Summary: No thrower.
RaiseLocalEvent(thrown, new ThrowDoHitEvent(thrown, target, component), true);
}

Expand Down
Loading