Merge remote-tracking branch 'origin/feat/inport-props' into feat/craft-discovery
# Conflicts: # Assets/External/Animated PBR Chest Demo/Materials/WoodChest.mat # Packages/com.distantlands.cozy.core/Content/Integration/Import for BiRP.unitypackage.meta # Packages/com.distantlands.cozy.core/Content/Integration/Import for HDRP.unitypackage.meta # Packages/com.distantlands.cozy.core/Content/Integration/Import for URP.unitypackage.meta
This commit is contained in:
@@ -3,6 +3,11 @@ using Ashwild.Inventory;
|
||||
|
||||
namespace Ashwild.Crafting
|
||||
{
|
||||
/// <summary>
|
||||
/// Authoring data for one craftable result: what it produces, what it costs, and where it can be
|
||||
/// crafted. Pure data — the craft itself is performed by CraftingManager, which owns the player
|
||||
/// and discovery rules on top of what is declared here.
|
||||
/// </summary>
|
||||
[CreateAssetMenu(fileName = "NewRecipe", menuName = "Items/Crafting Recipe")]
|
||||
public class CraftingRecipe : ScriptableObject
|
||||
{
|
||||
@@ -11,6 +16,10 @@ namespace Ashwild.Crafting
|
||||
[SerializeField] private ItemData resultItem;
|
||||
[SerializeField] private int resultQuantity = 1;
|
||||
|
||||
[Header("Station")]
|
||||
[Tooltip("None = craftable bare-handed AND on every station. Any other value restricts this recipe to that station.")]
|
||||
[SerializeField] private CraftingStationType requiredStation = CraftingStationType.None;
|
||||
|
||||
[Header("Ingredients")]
|
||||
[SerializeField] private CraftingIngredient[] ingredients;
|
||||
|
||||
@@ -20,6 +29,17 @@ namespace Ashwild.Crafting
|
||||
public int ResultQuantity => resultQuantity;
|
||||
public CraftingIngredient[] Ingredients => ingredients;
|
||||
|
||||
/// <summary>
|
||||
/// The station this recipe must be crafted on, or <see cref="CraftingStationType.None"/> when it
|
||||
/// needs none.
|
||||
/// </summary>
|
||||
public CraftingStationType RequiredStation => requiredStation;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the given inventory holds enough of every ingredient to craft this recipe the given
|
||||
/// number of times. Purely a resource check — discovery and station rules are enforced by
|
||||
/// CraftingManager on top of it.
|
||||
/// </summary>
|
||||
public bool CanCraft(PlayerInventory inventory, int count = 1)
|
||||
{
|
||||
for (int i = 0; i < ingredients.Length; i++)
|
||||
|
||||
Reference in New Issue
Block a user