• Content Count

  • Joined

  • Last visited

Community Reputation

1 Neutral

About Bukinnear

  • Rank
    Junior Member
  1. I don't blame you, I did only just start modding, but I can completely understand where newbies are struggling - the documentation for DS modding is piss-poor at best, and completely missing at worst (or at norm). Usually with the instruction of "Just look at how other mods work!". One top of that, this forum is a ***** to try and search. I can see how metatables could go wrong in a hurry, and I imagine they add a bit of overhead to the whole show as well. It might help a lot for modding things like the evergreens prefab, though, which for some inexplicable reason is almost entirely local functions/variables >:C
  2. @Ultroman Sorry, I should have clarified that the SetSharedLootTable is a bit of a special case. It isn't set in the prefab, it's set once on construction, by the looks of it, so there's no need to override it every time a goat spawns. Just need to set & forget after everything loads. Thanks @CarlZalph! You started that comment thinking I hadn't done my homework, didn't you lol. That was just what I needed. I couldn't figure out if lightninggoat has a class or not (I don't see any mention to it, at least) so the AddGamePostInit worked perfectly. Metatables are an interesting concept, though, I just learnt something new!
  3. 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?
  4. @Ultroman Thank you so much! I thought the colon was only for calling the function, I didn't realise I could define it with the same. I didn't look carefully at the definition, and on top of that, It was one of your older posts that I was basing my work off of here. You explain that in the very first code snippet >.< @CarlZalph Ah, yes, I did have trouble with that, and corrected that previously. This was just left over from an experiment to see if I printed them, whether it would show a different value, or whether it would be the same. They were different values, but judging by your comment, so I assume it was printing the reference variable, not the value. That being said, I just tested it and it seems to work fine, so ¯\_(ツ)_/¯ A side note, I have been relying heavily on both of you from posts dating back quite a ways, so it's an honour to have both of you answer so quickly <3 Thank you both for your assistance! @rawii22 I think I saw something different, but I have been heavily relying on this guide as well. Thanks!
  5. 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[1]) -- 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)