When i use this code, and player click to "Craft all" in blueprint its delete from inventory ingredients, but for some reason not delete blueprint. Maybe someone have some ideas of how it can be fixed?Code:private object OnItemCraft(ItemCraftTask task, BasePlayer crafter) { return true; }
Solved Using OnItemCraft with new blueprints?
Discussion in 'Rust Development' started by Estex, Sep 1, 2016.
-
Wulf Community Admin
When you return true, you're stopping the crafting from completing.
-
I know, but its delete from inventory ingredients and its actualy ok for me, but not ok that its not delete blueprint
-
Wulf Community Admin
Are you trying to stop it or what? Returning anything other than null will change the outcome. -
Yes and no, i dont want that craft go on, but want that ingredients and blueprint deleted from inventory, thats why "return true" was good for me until they add blueprint with button "Craft all" haha
-
Once you push the button "Craft all" and have all the ingredience in your inventory For example:
Blueprint with that item will not dissapear, resources dissapeared(that required for crafting) and 7 crafted items appeared.
The reason why blueprints exists after craft - we can not solve.
This problem has already in Magic Craft plugin -
@Wulf Seems an additional parameter must be passed to the hook (Item fromTempBlueprint).
So the plugin may know that blueprint are used.
Or.. move hook a little bit down, down to queue.Enqueue(task) and let server handle the blueprints :]
Code:object[] args = new object[] { task, owner }; // fromTempBlueprint here object obj2 = Interface.CallHook("OnItemCraft", args); if (obj2 is bool) { return (bool) obj2; } if (fromTempBlueprint != null) { fromTempBlueprint.RemoveFromContainer(); task.takenItems.Add(fromTempBlueprint); task.conditionScale = 0.5f; } // or move the hook here this.queue.Enqueue(task);Last edited by a moderator: Sep 2, 2016 -
Wulf Community Admin
@Mughisi has a change for this that he should be pushing soon.
