Don't Starve Together
Global Pause
How to make pause menu immediately pause the game
I only use this mod when playing DST alone, and I disliked how I always needed to click "Toggle Pause". So, I turned on the P hotkey option, however typing P into the console and chat will still toggle pause, which is a bit annoying and inconsistent.

So I went into the mod files and edited it a bit. Now, "Toggle Pause" is gone and it pauses immediately when I press Esc. Also, typing P no longer toggles pause if you are using the console or chat.

Here's how to do it:

Step 1: Navigate to "Steam\SteamApps\common\Don't Starve Together Beta\mods\workshop-758532836" (Make sure you are in the right folder! It's "workshop-758532836")

Step 2: Open "modmain.lua" and delete the entire code in it, you will be replacing it on the next step

Step 3: Paste this code into it...
KEYBOARDTOGGLEKEY = GetModConfigData("KEYBOARDTOGGLEKEY") if type(KEYBOARDTOGGLEKEY) == "string" then KEYBOARDTOGGLEKEY = KEYBOARDTOGGLEKEY:lower():byte() end ENABLEHOTKEY = GetModConfigData("ENABLEHOTKEY") AUTOPAUSEMAP = GetModConfigData("AUTOPAUSEMAP") AUTOPAUSECONSOLE = GetModConfigData("AUTOPAUSECONSOLE") AUTOPAUSESINGLEPLAYERONLY = GetModConfigData("AUTOPAUSESINGLEPLAYERONLY") AUTOPAUSEENABLED = AUTOPAUSEMAP or AUTOPAUSECONSOLE ENABLECLIENTPAUSE = GetModConfigData("ENABLECLIENTPAUSE") local function cz_hotkey_checker() local curScreen = TheFrontEnd:GetActiveScreen() if (curScreen and curScreen.name=="HUD") then return false end return true end local require = GLOBAL.require GLOBAL.GP = {} GLOBAL.GP.autopaused = false GLOBAL.GP.client_pause_enabled = ENABLECLIENTPAUSE if ENABLECLIENTPAUSE then AddModRPCHandler("GlobalPause", "RPCTogglePause", function() GLOBAL.GPTogglePause() end) AddModRPCHandler("GlobalPause", "RPCGlobalPause", function() GLOBAL.globalPauseSet(true) end) AddModRPCHandler("GlobalPause", "RPCGlobalUnpause", function() GLOBAL.globalPauseSet(false) end) end AddModRPCHandler("GlobalPause", "RPCReportGlobalPaused", function(inst, data) GLOBAL.RPCReportGlobalPaused(inst, data) end) AddPrefabPostInit("forest_network", function(inst) inst:AddComponent("globalpause") end) AddPrefabPostInit( "cave_network", function(inst) inst:AddComponent("globalpause") end) if ENABLEHOTKEY and ( ENABLECLIENTPAUSE or GLOBAL.TheNet:GetIsServerAdmin() ) then AddClassPostConstruct( "widgets/controls", function() GLOBAL.TheInput:AddKeyDownHandler(KEYBOARDTOGGLEKEY, function() if not cz_hotkey_checker() then GLOBAL.PauseScreenTogglePause() end end) end) end local function GP_OnBecomeActive(self) if AUTOPAUSESINGLEPLAYERONLY and table.getn(GLOBAL.AllPlayers) == 1 then if GLOBAL.TheSim:GetTimeScale() ~= 0 then GLOBAL.TheNet:SendRemoteExecute("globalPauseSet(true)", true) GLOBAL.GP.autopaused = true end end self:oldOnBecomeActive() end local function HUD_GPOnGainFocus(self) self:oldOnGainFocus() if GLOBAL.GP.autopaused then GLOBAL.TheNet:SendRemoteExecute("globalPauseSet(false)", true) end GLOBAL.GP.autopaused = false end local function GPAddToScreen(self) self.oldOnBecomeActive = self.OnBecomeActive self.OnBecomeActive = GP_OnBecomeActive end local function GPConsoleOnTextEntered(self) if GLOBAL.TheSim:GetTimeScale() == 0 then GLOBAL.TheNet:SendRemoteExecute("globalPauseSet(false)", true) self.pause_after_run = true else self.pause_after_run = false end self:oldOnTextEntered() end local function GPConsoleRun(self) self:oldRun() if self.pause_after_run then GLOBAL.TheNet:SendRemoteExecute("globalPauseSet(true)", true) end end if GLOBAL.TheNet:GetIsServerAdmin() then AddClassPostConstruct("screens/consolescreen", function(inst) inst.oldOnTextEntered = inst.OnTextEntered inst.OnTextEntered = GPConsoleOnTextEntered inst.oldRun = inst.Run inst.Run = GPConsoleRun end) end if AUTOPAUSEENABLED then if GLOBAL.TheNet:GetIsServerAdmin() then if AUTOPAUSEMAP then AddClassPostConstruct("screens/mapscreen", GPAddToScreen) end if AUTOPAUSECONSOLE then AddClassPostConstruct("screens/consolescreen", GPAddToScreen) end AddClassPostConstruct("screens/pausescreen", GPAddToScreen) AddClassPostConstruct("screens/playerhud", function(self) self.oldOnGainFocus = self.OnGainFocus self.OnGainFocus = HUD_GPOnGainFocus end) end end

Step 4: Save "modmain.lua" then close it.

Step 5: Go to the "scripts" folder.

Step 6: Delete the "screens" folder.

Done.
Отредактировано Chuck Angry Birds; 30 дек. 2016 г. в 2:10
< >
Сообщения 12 из 2
hmaarrfk  [Разработчик] 1 янв. 2017 г. в 12:14 
Do you mind submitting a patch to GitHub. I could credit you as an author too. Also enabling pause on map basically does the same thing.
where can i get Don't Starve Together Beta? its not in my folder.
< >
Сообщения 12 из 2
Показывать на странице: 1530 50