Serpens

  • Content Count

    1373
  • Joined

  • Last visited

Community Reputation

566 Excellent

About Serpens

  • Rank
    Senior Member
...

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Enable
  1. Feature Request: Could Klei please add a way for mods to change existing settings? For example add more season-length options to the season settings. Currently this is not possible without again alot of work and overwriting game functions, while it would be so damn easy for Klei to add this option. I could write you the few lines code you need to add, to also allow replacing/merging existing settings. edit: was not too complicated, but only thanks to upvaluehacker. Following code in modworldgenmain.lua: -- ## Add more options to existing game settings. -- this is an example to add 3 and 6 days to all season lengths. Requires upvaluehacker (google for it if you dont have it) local UpvalueHacker = GLOBAL.require("upvaluehacker") local customize = GLOBAL.require("map/customize") local WSO = require("worldsettings_overrides") local RefreshWorldTabs = UpvalueHacker.GetUpvalue(customize.RemoveCustomizeGroup, "RefreshWorldTabs") local customize_descriptions = UpvalueHacker.GetUpvalue(customize.GetDescription, "descriptions") local new_seasonlengths = {{ text = "3 days", data = "3__daysseason", pos=1 },{ text = "6 days", data = "6__daysseason", pos=2 }} for _,length in ipairs(new_seasonlengths) do table.insert(customize_descriptions.season_length_descriptions,length.pos,length) end UpvalueHacker.SetUpvalue(customize.GetDescription, customize_descriptions, "descriptions") RefreshWorldTabs() -- refresh to display new settings local seasons = {"autumn","summer","spring","winter"} for i,season in ipairs(seasons) do local old_fn = WSO.Post[season] WSO.Post[season] = function(difficulty,...) if string.find(difficulty,"__") then local diff_split = difficulty:split("__") -- this way we det the desired length number from aboves data string GLOBAL.TheWorld:PushEvent("ms_setseasonlength", {season = season, length = diff_split[1]}) elseif old_fn~=nil then return old_fn(difficulty,...) end end end ---------------------------
  2. The final solution to the question: How does a mod change Pre/Post settings on world-generation, without forcing them on every load is the following code. We (penguin0616 and I) spent over 50 hours for this, while it would be a "one liner" for Klei to simply add modsupport, so mods can easily change them... And my teleportato mod is still not completely made compatible to that QoL update, guess it will take several more hours.. now you see why I thought about abandoning my mods...) In modworldgenmain.lua: local overrides_forest = {dropeverythingondespawn = "always"} -- put your Pre/Post settings you would like to load here local overrides_cave = {dropeverythingondespawn = "always"} local WSO = require("worldsettings_overrides") local savedata = nil local new_game = true local function GetSaveData() if new_game then if savedata then return savedata end local i = 1 local stack_i = 3 -- we increment this in case another mod is overwriting a function, to make sure getlocal still works. while true do if stack_i>20 then --give up return nil end local name, value = GLOBAL.debug.getlocal(stack_i, i) -- Level 1 is where we are now, Level 2 is our Pre function calling this, level 3 is gamelogic.lua:362 or gamelogic.lua:367 depending on the savedata. if name then if name == "savedata" then if value.meta.SERP_MOD_HAS_OVERRIDEN then -- only do it once per world new_game = false -- do not try it again, it is no new game, so no need to find savedata again. return nil end savedata = value savedata.meta.SERP_MOD_HAS_OVERRIDEN = true return savedata end i = i+1 else stack_i = stack_i+1 i = 1 end end end end for i,PrePost in ipairs({"Pre","Post"}) do for name, fn in pairs(WSO[PrePost]) do if overrides_forest[name] or overrides_cave[name] then local old_fn = WSO[PrePost][name] WSO[PrePost][name] = function(difficulty,...) if new_game then if not savedata then -- only when it is a new game GetSaveData() end if savedata then if savedata.map.prefab=="forest" then if overrides_forest[name] then savedata.map.topology.overrides[name] = overrides_forest[name] difficulty = overrides_forest[name] end elseif savedata.map.prefab=="cave" then if overrides_cave[name] then savedata.map.topology.overrides[name] = overrides_cave[name] difficulty = overrides_cave[name] end end end end if old_fn then return old_fn(difficulty,...) end end end end end
  3. thank you. but none of them is a good solution, making it incompatible to other mods that want to change seasons... My mod should change the season once when starting the world the first time. After that, all other mods should be able to do whatever they want (eg. an item which is able to change season length or whatever). So I guess I will do a PostInit for the world, then call WorldSettings_Overrides.Post["autumn"]("noseason") or similar (or directly the PushEvent) and try to remember, that I called it once, to not call it again on next loading. Still no good solution, but better. edit: ok, only calling this does not work, because the change is not saved O.รด really mod-unfriendly (because it means an item can not easily change season length or so midgame). Will see if I can instead override the setting... ... but this also won't help -.- because it seems when loading a game, it will always take the settings chosen in the worldscreen. All in all I come to the conclusion, that your code is indeed the only viable way to achieve my goal, but it still makes it incompatible to other mods doing the same... edit2: Ah no, it would be better if my mod could change the settings on the worldscreen after world was generated. This way the game would save the setting and the users are able to change them, if they don't like them. But how to do this!? edit3: Solution: because of steam apiv2 I forgot to look at your (Zarklord) worldsettings mod (because I did not find the new location of mods). But I will now do it, like you did it there, simply changing eg. TheWorld.topology.overrides.day and then reload the world once per game. This will change the settings on the worldscreen and if the user is unhappy with it, they can simply change it to whatever they want. Modding after that QoL update:
  4. try to surely reproduce it and disable mod by mod to find out which is causing it. Then report it to the author. Most likely a mod that deals with clock, like nightmare pahse indicator or combined status.
  5. I really dont know why the devs changed that without any anouncement or sth like that. I'm very disappointed about the latest update and the bad communication. See here:
  6. maybe this mod can help, but it crashes for clients, see my post in the comments there: https://steamcommunity.com/sharedfiles/filedetails/?id=1768613881
  7. maybe look instead at the worldgeneration code from stuff that spawns in the ocean? Then generate a setpiece there with a boat and a spawnpoint on it. And look at the wilderness-mode code, to see if it is possible to spawn your character there, instead of the portal (if not you can teleport him after game start to the boat) it is still quite difficult, so I won't help you more. But you may tkae a look at some of my mods which add/change setpieces: https://steamcommunity.com/sharedfiles/filedetails/?id=758921911 https://steamcommunity.com/sharedfiles/filedetails/?id=756229217 but you will also find some functions like "SpawnPrefabAtLandPlotNearInst" here, maybe you can rewrite them to your use: https://github.com/Serpens66/DST-Teleportato-Mod/blob/master/workshop-756229217/scripts/tele_helpers.lua
  8. thanks. @zarklord_klei Could you please add this anywhere in your tutorial from this update? https://forums.kleientertainment.com/forums/topic/127319-world-options-and-mod-changes/ I mean it is a little bit important for modders to know where mods are stored. And it is important to be able to unpack this new "xyz_legacy.bin" folder. (edit just like a zip file) I first thought you are hiding your own mods, when I did not found them after subscribing, sorry for that. But still, everyone needs to be able to unpack and read mods, also from others. And how should modders proceed now? Still store their unpacked mods in the previous folder? Or store it somewhere save, because they might get deleted? Any guidance about this change would be helpful.
  9. any news on this? is this a bug that will be fixed or do I need new code to force specific settings?
  10. I think you made everything correct, but this new mechanic is still bugged. not 100% sure though.
  11. use my mod as example: https://github.com/Serpens66/DST-Evolving-Maxwell-Shadows/blob/master/modmain.lua search for the line "AddComponentPostInit("finiteuses",function(self) -- unlimited weapons/tools" to change the duration only for your prefab. My code changes it for everything with "finiteuses" so also weapons. If you dont wan to change weapons you need to add an if condition to catch all weapons. Depending on the modsettings the duration can be unlimted, but it can also be higher/less than default. And for faster work (less needed hits), you can do in your postinit of your character this: inst:AddComponent("workmultiplier") inst.components.workmultiplier:AddMultiplier(GLOBAL.ACTIONS.CHOP, multiplier, "your_unique_naming")
  12. you just need to make sure that all players have the same version. So either send them the files directly (without steam) or make sure all of them are your steam friends, so they can download the hidden mod (edit: thought "hidden" already means "friends only"). And make sure that the version on your PC matches the version you uploaded to steam/gave your friends.
  13. you can also link the most important mods here and maybe someone is going to update the mods.
  14. thanks for this tutorial: so regarding bugfix from the DST devs I can only quote penguin0616: which is still present it seems.