GatherableSystem/Component (#8041)

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
Chris V
2022-05-12 05:53:31 -07:00
committed by GitHub
parent 0de06cb9c0
commit 6cb2a01723
12 changed files with 244 additions and 192 deletions

View File

@@ -0,0 +1,44 @@
using System.Threading;
using Content.Shared.Damage;
using Content.Shared.Sound;
namespace Content.Server.Gatherable.Components
{
/// <summary>
/// When interacting with an <see cref="GatherableComponent"/> allows it to spawn entities.
/// </summary>
[RegisterComponent]
public sealed class GatheringToolComponent : Component
{
/// <summary>
/// Sound that is made once you completed gathering
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("sound")]
public SoundSpecifier GatheringSound { get; set; } = new SoundPathSpecifier("/Audio/Items/Mining/pickaxe.ogg");
/// <summary>
/// This directly plugs into the time delay for gathering.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("gatheringTime")]
public float GatheringTime { get; set; } = 1f;
/// <summary>
/// What damage should be given to objects when
/// gathered using this tool? (0 for infinite gathering)
/// </summary>
[DataField("damage", required: true)]
public DamageSpecifier Damage { get; set; } = default!;
/// <summary>
/// How many entities can this tool gather from at once?
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("maxEntities")]
public int MaxGatheringEntities = 1;
[ViewVariables]
public readonly Dictionary<EntityUid, CancellationTokenSource> GatheringEntities = new();
}
}