CraftingRecipe.cs
using Sandbox;
using System.Collections.Generic;
[AssetType( Extension = "recipe" )]
public class CraftingRecipe : GameResource
{
[Property] public string RecipeName { get; set; } = "New Recipe";
[Property, TextArea] public string Description { get; set; } = "";
[Property] public InventoryItem ResultItem { get; set; }
[Property, Range( 1, 999 )] public int ResultQuantity { get; set; } = 1;
[Property] public List<CraftIngredient> Ingredients { get; set; } = new();
/// <summary>
/// How long one craft takes in seconds. Set to 0 for instant.
/// </summary>
[Property, Range( 0f, 300f )] public float CraftTime { get; set; } = 2f;
/// <summary>
/// If true, this recipe only appears when the player is at a CraftingStation
/// that includes it in its Recipes list.
/// </summary>
[Property] public bool RequiresCraftingStation { get; set; } = false;
}
public struct CraftIngredient
{
[Property] public InventoryItem Item { get; set; }
[Property, Range( 1, 999 )] public int Amount { get; set; }
}