Jump to content

piratespawner passes world inst instead of item for DropItem call


hoxi
  • Fixed

This means items won't be dropped, which.. I haven't tested in what behavior that'd result into, but it's definitely not intended. They might be getting deleted when their owner gets removed, but given that they normally get moved into the stash, it's probably fine. It might be irreplaceable items that aren't being dropped (and then not put into the stash).

local function ProcessLoot(item, stash, owner)
    if not item:HasTag("irreplaceable") and ShouldRemoveItem(item) then
        item:Remove()

        return
    end

    if owner ~= nil and owner.components.inventory ~= nil then
        owner.components.inventory:DropItem(inst, true) -- here
    end

	if not item:HasTag("irreplaceable") then
        stash:StashLoot(item)
    end
end

 

inst being the world comes from the class constructor function at the top of the file:

return Class(function(self, inst)

 

Anyhow, nothing horrible happens due to the function in inventory component being sanitized:

function Inventory:DropItem(item, wholestack, randomdir, pos, keepoverstacked)
    if item == nil or item.components.inventoryitem == nil then
        return
    end

But there should definitely be a print line before that return statement, to report whenever item is nil or lacks the inventoryitem component, to catch such cases like this.


Steps to Reproduce

Haven't tested and compared to be able to tell, but it'd be as simple as having powder monkeys that stole something, vanish and process their loot into a stash. Might need testing with irreplaceable items specifically.




User Feedback


A developer has marked this issue as fixed. This means that the issue has been addressed in the current development build and will likely be in the next update.


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...