Development status
Crafting is still in development and has not been fully validated. Its interfaces and behavior may change. The following describes the current immediate-crafting code for development and testing; it is not a production-ready guarantee.
Recipe and request
- Create an item definition and add
GIS_ItemFragment_CraftingRecipe. ConfigureInputItems, optionalInputCurrencies, andOutputItems. Entries need valid definitions and positive amounts; the output list must not be empty. - Add a
GIS_CraftingSystemComponentto an appropriate Actor and prepare the inventory paying the costs. Currency costs also require a currency system for that inventory. - Build an
FGIS_CraftingRequestwith the recipe, quantity, andCostInventory. Optionally specify a differentOutputInventory, input collection tags, and output collection tag. An unset output inventory falls back to the cost inventory; empty input tags select non-ignored collections.
Evaluate and commit
Call CanCraftRequest and inspect the costs, planned outputs, and failure reason in FGIS_CraftingResult. Evaluation does not commit inventory changes; inventory may change afterward.
Call CraftRequest on the server authority. It reevaluates the request, removes item and currency costs, and adds outputs; the current implementation invokes rollback when a commit fails. The project must validate permissions, concurrency, capacity changes, and recovery in custom extensions. A successful preview does not guarantee a later commit.
The legacy Craft / CanCraft convenience calls use the same inventory for costs and outputs. Use request APIs for separate inventories or detailed results. Custom implementations should inspect hooks such as EvaluateCraftingRequest, RemoveItemIngredients, AddCraftingOutputs, and RollbackCraftingCommit and test the complete transaction.
Suggested testing
In an isolated test project cover insufficient items or currency, invalid recipes, rejected output collections, different cost and output inventories, recovery from commit failure, and multiplayer authority. A UI Context in the companion project is not evidence of a complete crafting example; see Companion Project and Example Assets.