Implemented CanCraft hook (Rust)

Discussion in 'Feature Suggestions' started by serezhadelaet, Nov 2, 2016.

  1. serezhadelaet

    serezhadelaet Plugin Developer

    Hello.
    As you know, soon we will get new game system.
    But not every one want search ingredients for craft.
    I'm sure, that many server owners will be glad to see some bypass or tuningingredients for craft.
    Code (Text):

    private bool DoesHaveUsableItem(int item, int iAmount)
    {
        int num = 0;
        foreach (global::ItemContainer current in this.containers)
        {
            num += current.GetAmount(item, true);
        }
        return num >= iAmount;
    }

    public bool CanCraft(ItemBlueprint bp, int amount = 1)
    {
        foreach (ItemAmount current in bp.ingredients)
        {
            if (!this.DoesHaveUsableItem(current.itemid, (int)current.amount * amount))
            {
                return false;
            }
        }
        return true;
    }
    This is prerelease check for ingredients and other items for craft.
    What we can do? :)
     
  2. Mughisi

    Mughisi Community Mod Oxide Developer

    Added CanCraft locally, it should be included in the next build.