Proto-kinetic crusher (#16277)
Co-authored-by: AJCM-git <60196617+AJCM-git@users.noreply.github.com>
This commit is contained in:
@@ -6,5 +6,9 @@ namespace Content.Server.Gatherable.Components;
|
||||
[RegisterComponent]
|
||||
public sealed class GatheringProjectileComponent : Component
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// How many more times we can gather.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("amount")]
|
||||
public int Amount = 1;
|
||||
}
|
||||
|
||||
@@ -17,12 +17,16 @@ public sealed partial class GatherableSystem
|
||||
{
|
||||
if (!args.OtherFixture.Hard ||
|
||||
args.OurFixture.ID != SharedProjectileSystem.ProjectileFixture ||
|
||||
component.Amount <= 0 ||
|
||||
!TryComp<GatherableComponent>(args.OtherEntity, out var gatherable))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Gather(args.OtherEntity, uid, gatherable);
|
||||
QueueDel(uid);
|
||||
component.Amount--;
|
||||
|
||||
if (component.Amount <= 0)
|
||||
QueueDel(uid);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user