1. Hi there!

    I try to use the OnItemDeployed, OnItemPickup hooks but seems they are not called at all.

    Other hooks I implement are called though.. No errors at all.

    Am I missing something here?
     
  2. Wulf

    Wulf Community Admin

    What are you doing to test them?
     
  3. A clear plugin, only 3 hooks, OnServerInitialized, and OnPluginLoaded, Both work, On the OnItemDeployed have nothing but a Puts to tell me its there.. like on the other 2.. Whatever I deploy it never gets there.. (put down a large furnace, a lamp, a box.. never gets called)

    OnEntityKill works, OnEntitySpawned works also..
     
    Last edited by a moderator: Jun 11, 2017
  4. How are you testing OnItemPickup to conclude it "isn't working", are you picking an item up? e.g sleeping bag, door
     
  5. Yes, deployed a lot of different ones, picked them up.. actually at the moment have no clue why not.. Not fast ask for help as I am first exploring everything I can think of to see why it doesn't.. It seems the hooks are not called when deploy or pick an item up.. tried a lot of different items also.. never gets there..
    Code:
    void OnItemDeployed(Deployer deployer, BaseEntity entity)
    {
        Puts("OnItemDeployed works!");
    }
    
    From the API documentation..
     
  6. It may also be picking up the item from the floor, like the duffel bags.
     
  7. Code:
    namespace Oxide.Plugins
    {
        [Info("Test", "----", "0.1.0")]
        [Description("Test")]
        class Test : RustPlugin
        {
            bool bServerReady = false;        void OnServerInitialized()
            {
                Puts("Server initialized");
                bServerReady = true;
            }        void OnPluginLoaded()
            {
                Puts("Plugin Loaded");
            }        void OnItemDropped(Item item, BaseEntity entity)
            {
                // works
                Puts("OnItemDropped works!");
            }        void OnItemPickup(Item item, BasePlayer player)
            {
                // works, but only when item is dropped??
                Puts("OnItemPickup works!");
            }        void OnItemDeployed(Deployer deployer, BaseEntity entity)
            {
                // never gets called, whatever deploy            Puts("OnItemDeployed works!!");
                if (entity is BaseOven)
                {
                    if (entity.name.Contains("furnace"))
                    {
                        Puts("Furnace Deployed!!");
                    }
                    else if (entity.name.Contains("campfire"))
                    {
                        Puts("Campfire Deployed!!");
                    }
                    else if (entity is CeilingLight || entity.name.Contains("lantern"))
                    {
                        Puts("Light Deployed!!");
                    }
                }
            }        void OnConsumeFuel(BaseOven oven, Item fuel, ItemModBurnable burnable)
            {
                // works
                if (oven.name.Contains("furnace"))
                {
                    Puts("Furnace uses Fuel");
                }
                else if (oven.name.Contains("campfire"))
                {
                    Puts("Campfire uses fuel");
                }
                else if (oven.name.Contains("light") || oven.name.Contains("lantern"))
                {
                    Puts("Light uses fuel");
                }
            }    }
    }
    
    So, when I deploy anything never calls the hook
    The pickup works when pick up a dropped item, not a deployed item like a tunalight.

    Really have no clue why the deployed does not fire at all

    -----------------------------------------------------------------
    Ok, found it, it's not OnEntityDeployed, but OnEntityBuild that fires on deploying a tunalight..
    ------------------------------------------------------------------
     
    Last edited by a moderator: Jun 12, 2017