Weapons/Components/EquipmentComponent.cs

Base component class for weapon equipment parts. It caches the parent Equipment on awake, exposes a protected Equipment property, a Player shortcut bound to Equipment.Owner, and helper methods to bind tags. Also defines an empty attribute type EquipmentResourcePropertyAttribute.

namespace KOTH;

// TODO : revisit
[Icon("track_changes")]
public abstract class EquipmentComponent : Component
{
	protected Equipment Equipment { get; set; }

	protected PlayerPawn Player => Equipment.Owner;

	protected void BindTag(string tag, Func<bool> predicate) => Equipment.BindTag(tag, predicate);

	protected override void OnAwake()
	{
		// Cache the weapon on awake
		Equipment = Components.Get<Equipment>(FindMode.EverythingInSelfAndAncestors);

		base.OnAwake();
	}
}

[AttributeUsage(AttributeTargets.Property)]
public sealed class EquipmentResourcePropertyAttribute : Attribute
{

}