Divergent/mods/Western Goods/gamedata/scripts/western_goods_mcm.script

93 lines
6.7 KiB
Plaintext
Raw Permalink Normal View History

2024-03-17 20:18:03 -04:00
---==================================================================================================================---
--- ---
--- Original Author(s) : RavenAscendant ---
--- Edited : NLTP_ASHES ---
--- Date : 17/04/2023 ---
--- License : Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) ---
--- ---
--- Script used to define the options in MCM. ---
--- ---
--- If you do not have MCM installed, you can directly modify the values in the 'defaults' table just bellow. ---
--- Note that editing that table will require you to reload your save before changes can take effect. ---
--- ---
---==================================================================================================================---
-- If you don't use MCM, change your defaults from here.
local defaults = {
["guided_surge"] = false,
["guided_tasks"] = false,
["heli_attack"] = DIK_keys.DIK_K,
["rangefinder_nv"] = DIK_keys.DIK_J,
["magazine_psi_regen"] = 1.0,
["corpse_loot_factor"] = 1.0,
["trader_loot_factor"] = 1.0,
["max_item_per_corpse"] = 5,
["debug_mode"] = false,
["addon_removal"] = false,
}
--- Function used to get a given setting defined in MCM.
--- If MCM isn't installed, it will default back to a value in defaults table.
--- @param key string
--- @return any
function get_config(key)
if ui_mcm then return ui_mcm.get("western_goods/"..key) else return defaults[key] end
end
--- Function used to set the value of a given setting defined in MCM.
--- If MCM isn't installed, it will temporarily change the value of the setting in the defaults table.
--- @param key string
--- @return any
function set_config(key,value)
if ui_mcm then return ui_mcm.set("western_goods/"..key, value) else defaults[key] = value end
end
--- MCM UI definition.
--- @return table
function on_mcm_load()
op = { id="western_goods", sh=true, gr={
{ id="title", type="slide", text="ui_mcm_western_goods_title", link="ui_options_slider_disguise", spacing=20, size={512,50} },
{ type="title", text="ui_mcm_western_goods_general_settings_title" },
{ id="guided_surge", type="check", val=1, def=false },
{ id="guided_tasks", type="check", val=1, def=false },
{ id="magazine_psi_regen", type="track", val=2, def=1.0, min=0.25, max=2.0, step=0.25 },
{ id="divider", type="line" },
{ type="title", text="ui_mcm_western_goods_keybindings_title" },
{ id="heli_attack", type="key_bind", val=2, def=DIK_keys.DIK_K },
{ id="rangefinder_nv", type="key_bind", val=2, def=DIK_keys.DIK_J },
{ id="divider", type="line" },
{ type="title", text="ui_mcm_western_goods_loot_settings_title" },
{ id="trader_loot_factor", type="track", val=2, def=1.0, min=0.0, max=2.0, step=0.25 },
{ id="corpse_loot_factor", type="track", val=2, def=1.0, min=0.0, max=2.0, step=0.25 },
{ id="max_item_per_corpse", type="track", val=2, def=5, min=0, max=5, step=1 },
{ id="divider", type="line" },
--{ type="title", text="ui_mcm_western_goods_compatibility_title" },
--{ id="divider", type="line" },
{ type="title", text="ui_mcm_western_goods_technical_settings_title" },
{ id="debug_mode", type="check", val=1, def=false },
{ id="addon_removal", type="check", val=1, def=false },
} }
return op
end
-- ---------------------------------------------------------------------------------------------------------------------
-- Device Selector Key Integration
-- ---------------------------------------------------------------------------------------------------------------------
if detector_selector_mcm then
detector_selector_mcm.categories.wg_gps = {
devices = {
["wg_gps"] = 1
},
defaults = {keybind = DIK_keys.DIK_B, modifier = 2, second_key = 1}
}
detector_selector_mcm.categories.wg_minedetect = {
devices = {
["wg_minedetect"] = 1
},
defaults = {keybind = DIK_keys.DIK_B, modifier = 2, second_key = 2}
}
end