Divergent/mods/Anomaly Magazines Redux/gamedata/scripts/magazines_mcm.script

133 lines
5.5 KiB
Plaintext

-- If you don't use MCM, change your defaults from here.
local defaults = {
debug = false,
mag_loadtime_factor = 1,
mag_unloadtime_factor = 1,
mag_tooltip = 1,
empty_mags_stack = true,
sort_inv = true,
show_hud = true,
icon_text = true,
ammo_icon = true,
scale = 1,
ammo_scale = 1,
group_by_ammo = true,
grp_by_bt = true,
show_bgrd = true,
bgrd = 1,
load_behavior = 0,
unload_behavior = 0,
loadstash_behavior = 0,
retain_round = false,
ejection = 0,
tacload = false,
mag_unequip_trs = 1,
three_hands = false,
deathquality = 1.0,
deathammo = 1.0,
}
local def_map = {
debug = "mgmt",
mag_loadtime_factor = "mgmt",
mag_unloadtime_factor = "mgmt",
mag_tooltip = "mgmt",
empty_mags_stack = "mgmt",
sort_inv = "mgmt",
show_hud = "hud",
icon_text = "hud",
ammo_icon = "hud",
scale = "hud",
ammo_scale = "hud",
group_by_ammo = "hud",
grp_by_bt = "hud",
show_bgrd = "hud",
bgrd = "hud",
load_behavior = "gameplay",
unload_behavior = "gameplay",
loadstash_behavior = "gameplay",
retain_round = "gameplay",
ejection = "gameplay",
tacload = "gameplay",
mag_unequip_trs = "gameplay",
three_hands = "gameplay",
deathquality = "gameplay",
deathammo = "gameplay",
}
local colors = {--alpha value will be reset to match slider
orange = GetARGB(100, 255, 159, 82),
pink = GetARGB(100, 255, 192, 203),
blond = GetARGB(100, 240, 240, 190),
white = GetARGB(100, 255, 255, 255),
brown = GetARGB(100, 165, 42, 42),
blue = GetARGB(100, 0, 0, 255),
}
function get_config(key)
if ui_mcm then return ui_mcm.get("magazines/"..def_map[key].."/"..key) else return defaults[key] end
end
function on_mcm_load()
op = { id= "magazines",gr={
{id = "mgmt",sh=true,gr={
{id= "mgmtitle",type= "slide",text="ui_mcm_magazines_mgmtitle",link= "ui_options_slider_player",size= {512,50},spacing= 20},
{id = "debug", type = "check", val = 1, def=false},
{id = "mag_loadtime_factor", type = "track", val = 2, min=0.4,max=2,step=0.1, def = 1},
{id = "mag_unloadtime_factor", type = "track", val = 2, min=0.4,max=2,step=0.1, def = 1},
{id= "mag_tooltip" ,type= "list", val= 2 ,def= 1 ,content= {{0,"topround"}, {1,"trcap"}, {2,"full"}} },
{id = "empty_mags_stack", type = "check", val = 1, def=true},
{id = "sort_inv", type = "check", val = 1, def=true},
{id= "highlight_color" ,type= "list" ,val= 0 ,def= "orange" ,content= {{"brown","ram_brown"},{"white","ram_white"}, {"blond","ram_blond"} , {"blue","ram_blue"}, {"orange","ram_orange"} , {"pink","ram_pink"} } },
{id= "highlight_clr_a" ,type= "track" ,val= 2 ,min= 0 ,max= 255 ,step= 1 ,def= 100 },
}},
{id = "hud",sh=true,gr={
{id= "hudtitle",type= "slide",text="ui_mcm_magazines_hudtitle",link= "ui_options_slider_player",size= {512,50},spacing= 20},
{id = "show_hud", type = "check", val = 1, def=true},
{id = "scale", type = "track", val = 2, min=0.1,max=2,step=0.05, def = 1},
{id = "grp_by_bt", type = "check", val = 1, def=true},
{id = "group_by_ammo", type = "check", val = 1, def=true},
{id = "icon_text", type = "check", val = 1, def=true},
{id = "ammo_icon", type = "check", val = 1, def=true},
{id = "ammo_scale", type = "track", val = 2, min=0.1,max=2,step=0.05, def = 1},
{id = "show_bgrd", type = "check", val = 1, def=true},
{id = "bgrd" ,type= "list" ,val= 2, def= 1, content= {{1,1},{2,2},{3,3},{4,4},{5,5},{6,6},{7,7},{8,8},{9,9},{10,10},{11,11},{12,12}},no_str = true},
}},
{id = "gameplay",sh=true,gr={
{id= "gametitle",type= "slide",text="ui_mcm_magazines_gametitle",link= "ui_options_slider_player",size= {512,50},spacing= 20},
{id = "deathquality", type = "track", val = 2, min=0.5,max=2,step=0.1, def = 1},
{id = "deathammo", type = "track", val = 2, min=0.5,max=2,step=0.1, def = 1},
{id = "load_behavior" ,type= "list" ,val= 2, def= 0, content = {{0,"ind"},{2,"box"}, {1, "full"}}},
{id = "unload_behavior" ,type= "list" ,val= 2, def= 0, content={{0,"ind"}, {1, "full"}}},
{id = "loadstash_behavior" ,type= "list" ,val= 2, def= 1, content= {{0,"ind"},{2,"box"}, {1, "full"}}},
{id = "retain_round", type = "check", val = 1, def=false},
{id = "mag_unequip_trs", type = "track", val = 2, min=0,max=100,step=1, def = 1},
{id = "ejection" ,type= "list" ,val= 2, def= 1, content= {{0,"loadout"},{1,"ruck"}}},
{ id= "rant", type= "desc", text= "ui_mcm_magazines_rant", clr= {255, 225, 0, 0}},
{id = "three_hands", type = "check", val = 1, def=false},
}},
}
}
return op
end
local function on_option_change()
if ui_mcm then
magazine_binder.ready_color = rax_persistent_highlight.change_alpha(colors[ui_mcm.get("magazines/mgmt/highlight_color")] or colors.orange , ui_mcm.get("magazines/mgmt/highlight_clr_a") or 100 )
empty_table(magazines.cache_mag_time)
end
end
function on_game_start()
RegisterScriptCallback("on_option_change",on_option_change)
on_option_change()
end