OnItemCraftFinished
OxideCarbonItemCalled when an item craft finishes.
void OnItemCraftFinished(ItemCraftTask task, Item 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
- task
- ItemCraftTask
- local1
- Item
- itemCrafter
- ItemCrafter
Return value
voidThe return value is ignored — the hook only notifies.
Example
private void OnItemCraftFinished(ItemCraftTask task, Item local1, ItemCrafter itemCrafter)
{
Puts("OnItemCraftFinished");
}Works in both Oxide and Carbon: Carbon loads Oxide plugins as is.
Injection point
Rust.opj (Oxide)
void ItemCrafter.FinishCrafting(ItemCraftTask)
Passes: ItemCraftTask task, Item local1, ItemCrafter itemCrafter
Method changed — checkReturnBehavior: ContinueArgumentBehavior: UseArgumentString (a0, l1,this)Assembly-CSharp.dll
Where it is called (this branch's game code)
// …
{
break;
}
}
}
task.takenItems?.RemoveAll((Item item2) => item2.amount == 0);
Analytics.Azure.OnCraftItem(item.info.shortname, item.amount, baseEntity, task.workbenchEntity, inSafezone, item.skin);
owner.Command("note.craft_done", task.taskUID, 1, task.amount);
Interface.CallHook("OnItemCraftFinished", task, item, this);
if (task.instanceData != null)
{
item.instanceData = task.instanceData;
}
if (!string.IsNullOrEmpty(task.blueprint.UnlockAchievment))
{
owner.GiveAchievement(task.blueprint.UnlockAchievment);
}
// …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.