openwf/Scripts/samples/Settings.pluto
2025-10-06 18:27:00 +08:00

59 lines
1.9 KiB
Plaintext

-- Modifications to sample scripts will be lost the next time you start the game.
local { CHECKBOX, INPUTBOX } = require "Lotus.Interface.LotusUtilities"
local dict = get_lang_dict()
local options = {
{ dict.high_damage_numbers_patch, get_high_damage_numbers_patch, set_high_damage_numbers_patch },
{ dict.skip_mission_start_timer, get_skip_mission_start_timer, set_skip_mission_start_timer },
{ dict.simulacrum_blacklisted, get_simulacrum_blacklisted, set_simulacrum_blacklisted },
{ dict.simulacrum_whitelisted, get_simulacrum_whitelisted, set_simulacrum_whitelisted },
{ dict.alternative_loading, get_alternative_loading, set_alternative_loading },
{ dict.ee_log_in_console, get_ee_log_in_console, set_ee_log_in_console },
{ dict.dont_resolve_labels, get_dont_resolve_labels, set_dont_resolve_labels },
{ dict.fov_override, get_fov_override, |s| -> set_fov_override(tonumber(s) or 0) },
}
local done = false
local movie = _T.OpenScreen("GenericSettings")
movie:Execute("SetTitle", "OpenWF In-Game Options")
function _T.owfSampleSettingsChangesDone(inputs, cancel)
if not cancel then
for i, opt in options do
local value = type(opt[4]) == "boolean" ? inputs[i].mValue : inputs[i].mContent
if opt[4] ~= value then
print(opt[1].." set to "..value)
opt[3](value)
end
end
end
done = true
end
movie:Execute("SetCallBack", "owfSampleSettingsChangesDone")
function _T.owfSampleGetSettings()
return options:mapped(function(opt)
opt[4] = opt[2]()
if type(opt[4]) == "boolean" then
return {
mLabel = opt[1],
mType = CHECKBOX,
mValue = opt[4],
}
end
return {
mLabel = opt[1],
mType = INPUTBOX,
mContent = opt[4],
mMaxChars = 500,
mMultiLine = false,
mSkipAutoFocus = true,
}
end)
end
movie:Execute("SetElementsFunction", "owfSampleGetSettings")
movie:Execute("SetConfirmButtonActive", "true")
movie:Execute("EnableHints", "")
repeat
until done or not pcall(yield)
if not IsNull(movie) then
movie:Close()
end