1. Code:
     private object OnItemCraft(ItemCraftTask task, BasePlayer crafter)
            {
                 return true;
            }
    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?
     
  2. Wulf

    Wulf Community Admin

    When you return true, you're stopping the crafting from completing.
     
  3. I know, but its delete from inventory ingredients and its actualy ok for me, but not ok that its not delete blueprint
     
  4. Wulf

    Wulf Community Admin

    Are you trying to stop it or what? Returning anything other than null will change the outcome.
     
  5. 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
     
  6. Once you push the button "Craft all" and have all the ingredience in your inventory For example:

    upload_2016-9-1_4-23-10.png


    Blueprint with that item will not dissapear, resources dissapeared(that required for crafting) and 7 crafted items appeared.
    upload_2016-9-1_4-24-38.png

    The reason why blueprints exists after craft - we can not solve.
    This problem has already in Magic Craft plugin
     
  7. @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
  8. Wulf

    Wulf Community Admin

    @Mughisi has a change for this that he should be pushing soon. :)