MidrealmDM Posted February 15, 2019 Share Posted February 15, 2019 So recently previously working mod code has stopped working. Now, the game crashes (veggies.lua} when this runs. There is no line 351 in veggies.lua [00:00:07]: scripts/mods.lua(220,1) Mod: waiter-381565292 (Waiter 101 v5.0x) Error loading mod! .../common/dont_starve/data/scripts/prefabs/veggies.lua:351: variable 'MakePlacer' is not declared LUA ERROR stack traceback: =[C] in function 'error' D:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/strict.lua(23,1) D:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/prefabs/veggies.lua(351,1) in function 'MakeVeggie' D:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/prefabs/veggies.lua(357,1) in main chunk =[C] in function 'require' D:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/../mods/waiter-381565292/modmain.lua(242,1) in main chunk =[C] in function 'xpcall' I'm sure this had to do with the inttroduction of Wormwood since he can now plant seeds anywhere... It appears Klei has changed the way the game determines crops resulting from seeds,,, but I cant seem to figure out how to fix it. There appears to be a function in seeds.lua that looks into Veggies.lua ...\common\dont_starve\data\scripts\prefabs\seeds.lua Spoiler local function pickproduct(inst) local total_w = 0 for k,v in pairs(VEGGIES) do total_w = total_w + (v.seed_weight or 1) end local rnd = math.random()*total_w for k,v in pairs(VEGGIES) do rnd = rnd - (v.seed_weight or 1) if rnd <= 0 then return k end end return "carrot" end I think I would need to insert/append my data into the Veggies.lua VEGGIES table.. ...\common\dont_starve\data\scripts\prefabs\veggies.lua Spoiler VEGGIES = { cave_banana = MakeVegStats(0, TUNING.CALORIES_SMALL, TUNING.HEALING_TINY, TUNING.PERISH_MED, 0, TUNING.CALORIES_SMALL, TUNING.HEALING_SMALL, TUNING.PERISH_FAST, 0), carrot = MakeVegStats(COMMON, TUNING.CALORIES_SMALL, TUNING.HEALING_TINY, TUNING.PERISH_MED, 0, TUNING.CALORIES_SMALL, TUNING.HEALING_SMALL, TUNING.PERISH_FAST, 0), corn = MakeVegStats(COMMON, TUNING.CALORIES_MED, TUNING.HEALING_SMALL, TUNING.PERISH_MED, 0, TUNING.CALORIES_SMALL, TUNING.HEALING_SMALL, TUNING.PERISH_SLOW, 0), pumpkin = MakeVegStats(UNCOMMON, TUNING.CALORIES_LARGE, TUNING.HEALING_SMALL, TUNING.PERISH_MED, 0, TUNING.CALORIES_LARGE, TUNING.HEALING_MEDSMALL, TUNING.PERISH_FAST, 0), eggplant = MakeVegStats(UNCOMMON, TUNING.CALORIES_MED, TUNING.HEALING_MEDSMALL, TUNING.PERISH_MED, 0, TUNING.CALORIES_MED, TUNING.HEALING_MED, TUNING.PERISH_FAST, 0), durian = MakeVegStats(RARE, TUNING.CALORIES_MED, -TUNING.HEALING_SMALL, TUNING.PERISH_MED, -TUNING.SANITY_TINY, TUNING.CALORIES_MED, 0, TUNING.PERISH_FAST, -TUNING.SANITY_TINY), pomegranate = MakeVegStats(RARE, TUNING.CALORIES_TINY, TUNING.HEALING_SMALL, TUNING.PERISH_FAST, 0, TUNING.CALORIES_SMALL, TUNING.HEALING_MED, TUNING.PERISH_SUPERFAST, 0), dragonfruit = MakeVegStats(RARE, TUNING.CALORIES_TINY, TUNING.HEALING_SMALL, TUNING.PERISH_FAST, 0, TUNING.CALORIES_SMALL, TUNING.HEALING_MED, TUNING.PERISH_SUPERFAST, 0), berries = MakeVegStats(0, TUNING.CALORIES_TINY, 0, TUNING.PERISH_FAST, 0, TUNING.CALORIES_SMALL, TUNING.HEALING_TINY, TUNING.PERISH_SUPERFAST, 0), } The code below used to inserted new crops that could grow in farms from seeds. With this disabled, seeds planted in farms no longer have a chance to grow these crops. Spoiler _G = GLOBAL TUNING = _G.TUNING --require "prefabs/veggies" -- had to comment this line out to stop crashes. local function MakeVegStats(seedweight, hunger, health, perish_time, sanity, cooked_hunger, cooked_health, cooked_perish_time, cooked_sanity) return { health = health, hunger = hunger, cooked_health = cooked_health, cooked_hunger = cooked_hunger, seed_weight = seedweight, perishtime = perish_time, cooked_perishtime = cooked_perish_time, sanity = sanity, cooked_sanity = cooked_sanity } end local COMMON = 3 local FREQUENT = 2 local UNCOMMON = 1 local INFREQUENT = .75 local RARE = .5 local VERYRARE = .3 local NEWVEGGIES = { grapricot = MakeVegStats(FREQUENT, TUNING.CALORIES_SMALL, TUNING.HEALING_TINY, TUNING.PERISH_FAST, 0, TUNING.CALORIES_TINY, TUNING.HEALING_SMALL, TUNING.PERISH_SUPERFAST, 0), limon = MakeVegStats(INFREQUENT, TUNING.CALORIES_SMALL, TUNING.HEALING_MEDSMALL, TUNING.PERISH_FAST, 0, TUNING.CALORIES_SMALL, TUNING.HEALING_SMALL, TUNING.PERISH_SUPERFAST, TUNING.SANITY_SUPERTINY), tomango = MakeVegStats(INFREQUENT, TUNING.CALORIES_MEDSMALL, TUNING.HEALING_SMALL, TUNING.PERISH_FAST, 0, TUNING.CALORIES_SMALL, TUNING.HEALING_MEDSMALL, TUNING.PERISH_SUPERFAST, 0), yamion = MakeVegStats(FREQUENT, TUNING.CALORIES_SMALL, TUNING.HEALING_SMALL, TUNING.PERISH_MED, 0, TUNING.CALORIES_SMALL, TUNING.HEALING_SMALL, TUNING.PERISH_SUPERFAST, 0), zucchilli = MakeVegStats(RARE, TUNING.CALORIES_MEDSMALL, TUNING.HEALING_MEDSMALL, TUNING.PERISH_FAST, -TUNING.SANITY_SUPERTINY*2, TUNING.CALORIES_MEDSMALL, TUNING.HEALING_SMALL, TUNING.PERISH_SUPERFAST, -TUNING.SANITY_SUPERTINY), rutabeeta = MakeVegStats(FREQUENT, TUNING.CALORIES_SMALL, TUNING.HEALING_TINY, TUNING.PERISH_SLOW, 0, TUNING.CALORIES_SMALL, TUNING.HEALING_TINY*2, TUNING.PERISH_FAST, 0), } if GetModConfigData("waiter_crops") == "1" then AddSimPostInit(function(inst) for key, val in pairs(NEWVEGGIES) do _G.VEGGIES[key] = val end end) else end My knowledge of Lua is limited, so anyone who can advise on this, I would appreciate it. Thank you. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.