Skip to content

Instantly share code, notes, and snippets.

@celediel
Last active June 13, 2022 22:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save celediel/733cabfad1aa83cfd3b1871bb1b54aa9 to your computer and use it in GitHub Desktop.
Save celediel/733cabfad1aa83cfd3b1871bb1b54aa9 to your computer and use it in GitHub Desktop.
Morrowind Lower First Person Sneak MWSE
MIT License
Copyright (c) 2020 Lilian Jónsdóttir
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
local modName = "Lower First Person Sneak"
local modConfig = string.gsub(modName, "%s+", "")
local modInfo = [[Lower first person sneak view, but without a plugin.
The greater the slider value, the further the camera will be from standing position.
Vanilla default: 10, Mod default: 25
Click the apply button or restart the game to apply the changes.]]
local defaultConfig = {i1stPersonSneakDelta = 25}
local config = mwse.loadConfig(modConfig, defaultConfig)
local function applyChanges()
tes3.findGMST("i1stPersonSneakDelta").value = config.i1stPersonSneakDelta
mwse.log("[%s] First Person Sneak Delta set to %s", modName, config.i1stPersonSneakDelta)
end
local function onInitialized() applyChanges() end
local function configMenu()
local template = mwse.mcm.createTemplate(modName)
template:saveOnClose(modConfig, config)
local page = template:createSideBarPage({
label = "Sidebar Page???",
description = string.format("%s\n\n%s", modName, modInfo)
})
local category = page:createCategory(modName)
category:createSlider({
label = "First Person Sneak Level",
min = 0,
max = 100,
step = 1,
jump = 5,
variable = mwse.mcm.createTableVariable({id = "i1stPersonSneakDelta", table = config})
})
category:createButton({buttonText = "Apply", callback = applyChanges})
return template
end
event.register("modConfigReady", function() mwse.mcm.register(configMenu()) end)
event.register("initialized", onInitialized)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment