Jump to content

Item Deletion Issue (durability items)

Pending 1.4.2

Somescrub
Somescrub

Posted

I'm not sure if it occurred with one of the Naval Update hotfixes, or the March update... but items with durability that are worn are deleting other worn items when reaching 0 durability. I am running a lot of other plugins, but I did troubleshoot this over the last 12 or so hours and was able to pinpoint it to this.

I specifically rewrote your randomitem.condition logic below and it is working as expected now:
 

if (randomitem.condition <= 0f)
{
    if (!configData.popoff)
    {
        // Leave broken armor in place. Do not remove/reinsert it.
        return null;
    }

    NextTick(() =>
    {
        if (randomitem == null || randomitem.info == null)
            return;

        if (configData.toinventory)
        {
            if (!target.inventory.containerMain.IsFull())
            {
                if (!randomitem.MoveToContainer(target.inventory.containerMain))
                {
                    randomitem.Drop(target.transform.position, target.eyes.BodyForward() * 1.5f);
                }
            }
            else
            {
                randomitem.Drop(target.transform.position, target.eyes.BodyForward() * 1.5f);
            }
        }
        else
        {
            randomitem.Drop(target.transform.position, target.eyes.BodyForward() * 1.5f);
        }
    });
}

 

Kaucsenta

Posted

On 3/8/2026 at 3:16 AM, Somescrub said:

I'm not sure if it occurred with one of the Naval Update hotfixes, or the March update... but items with durability that are worn are deleting other worn items when reaching 0 durability. I am running a lot of other plugins, but I did troubleshoot this over the last 12 or so hours and was able to pinpoint it to this.

I specifically rewrote your randomitem.condition logic below and it is working as expected now:
 

if (randomitem.condition <= 0f)
{
    if (!configData.popoff)
    {
        // Leave broken armor in place. Do not remove/reinsert it.
        return null;
    }

    NextTick(() =>
    {
        if (randomitem == null || randomitem.info == null)
            return;

        if (configData.toinventory)
        {
            if (!target.inventory.containerMain.IsFull())
            {
                if (!randomitem.MoveToContainer(target.inventory.containerMain))
                {
                    randomitem.Drop(target.transform.position, target.eyes.BodyForward() * 1.5f);
                }
            }
            else
            {
                randomitem.Drop(target.transform.position, target.eyes.BodyForward() * 1.5f);
            }
        }
        else
        {
            randomitem.Drop(target.transform.position, target.eyes.BodyForward() * 1.5f);
        }
    });
}

 

If i remember correcty, the deleted part regarding the item storage in a temporary inventory slot is to refresh the visual information regarding the broken state, otherwise it gives a false impression to the player, that the item broken, but still provide the full stats. It meant to place back on the original slot the broken item. I will take a look on this when i have time, but the original code shall have no more overrite issue.
Please post your full configuration for debug purpose.

Side note, please do not post even a partial code of a paid plugin. In case of code suggestion, send a private message with the details.

2.3m

Downloads

Total number of downloads.

10.6k

Customers

Total customers served.

152.6k

Files Sold

Total number of files sold.

3.3m

Payments Processed

Total payments processed.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.