mirror of
https://github.com/Dadido3/noita-mapcap.git
synced 2024-12-22 02:17:33 +00:00
Disable screenshake by default
This commit is contained in:
parent
2f8a8b2718
commit
b19c70c9d0
@ -77,6 +77,12 @@ function Check:Regular(interval)
|
||||
Message:ShowSetNoitaSettings(Modification.AutoSet, string.format("Internal resolution is %s. Expected %s.", Coords.InternalResolution, expected))
|
||||
end
|
||||
end
|
||||
if config["screenshake_intensity"] then
|
||||
local expected = config.screenshake_intensity
|
||||
if expected ~= self.StartupConfig.screenshake_intensity then
|
||||
Message:ShowSetNoitaSettings(Modification.AutoSet, string.format("Screenshake intensity is %s, expected %s.", self.StartupConfig.screenshake_intensity, expected))
|
||||
end
|
||||
end
|
||||
|
||||
-- Magic numbers stuff doesn't need a forced restart, just a normal restart by the user.
|
||||
if magic["VIRTUAL_RESOLUTION_X"] and magic["VIRTUAL_RESOLUTION_Y"] then
|
||||
|
@ -20,7 +20,7 @@
|
||||
-- - Integer world coordinates map exactly to pixel borders.
|
||||
-- - The default image ratios of the virtual and internal rectangles don't exactly match, which causes a small line of not correctly rendered pixels at the bottom window.
|
||||
-- - The GRID_RENDER_BORDER magic number adds the given amount of world pixels to the virtual rectangle's width. This happens after fitting, so a positive value will make it wider than the internal rectangle. The virtual rectangle will always be aligned to start at the left side of the internal rectangle, though.
|
||||
-- - The virtual offset needs to be [-GRID_RENDER_BORDER, 0] for the viewport center to be exactly centered, and chunks to align perfectly with the window.
|
||||
-- - The virtual offset needs to be [-GRID_RENDER_BORDER, 0] for the viewport center to be exactly centered to the window or virtual rectangle.
|
||||
|
||||
--------------------------
|
||||
-- Load library modules --
|
||||
|
@ -52,6 +52,7 @@ function Message:ShowResetNoitaSettings()
|
||||
Lines = {
|
||||
"You requested to reset some game settings like:",
|
||||
"- Custom resolutions",
|
||||
"- Screenshake intensity",
|
||||
" ",
|
||||
"Press the following button to reset the settings and close Noita automatically:",
|
||||
},
|
||||
|
@ -27,6 +27,21 @@ local Vec2 = require("noita-api.vec2")
|
||||
-- Code --
|
||||
----------
|
||||
|
||||
---Reads the current config from `config.xml` and returns it as table.
|
||||
---@return table<string, string> config
|
||||
function Modification.GetConfig()
|
||||
local configFilename = Utils.GetSpecialDirectory("save-shared") .. "config.xml"
|
||||
|
||||
-- Read and modify config.
|
||||
local f, err = io.open(configFilename, "r")
|
||||
if not f then error(string.format("failed to read config file: %s", err)) end
|
||||
local xml = NXML.parse(f:read("*a"))
|
||||
|
||||
f:close()
|
||||
|
||||
return xml.attr
|
||||
end
|
||||
|
||||
---Will update Noita's `config.xml` with the values in the given table.
|
||||
---
|
||||
---This will force close Noita!
|
||||
@ -172,6 +187,9 @@ function Modification.RequiredChanges()
|
||||
-- Capturing will not work in fullscreen.
|
||||
config["fullscreen"] = "0"
|
||||
|
||||
-- Also disable screenshake.
|
||||
config["screenshake_intensity"] = "0"
|
||||
|
||||
magic["DRAW_PARALLAX_BACKGROUND"] = ModSettingGet("noita-mapcap.disable-background") and "0" or "1"
|
||||
magic["DEBUG_PAUSE_GRID_UPDATE"] = ModSettingGet("noita-mapcap.disable-physics") and "1" or "0"
|
||||
magic["DEBUG_PAUSE_BOX2D"] = ModSettingGet("noita-mapcap.disable-physics") and "1" or "0"
|
||||
@ -233,6 +251,7 @@ function Modification.Reset()
|
||||
internal_size_h = "720",
|
||||
backbuffer_width = "1280",
|
||||
backbuffer_height = "720",
|
||||
screenshake_intensity = "0.7",
|
||||
}
|
||||
|
||||
Modification.SetConfig(config)
|
||||
|
3
init.lua
3
init.lua
@ -55,6 +55,9 @@ dofile("mods/noita-mapcap/files/ui.lua")
|
||||
|
||||
---Called in order upon loading a new(?) game.
|
||||
function OnModPreInit()
|
||||
-- Read Noita's config to be used in checks later on.
|
||||
Check.StartupConfig = Modification.GetConfig()
|
||||
|
||||
-- Set magic numbers and other stuff based on mod settings.
|
||||
local config, magic, memory, patches = Modification.RequiredChanges()
|
||||
Modification.SetMagicNumbers(magic)
|
||||
|
14
settings.lua
14
settings.lua
@ -284,18 +284,18 @@ modSettings = {
|
||||
value_default = DebugAPI.IsDevBuild(), -- Defaults to true in dev build, false in regular Noita.
|
||||
scope = MOD_SETTING_SCOPE_RUNTIME_RESTART,
|
||||
},
|
||||
{
|
||||
id = "modify-entities",
|
||||
ui_name = " Disable entity logic",
|
||||
ui_description = "If enabled, the mod will disable some components of all encountered entities.\nThis will:\n- Disable AI\n- Disable falling\n- Disable hovering and rotation animations\n- Reduce explosions\n \nThis may slow down things a bit.\nAnd it may make Noita more likely to crash.\nUse at your own risk.",
|
||||
value_default = false,
|
||||
scope = MOD_SETTING_SCOPE_RUNTIME,
|
||||
},
|
||||
{
|
||||
id = "disable-shaders-gui-ai",
|
||||
ui_name = " Disable shaders, GUI and AI",
|
||||
ui_description = "It has the same effect as pressing F5, F8 and F12 in the Noita dev build.\nDoesn't work outside the dev build.",
|
||||
hidden = not DebugAPI:IsDevBuild(), -- Hide in anything else than the dev build.
|
||||
value_default = DebugAPI.IsDevBuild(), -- Defaults to true in dev build, false in regular Noita.
|
||||
scope = MOD_SETTING_SCOPE_RUNTIME,
|
||||
},
|
||||
{
|
||||
id = "modify-entities",
|
||||
ui_name = " Disable entity logic",
|
||||
ui_description = "If enabled, the mod will disable some components of all encountered entities.\nThis will:\n- Disable AI\n- Disable falling\n- Disable hovering and rotation animations\n- Reduce explosions\n \nThis may slow down things a bit.\nAnd it may make Noita more likely to crash.\nUse at your own risk.",
|
||||
value_default = false,
|
||||
scope = MOD_SETTING_SCOPE_RUNTIME,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user