hello!
Iam trying to fix bug in Hunt RPG - Mod always show how much time I economy of craft item. But show it for 1 item. I wana do for all items in queue, but dont know how to do this...
Code:public ItemCraftTask OnItemCraft(ItemCraftTask item) { BasePlayer player = item.owner; var itemName = item.blueprint.targetItem.displayName.translated.ToLower(); if (!ItemTable.ContainsKey(itemName)) return null; var blueprintTime = ItemTable[itemName].BlueprintTime; var rpgInfo = RPGInfo(player); float craftingTime = blueprintTime; float craftingReducer = RPGHelper.GetCraftingReducer(rpgInfo, MaxStatsTable[HRK.IntCraftingReducer]); var amountToReduce = (craftingTime*craftingReducer); float reducedCraftingTime = craftingTime - amountToReduce; item.blueprint.time = reducedCraftingTime; if(rpgInfo.Preferences.ShowCraftMessage) ChatMessage(player, String.Format("Crafting will end in {0:F} seconds. Reduced in {1:F} seconds", reducedCraftingTime, amountToReduce)); return item; }
C# Get all crafting queue
Discussion in 'Rust Development' started by DiWorm, Jun 21, 2015.
-
Using this will give you the list of crating items for a player...
Code:player.inventory.crafting.queue
-
Crafting tasks actually... Each task has an amount. You could be crafting 200 spears and have 1 task with a 200 amount for instance. The OnItemCraft is called once per task (not for each subitem) but the OnItemCraftFinished hook is called each time an item is crafted.
-
Thanks

