OnItemCraftCancelled
OxideCarbonItemCalled when an item craft is cancelled.
void OnItemCraftCancelled(ItemCraftTask local1, ItemCrafter itemCrafter)Method changed — check — the game method differs from the one the hook is recorded for in Oxide. The hook is still called, but its place may have shifted — worth checking after an update.
Parameters
- local1
- ItemCraftTask
- itemCrafter
- ItemCrafter
Return value
voidThe return value is ignored — the hook only notifies.
Example
private void OnItemCraftCancelled(ItemCraftTask local1, ItemCrafter itemCrafter)
{
Puts("OnItemCraftCancelled");
}Works in both Oxide and Carbon: Carbon loads Oxide plugins as is.
Injection point
Rust.opj (Oxide)
bool ItemCrafter.CancelTask(int)
Passes: ItemCraftTask local1, ItemCrafter itemCrafter
Method changed — checkReturnBehavior: ContinueArgumentBehavior: UseArgumentString (l1,this)Assembly-CSharp.dll
Where it is called (this branch's game code)
// …
{
return false;
}
itemCraftTask.cancelled = true;
if (owner == null)
{
return true;
}
Interface.CallHook("OnItemCraftCancelled", itemCraftTask, this);
owner.Command("note.craft_done", itemCraftTask.taskUID, 0);
if (itemCraftTask.takenItems != null && itemCraftTask.takenItems.Count > 0)
{
foreach (Item takenItem in itemCraftTask.takenItems)
{
if (takenItem != null && takenItem.amount > 0)
{
if (takenItem.IsBlueprint() && takenItem.blueprintTargetDef == itemCraftTask.blueprint.targetItem)
// …Sources: Rust.opj from OxideMod/Oxide.Rust (MIT) and hook metadata of the Carbon documentation (MIT). Method code is decompiled from this branch's server.