Rincevvind Posted March 8, 2016 Share Posted March 8, 2016 Since some update modding probably broken, There alot of mods which trying to detect which DLC is actually running and now they will fail. Even pre-SW mods for RoG. Make new game with RoG enabled IsDLCEnabled(REIGN_OF_GIANTS) returns false IsDLCEnabled(CAPY_DLC) return strue wtf? Link to comment https://forums.kleientertainment.com/forums/topic/65232-so-how-to-detect-enabled-rog-now/ Share on other sites More sharing options...
PanAzej Posted March 8, 2016 Share Posted March 8, 2016 (edited) Using Volcano Staff crashes RoG, so I guess you could check if "volcanomanager" exists, and that way know what DLC is enabled, I guess? I'd rather wait for Klei to fix this issue, really. Edited March 8, 2016 by PanAzej Link to comment https://forums.kleientertainment.com/forums/topic/65232-so-how-to-detect-enabled-rog-now/#findComment-731178 Share on other sites More sharing options...
Rincevvind Posted March 8, 2016 Author Share Posted March 8, 2016 38 minutes ago, PanAzej said: Using Volcano Staff crashes RoG, so I guess you could check if "volcanomanager" exists, and that way know what DLC is enabled, I guess? I'd rather wait for Klei to fix this issue, really. no, it's a way to detect enabled/disabled SW. You can't detect RoG or Vanilla by SW assets presence. Link to comment https://forums.kleientertainment.com/forums/topic/65232-so-how-to-detect-enabled-rog-now/#findComment-731187 Share on other sites More sharing options...
PanAzej Posted March 8, 2016 Share Posted March 8, 2016 2 minutes ago, Rincevvind said: no, it's a way to detect enabled/disabled SW. You can't detect RoG or Vanilla by SW assets presence. Checking if there is no volcanomanager and no catcoonden for example could be used to detect if it's Vanilla. Link to comment https://forums.kleientertainment.com/forums/topic/65232-so-how-to-detect-enabled-rog-now/#findComment-731189 Share on other sites More sharing options...
Arkathorn Posted March 8, 2016 Share Posted March 8, 2016 if SaveGameIndex:GetCurrentMode() == "shipwrecked" or SaveGameIndex:GetCurrentMode() == "volcano" then --You're in Shipwrecked else --You aren't end Link to comment https://forums.kleientertainment.com/forums/topic/65232-so-how-to-detect-enabled-rog-now/#findComment-731237 Share on other sites More sharing options...
Rincevvind Posted March 8, 2016 Author Share Posted March 8, 2016 again, i don't need to detect SW, i need to know if it's Vanilla or RoG. but it's much better solution than looking into prefabs Link to comment https://forums.kleientertainment.com/forums/topic/65232-so-how-to-detect-enabled-rog-now/#findComment-731245 Share on other sites More sharing options...
Mobbstar Posted March 8, 2016 Share Posted March 8, 2016 (edited) @Rincevvind You could check for whether the prefab you require exists: if PrefabExists("acorn") then -- Only if the birchnut from RoG exists Or you can check for components like the moisture manager, if that is what you need. Actually testing whether or not the DLC is enabled is rarely needed. Edited March 8, 2016 by Mobbstar Notified Link to comment https://forums.kleientertainment.com/forums/topic/65232-so-how-to-detect-enabled-rog-now/#findComment-731261 Share on other sites More sharing options...
Rincevvind Posted March 8, 2016 Author Share Posted March 8, 2016 Just now, Mobbstar said: @Rincevvind You could check for whether the prefab you require exists: if PrefabExists("acorn") then -- Only if the birchnut from RoG exists Or you can check for components like the moisture manager, if that is what you need. Actually testing whether or not the DLC is enabled is rarely needed. i don't like idea to check prefabs, they can be added by mods, Arkathorn's idea much better, just need to adopt it to detect all 3 possible game states. DLC check present in many mods, including Hero in the Dark and mods which enabling or disabling some features depends on RoG presents. Link to comment https://forums.kleientertainment.com/forums/topic/65232-so-how-to-detect-enabled-rog-now/#findComment-731267 Share on other sites More sharing options...
Rincevvind Posted March 8, 2016 Author Share Posted March 8, 2016 actually i think about mod with highest priority which override IsDLCEnabled and returns proper value for all mods above it's better than modify tons of code Link to comment https://forums.kleientertainment.com/forums/topic/65232-so-how-to-detect-enabled-rog-now/#findComment-731272 Share on other sites More sharing options...
Mobbstar Posted March 8, 2016 Share Posted March 8, 2016 11 minutes ago, Rincevvind said: actually i think about mod with highest priority which override IsDLCEnabled and returns proper value for all mods above it's better than modify tons of code That sounds like a great idea! ...but I have no idea how to properly do it. Actually, aren't there DLC_00001 and DLC_00002 prefabs for loading the sounds? Link to comment https://forums.kleientertainment.com/forums/topic/65232-so-how-to-detect-enabled-rog-now/#findComment-731279 Share on other sites More sharing options...
Rincevvind Posted March 9, 2016 Author Share Posted March 9, 2016 (edited) oh gosh, how long takes for devs to look bugtracker? have another idea, much simple but weird just make 3 mods one with next string in modinfo dont_starve_compatible = true reign_of_giants_compatible = false shipwrecked_compatible = false second with one true for RoG and third for SW modmain will have IsDLCEnabled which returns proper values without actual checking anything Edited March 9, 2016 by Rincevvind Link to comment https://forums.kleientertainment.com/forums/topic/65232-so-how-to-detect-enabled-rog-now/#findComment-731811 Share on other sites More sharing options...
Mobbstar Posted March 9, 2016 Share Posted March 9, 2016 (edited) 27 minutes ago, Rincevvind said: oh gosh, how long takes for devs to look bugtracker? have another idea, much simple but weird just make 3 mods one with next string in modinfo dont_starve_compatible = true reign_of_giants_compatible = false shipwrecked_compatible = false second with one true for RoG and third for SW modmain will have IsDLCEnabled which returns proper values without actual checking anything You do realise that IsDLCEnabled is used to determine which mods to enable in the first place? Spoiler function ModIndex:IsModCompatibleWithMode(modname, dlcmode) local known_mod = self.savedata.known_mods[modname] local reignofgiants = dlcmode or IsDLCEnabled(REIGN_OF_GIANTS) local shipwrecked = dlcmode or IsDLCEnabled(CAPY_DLC) if known_mod then if reignofgiants or shipwrecked then return (reignofgiants and known_mod.modinfo.reign_of_giants_compatible) or (shipwrecked and known_mod.modinfo.shipwrecked_compatible) else return known_mod.modinfo.dont_starve_compatible end end return false end Edited March 9, 2016 by Mobbstar Added Proof Link to comment https://forums.kleientertainment.com/forums/topic/65232-so-how-to-detect-enabled-rog-now/#findComment-731817 Share on other sites More sharing options...
Rincevvind Posted March 9, 2016 Author Share Posted March 9, 2016 Also this IsDLCEnabled is defined in two places: function IsDLCEnabled(index) return TheSim:IsDLCEnabled(index) end and in dlcsupportworldgen function IsDLCEnabled(index) return __DLCEnabledTable[index] or false end look like hack in worldgen stage wtb Trump to make DS great again :/ Link to comment https://forums.kleientertainment.com/forums/topic/65232-so-how-to-detect-enabled-rog-now/#findComment-731836 Share on other sites More sharing options...
Rincevvind Posted March 14, 2016 Author Share Posted March 14, 2016 (edited) On 08.03.2016 at 9:49 PM, Mobbstar said: @Rincevvind You could check for whether the prefab you require exists: if PrefabExists("acorn") then -- Only if the birchnut from RoG exists Or you can check for components like the moisture manager, if that is what you need. Actually testing whether or not the DLC is enabled is rarely needed. PrefabExists("acorn") returns true in SW game so is there any reliable method to detect all 3 game state? Vanilla / RoG / SW PS. which will work in modworldgenmain.lua also Edited March 14, 2016 by Rincevvind Link to comment https://forums.kleientertainment.com/forums/topic/65232-so-how-to-detect-enabled-rog-now/#findComment-733690 Share on other sites More sharing options...
Rincevvind Posted March 14, 2016 Author Share Posted March 14, 2016 Trying to make such function, but GLOBAL.rawget(GLOBAL.SaveGameIndex,"GetCurrentMode") returns false :/ while SaveGameIndex is exists and it's table Link to comment https://forums.kleientertainment.com/forums/topic/65232-so-how-to-detect-enabled-rog-now/#findComment-733696 Share on other sites More sharing options...
Rincevvind Posted March 14, 2016 Author Share Posted March 14, 2016 (edited) code for modmain.lua Spoiler local modstr = "" local function GetGameMode() local m = "UNKNOWN" local s = GLOBAL.rawget(GLOBAL,"SaveGameIndex") if s then print (modstr.."SaveGameIndex found") -- if GLOBAL.rawget(GLOBAL.SaveGameIndex,"GetCurrentMode") then-- not works if type(GLOBAL.SaveGameIndex.GetCurrentMode) == "function" then s = s:GetCurrentMode() else print (modstr.."...but SaveGameIndex.GetCurrentMode is not valid") print (modstr.."type of SaveGameIndex is "..type(GLOBAL.SaveGameIndex)) print (modstr.."type of GetCurrentMode is "..type(GLOBAL.SaveGameIndex.GetCurrentMode)) return m end else print (modstr.."SaveGameIndex is NOT found") return m end if s == "shipwrecked" or s == "volcano" then m = "SW" else if GLOBAL.PrefabExists("acorn") then m = "ROG" else m = "Vanilla" end end return m end local function JustDoIt(str) modstr = "**** " .. str .. " **** " print (modstr.."Current mode is " .. GetGameMode()) end JustDoIt("MODMAIN") AddSimPostInit(function() JustDoIt("SimPostInit") end) AddGamePostInit(function() JustDoIt("GamePostInit") end) and some parts of log: Spoiler scripts/mods.lua(206,1) Mod: RFixROG (FixROG) Loading modworldgenmain.lua ../mods/RFixROG/modworldgenmain.lua(18,1) **** WORLDGEN **** SaveGameIndex is NOT found ../mods/RFixROG/modworldgenmain.lua(31,1) **** WORLDGEN **** Current mode is UNKNOWN scripts/mods.lua(206,1) Mod: RFixROG (FixROG) Loading modmain.lua ../mods/RFixROG/modmain.lua(18,1) **** MODMAIN **** SaveGameIndex is NOT found ../mods/RFixROG/modmain.lua(31,1) **** MODMAIN **** Current mode is UNKNOWN .... SimLuaProxy::QueryServer() ../mods/RFixROG/modmain.lua(7,1) **** GamePostInit **** SaveGameIndex found ../mods/RFixROG/modmain.lua(31,1) **** GamePostInit **** Current mode is ROG scripts/modindex.lua(85,1) ModIndex: Load sequence finished successfully. Reset() returning ..... scripts/mods.lua(206,1) Mod: RFixROG (FixROG) Loading modworldgenmain.lua ../mods/RFixROG/modworldgenmain.lua(18,1) **** WORLDGEN **** SaveGameIndex is NOT found ../mods/RFixROG/modworldgenmain.lua(31,1) **** WORLDGEN **** Current mode is UNKNOWN scripts/mods.lua(206,1) Mod: RFixROG (FixROG) Loading modmain.lua .... DoLuaFile loading buffer scripts/worldgen_main.lua ../mods/RFixROG/modmain.lua(7,1) **** GamePostInit **** SaveGameIndex found ../mods/RFixROG/modmain.lua(31,1) **** GamePostInit **** Current mode is Vanilla .... c:/s/steamapps/common/dont_starve/data/scripts/mods.lua(206,1) Mod: RFixROG (FixROG) Loading modworldgenmain.lua c:/s/steamapps/common/dont_starve/data/../mods/RFixROG/modworldgenmain.lua(18,1) **** WORLDGEN **** SaveGameIndex is NOT found c:/s/steamapps/common/dont_starve/data/../mods/RFixROG/modworldgenmain.lua(31,1) **** WORLDGEN **** Current mode is UNKNOWN c:/s/steamapps/common/dont_starve/data/scripts/mods.lua(206,1) Mod: PAdds (PrivAdds) Loading modworldgenmain.lua .... scripts/worldgen_main.lua(487,1) Applying mod to current level c:/s/steamapps/common/dont_starve/data/../mods/RFixROG/modworldgenmain.lua(18,1) **** LevelPreinitAny **** SaveGameIndex is NOT found c:/s/steamapps/common/dont_starve/data/../mods/RFixROG/modworldgenmain.lua(31,1) **** LevelPreinitAny **** Current mode is UNKNOWN scripts/modindex.lua(85,1) ModIndex: Load sequence finished successfully. .... ../mods/RFixROG/modmain.lua(7,1) **** SimPostInit **** SaveGameIndex found ../mods/RFixROG/modmain.lua(31,1) **** SimPostInit **** Current mode is Vanilla QueryServerComplete no callback ..... scripts/mods.lua(206,1) Mod: RFixROG (FixROG) Loading modworldgenmain.lua ../mods/RFixROG/modworldgenmain.lua(18,1) **** WORLDGEN **** SaveGameIndex is NOT found ../mods/RFixROG/modworldgenmain.lua(31,1) **** WORLDGEN **** Current mode is UNKNOWN scripts/mods.lua(206,1) Mod: RFixROG (FixROG) Loading modmain.lua ../mods/RFixROG/modmain.lua(18,1) **** MODMAIN **** SaveGameIndex is NOT found ../mods/RFixROG/modmain.lua(31,1) **** MODMAIN **** Current mode is UNKNOWN .... SimLuaProxy::QueryServer() ../mods/RFixROG/modmain.lua(7,1) **** GamePostInit **** SaveGameIndex found ../mods/RFixROG/modmain.lua(31,1) **** GamePostInit **** Current mode is ROG ..... game was created without any DLC enabled (ingame) so as you see here, Prefab detection failed here. what that mean at all: - there no point to detect anything anymore, best solution is to create 3 different mods, since you are unable to predefine prefabs and assets which will be loaded if DLC is present. - function works properly only at SimPostInit hook function Edited March 14, 2016 by Rincevvind Link to comment https://forums.kleientertainment.com/forums/topic/65232-so-how-to-detect-enabled-rog-now/#findComment-733699 Share on other sites More sharing options...
Rincevvind Posted March 14, 2016 Author Share Posted March 14, 2016 well i tired to fight and switched to ugly solution which is works for me i made 3 empty mods. if one of mods is enabled thats mean that game is forced to works like it's in one of 3 state regardless of IsDLCEnabled results if somebody care: Spoiler --code by squeek function GetMod(name_or_id) for _, mod in ipairs( _G.ModManager.mods ) do -- note: mod.modname is the mod directory name if mod.modinfo.name == name_or_id or mod.modinfo.id == name_or_id then return mod end end return nil end function IsModEnabled(name_or_id) return GetMod(name_or_id) ~= nil end function CheckDLC() rawset(_G, "IsDLC1", false) rawset(_G, "IsDLC2", false) rawset(_G, "IsDLC", false) local dlcVanillaForced = IsModEnabled("forcevanilla") local dlcROGForced = IsModEnabled("forcerog") local dlcSWForced = IsModEnabled("forcesw") local dlcForced = dlcVanillaForced or dlcROGForced or dlcSWForced if dlcForced then if dlcVanillaForced then print ("CheckDLC : Vanilla mode") IsDLC1 = false IsDLC2 = false end if dlcROGForced then print ("CheckDLC : RoG mode") IsDLC1 = true IsDLC2 = false end if dlcSWForced then print ("CheckDLC : SW mode") IsDLC1 = false IsDLC2 = true end else if IsDLCEnabled then IsDLC1 = REIGN_OF_GIANTS and IsDLCEnabled(REIGN_OF_GIANTS) IsDLC2 = CAPY_DLC and IsDLCEnabled(CAPY_DLC) end end IsDLC = IsDLC1 or IsDLC2 print ("CheckDLC : Forced = "..tostring(dlcForced)..", IsDLC = "..tostring(IsDLC)..", IsDLC1 = ".. tostring(IsDLC1)..", IsDLC2 = "..tostring(IsDLC2)) end this is some file for require inside modmain/worldgen/prefabs CheckDLC called once in SimPostInit/prefab function and then variables only used Since you have to enable/disable this fake mods i call it as ugly solution, but it's works :/ Link to comment https://forums.kleientertainment.com/forums/topic/65232-so-how-to-detect-enabled-rog-now/#findComment-733834 Share on other sites More sharing options...
modding Posted March 15, 2016 Share Posted March 15, 2016 Quote trying to detect which DLC is actually running and now they will fail JS world switched from detecting browsers to detecting features, may be that is a good idea. Link to comment https://forums.kleientertainment.com/forums/topic/65232-so-how-to-detect-enabled-rog-now/#findComment-734390 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now