(Feat) Item Dqta

This commit is contained in:
2026-06-25 14:40:21 +02:00
parent 3597bacb1a
commit 931bc9c9e2
10 changed files with 372 additions and 20 deletions
@@ -102,12 +102,14 @@ namespace Ashwild.Player
/// <summary>
/// Swings on use input (gated by lock, setup and cooldown) and harvests the
/// aimed target.
/// aimed target. A depleted but non-destroyed tool (a worn-out repairable axe) is
/// unusable: the swing is blocked until it is repaired.
/// </summary>
private void HandleAttackPressed()
{
if (PlayerEvents.InputLocked) return;
if (raycastOrigin == null) return;
if (PlayerInventory.Instance != null && PlayerInventory.Instance.GetSelectedSlot().IsDepleted) return;
if (Time.time < nextSwingTime) return;
nextSwingTime = Time.time + swingCooldown;
@@ -160,6 +162,10 @@ namespace Ashwild.Player
HarvestableRegistry.Instance.RequestHitServerRpc(harvestable.Id, damage, toolId, hitDirection);
PlayerEvents.RaiseHarvestableHit(harvestable, damage);
// Wear the tool only on a real connecting hit, never on a swing into the air or a blocked clunk.
if (PlayerInventory.Instance != null)
PlayerInventory.Instance.ConsumeSelectedToolUse(1);
}
/// <summary>