Flit Posted October 5, 2021 Share Posted October 5, 2021 When specialevents is set to default and a new event starts, as hallowed nights soon will, does a dedicated server need to be restarted for the event to take effect? Link to comment Share on other sites More sharing options...
Daniel86268 Posted October 5, 2021 Share Posted October 5, 2021 Afaik yes. You could run an automatic script, that reboots the server automaticially an hour or so after Klei's usual release time (which happens to be somewhere in the middle of the night for me) so the server always gets the events pretty quickly. Link to comment Share on other sites More sharing options...
Flit Posted October 5, 2021 Author Share Posted October 5, 2021 Ah yes of course the start of any event is going to happen alongside a game update. I had forgotten that. So the mod that restarts my server when an update is available is already going to activate the special event. Thanks for your help. Ahh, and I see Settings.last_world_specialevent and Settings.current_world_specialevent in GLOBAL. I assume I'll be able to use those to check if a new event has begun whenever the server restarts. I'll give it a try. Thanks again. Link to comment Share on other sites More sharing options...
Flit Posted October 6, 2021 Author Share Posted October 6, 2021 I gave it a try and thought I may as well post my finding here in case it's useful to someone else in the future. By the time AddGamePostInit gets called in modmain.lua GLOBAL.Settings.last_world_specialevent and GLOBAL.Settings.current_world_specialevent are always equal. Instead I used GLOBAL.WORLD_SPECIAL_EVENT. AddGamePostInit(function() if not GLOBAL.TheWorld and GLOBAL.TheWorld.ismastershard then return end if GLOBAL.WORLD_SPECIAL_EVENT ~= GLOBAL.Settings.current_world_specialevent then if GLOBAL.WORLD_SPECIAL_EVENT == "none" then for k,v in pairs(GLOBAL.SPECIAL_EVENTS) do if v == GLOBAL.Settings.last_world_specialevent then print(GLOBAL.STRINGS.UI.SANDBOXMENU.SPECIAL_EVENTS[k] .. " has ended.") break end end else for k,v in pairs(GLOBAL.SPECIAL_EVENTS) do if v == GLOBAL.WORLD_SPECIAL_EVENT then print(GLOBAL.STRINGS.UI.SANDBOXMENU.SPECIAL_EVENTS[k] .. " has begun.") break end end end end end) In the actual code instead of printing event info it sends it to a Discord channel, and this way it only sends it when an event starts or stops, instead of each time the server is restarted. 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.