Search the Community
Showing results for tags 'resolved'.
Found 3 results
Hi, I am trying to edit a shared loot table (volt goats, specifically). My questions around this are thus: 1: is this table set every time a prefab loads? (does spawning a goat reset the table? Or is it set once, and once only?) 2. If the answer is the latter, where could I put my edit such that it is performed after the table has been set? I could put it in a AddPrefabPostInit function, but it seems wasteful to do that every time a goat spawns. I might just be over complicating this, but I am genuinely interested to know how you would do this for general knowledge. Does anyone have a link handy for what systems load in what order in DST?
Hi, hoping someone can lend me a hand with this. TL;DR: I replaced a function, and the arguments passed into it are nil. Why? Context I am trying to edit the standard evergreens prefab so that trees drop more logs. Problem is that all of the functions in evergreens.lua are local functions, and the variable I need to change is the builds variable (which contains all of the potential loot pools for trees when they transition between growth states). So I abandoned the idea of editing any of that (if there is a way to edit local variables, please let me know), and instead decided to try intercept the lootpool change under inst.components.lootdropper (to be clear, I am still editing the evergreens.lua prefab). The Problem When I try to extend/replace inst.components.lootdropper.SetLoot, the arguments passed in to the new function are nil. Is this a LUA scoping issue that I am not understanding? I remember seeing a post from one of the big posters (rezecib?) about how to override functions, but cannot for the life of me find it again. Code local function SetLootPool(inst) -- only run on the server if not GLOBAL.TheWorld.ismastersim then return end -- make sure we have the right component if (inst.components.lootdropper == nil) then return end -- Remember the old function OldSetLoot = inst.components.lootdropper.SetLoot -- Replace the function inst.components.lootdropper.SetLoot = function(loots) print(OldSetLoot) print(inst.components.lootdropper.SetLoot) print(loots) -- This outputs: -- [00:01:20]: function: 0B2D2310 -- [00:01:20]: function: 05E98F20 -- [00:01:20]: nil -- Call the old function now. Obviously, this sets the loot pool to nil OldSetLoot(loots) end end -- Just testing on the "normal" evergreens for the time being. -- I spawn one in, and use Wicker's book to trigger the above AddPrefabPostInit("evergreen_normal", SetLootPool)
Hello, I have a mod which creates additional food items, however if I try to add spices to them using Warly's station, I end up with spiced wet goop. I have looked at spicedfoods.lua and I cant see any reason for this, but admittedly my Lua knowledge is limited. I had thought maybe adding GenerateSpicedFoods(require("mod_foods")) -- Insert modded_foods into food spicer local function ModDSTSpicer(inst) GenerateSpicedFoods(require("mod_foods")) end AddPrefabPostInit("spicedfoods", ModDSTSpicer) However, this didn't result in any change, either because it doesn't matter, or perhaps is coded wrong. I am at a bit of a loss. Any advice would be appreciated, thank you.