Jump to content

in scenarios, "loot" must be a local


Serpens
  • Fixed

E.g the scenario "chest_foodspoil" contains:
 

chestfunctions = require("scenarios/chestfunctions")
loot =
{
    {
        item = "spoiled_food",
        count = 10
    },
    {
        item = "blueprint",
        count = 4,
    },
}

and the scenario "chest_explosive" contains:
 

chestfunctions = require("scenarios/chestfunctions")
loot =
{
    {
        item = "firestaff",
        --initfn = function(inst) inst.components.finiteuses:SetUses(TUNING.ICESTAFF_USES*math.random()) end,
        count = 1
    },
    {
        item = "ash",
        count = 10
    },
    {
        item = "gunpowder",
        count = 4
    },
    {
        item = "log",
        count = 4
    },
}

I'm quite sure that it has to be
local loot =

Because when spawning some chests with theses scenario, the chests will contain wrong items. See "Steps to reproduce"

Same of course for every other sceanrio or file that doesn't use local variables...


Steps to Reproduce
Spawn a chest with "chest_explosive" and a chest with "chest_foodspoil". Open both of them. They will contain the same items, although they should be different. This is because the same (global) loot variable is used, instead of an local one.



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.
23 hours ago, Serpens said:

How about:
chest_insanity.lua
chest_presummer.lua
chest_winter.lua
 

 

These have been fixed as well for the next patch. Thanks!

  • Like 1

Share this comment


Link to comment
Share on other sites



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...