Merge branch 'feat/building' into feat/craft-discovery

This commit is contained in:
2026-07-09 21:38:31 +02:00
12 changed files with 519 additions and 242 deletions
@@ -25,6 +25,8 @@ namespace Ashwild.Player
public static bool IsBuildMenuOpen { get; private set; }
// True while a build ghost is being positioned in the world (menu closed, no structure placed yet).
public static bool IsPlacingBuild { get; private set; }
// True while the build hammer is in demolition mode (right-click held, menu closed, not placing).
public static bool IsDemolishing { get; private set; }
public static bool IsPaused { get; private set; }
// True when a networked session is live (host or client).
@@ -52,11 +54,13 @@ namespace Ashwild.Player
public static event Action CrouchPressed;
public static event Action AttackPressed;
public static event Action SecondaryUsePressed; // right-click / secondary use (build menu, aim, block, ...)
public static event Action<bool> SecondaryUseHeld; // right-click pressed (true) / released (false) — for tap-vs-hold gestures
public static event Action InteractPressed;
public static event Action DropPressed;
public static event Action InventoryTogglePressed;
public static event Action<int> HotbarSlotPressed;
public static event Action<float> HotbarScroll;
public static event Action BuildRotatePressed; // rotate the build ghost one step (R key) while placing
public static event Action CancelPressed; // UI "Cancel" (Escape) — back / pause / close
// ============================================================
@@ -130,6 +134,7 @@ namespace Ashwild.Player
public static event Action BuildMenuToggleRequested; // the build hammer asks to open/close the construction menu
public static event Action<bool> BuildMenuOpenChanged; // the construction menu opened (true) or closed (false)
public static event Action<bool> BuildPlacingChanged; // a build ghost started (true) / stopped (false) being positioned
public static event Action<bool> DemolishModeChanged; // the hammer entered (true) / left (false) demolition mode (right-click held)
// ============================================================
// Cooking events
@@ -184,11 +189,13 @@ namespace Ashwild.Player
public static void RaiseCrouchPressed() { Log(nameof(CrouchPressed)); CrouchPressed?.Invoke(); }
public static void RaiseAttackPressed() { Log(nameof(AttackPressed)); AttackPressed?.Invoke(); }
public static void RaiseSecondaryUsePressed() { Log(nameof(SecondaryUsePressed)); SecondaryUsePressed?.Invoke(); }
public static void RaiseSecondaryUseHeld(bool held) { Log(nameof(SecondaryUseHeld)); SecondaryUseHeld?.Invoke(held); }
public static void RaiseInteractPressed() { Log(nameof(InteractPressed)); InteractPressed?.Invoke(); }
public static void RaiseDropPressed() { Log(nameof(DropPressed)); DropPressed?.Invoke(); }
public static void RaiseInventoryTogglePressed() { Log(nameof(InventoryTogglePressed)); InventoryTogglePressed?.Invoke(); }
public static void RaiseHotbarSlotPressed(int i) { Log(nameof(HotbarSlotPressed)); HotbarSlotPressed?.Invoke(i); }
public static void RaiseHotbarScroll(float f) { HotbarScroll?.Invoke(f); }
public static void RaiseBuildRotatePressed() { Log(nameof(BuildRotatePressed)); BuildRotatePressed?.Invoke(); }
public static void RaiseCancelPressed() { Log(nameof(CancelPressed)); CancelPressed?.Invoke(); }
public static void RaiseGroundedChanged(bool grounded, float impactSpeed)
@@ -298,6 +305,17 @@ namespace Ashwild.Player
BuildPlacingChanged?.Invoke(placing);
}
/// <summary>
/// Toggles demolition mode (right-click held with the hammer out). Owner-side only; the
/// hammer raises it and BuildManager drives the world-facing targeting/destroy from it.
/// </summary>
public static void RaiseDemolishModeChanged(bool on)
{
IsDemolishing = on;
Log(nameof(DemolishModeChanged));
DemolishModeChanged?.Invoke(on);
}
public static void RaiseFoodPlacedToCook(ItemData raw) { Log(nameof(FoodPlacedToCook)); FoodPlacedToCook?.Invoke(raw); }
public static void RaiseFoodCookedReady(ItemData cooked) { Log(nameof(FoodCookedReady)); FoodCookedReady?.Invoke(cooked); }
public static void RaiseFuelAdded(ItemData fuel) { Log(nameof(FuelAdded)); FuelAdded?.Invoke(fuel); }
@@ -380,6 +398,7 @@ namespace Ashwild.Player
IsChestOpen = false;
IsBuildMenuOpen = false;
IsPlacingBuild = false;
IsDemolishing = false;
IsPaused = false;
HoveredInteractable = null;
}