I've alreadt tried:
Code:private void OnItemCraftFinished(ItemCraftTask task, Item item) { return; }And when I try to use the OnItemCraftCode:private void OnItemCraftFinished(ItemCraftTask task, Item item) { item.amout = 0; }
hook I get: "The type or namespace name `BlueprintDataBlock' could not be found. Are you missing an assembly reference?"Code:OnItemCraft(CraftingInventory inventory, BlueprintDataBlock blueprint, int amount, ulong startTime)
Deny a player to craft something
Discussion in 'Rust Development' started by zearthur99, Dec 27, 2015.
-
Use
Just return an empty ItemCraftTaskCode:void OnItemCraft(ItemCraftTask item) { Puts("OnItemCraft works!"); } -
Did you mean this?
Code:void OnItemCraft(ItemCraftTask item) { item.amount = 0; } -
You need to actually return that item then.
return item; -
Calytic Community Admin Community Mod
CraftingController and ComponentBlocker both do this. Here is the method from ComponentBlocker
Code:object OnItemCraft(ItemCraftTask task) { ItemDefinition def = task.blueprint.targetItem; if (isBlocked(def.displayName.english, def.shortname)) // check if the item being crafted is blocked (reference ComponentBlocker) { task.cancelled = true; return false; // cancels crafting of item } return null; // does nothing, continue crafting }
