What is the crafting system?
The crafting system lets us define recipes that the player can use to produce new items.
New Features in this Version
Player Crafting Craft directly from the player without using a workstation.
Workstation Overhaul Workstations received a major overhaul and are now a fully contained crafting station. You can now continue crafting items when the window is closed. They can also optionally require fuel. You can even support equipping tools that can then be used as requirements for recipes and can be used to boost the crafting yield and speed.
Crafting Queues You can now queue up recipes to be crafted back to back from both the player and workstations.
Player Crafting Settings
For the player configuration of crafting is handled on the AC_InventorySystem component you added to the Player Controller. Navigate to and expand the crafting section. You will have the following options:
enableCrafting? Enabled by default. When true will enable the crafting system for the player.
enableCraftingFromPlayer? Enabled by default. When true will enable the player crafting window (default key is V).
playerCraftingWindowTitle The title that appears on the draggable window for the player crafting UI.
playerCraftingWindowIcon The Texture 2D icon that appears to the left of the title on the draggable window for the player crafting UI.
playerCraftingContexts The contexts the player can craft recipes from. You can add multiple, and if you do categories will appear in the recipe list. The text that is used for these categories is defined inside the context data asset you selected.
craftingInputs The player storage components to use as the source of ingredients when crafting recipes in the player crafting UI. By default is inventory and hotbar.
craftingOutputs The player storage components to use as the output of produced items when crafting recipes in the player crafting UI. By default it is set to the inventory and hotbar. Rolling over into the next if the current is full.
hideLockedRecipes? Disabled by default. If you want to hide the locked recipes from the player you can enable this.
Workstation Crafting Settings
For Workstations, and anything else you create, the only setting you need to set is the Context Types in the Configuration section of the AC_Inventory_Crafting component attached to the Actor. This is what attaches the recipes to the actor.
All other variables you should leave blank. The crafting system will look for and use whatever storage component is also attached to the same owner as the input and output.
For a full breakdown and step by step instructions for creating a new workstation see the creating a new workstation chapter.
Crafting Related Event Dispatchers
There are a number of event dispatchers that you can bind into on the AC_Inventory_Crafting component to help with implementing your customizations.
For single player games you can bind into any of these events, from anywhere.
For multiplayer games you have to make sure you are binding into the right events depending on if you are working on the server or the client. Event dispatchers are broken up into Client & Server categories inside the component and you can also use the event dispatcher name to determine if it is client or server. If it ends in UI it is for the client. If it doesn’t then it is for the server. Also keep in mind for multiplayer not all events are available at both ends, it really depends on what data is transferred to the client. You may need to fill in those gaps if you need more specific events.
Queue Related Event Dispatchers
onCraftingQueueAdd Called (on the server) when a recipe is added to the queue.
onCraftingQueueRemove Called (on the server) when a recipe is removed from the queue.
onCraftingQueueDone Called (on the server) when the queue finishes all work.
onCraftingQueueUpdatedUI Called (on the client) when the crafting queue changed.
Crafting Progress Related Event Dispatchers
onCraftingTicked Called (on the server) whenever crafting progresses.
onCraftingStart Called (on the server) whenever crafting starts for a new item.
onCraftingFinish Called (on the server) whenever crafting finishes for a new item.
onCraftingBonusUI Called (on the client) when a crafted recipe achieves a bonus.
onCraftingFailedUI Called (on the client) when a crafted recipe fails.
onCraftingSecondsRemainingUI Called (on the client) when the crafting seconds remaining changes.
Recipe Related Event Dispatchers
onRecipeUnlocked Called (on the server) whenever the player unlocks a recipe.
onRecipeUnlockedUI Called (on the client) when a recipe is unlocked.
onRecipeSelectedChangeUI Called (on the client) when the player changes the selected recipe using the recipe list.
Other Event Dispatchers
onCraftingInputStorageChangeUI Called (on the client) when the crafting input changes.