Divergent/mods/DynaHUD/gamedata/scripts/dynahud_mcm.script

258 lines
14 KiB
Plaintext
Raw Normal View History

2024-03-17 20:18:03 -04:00
-- If you don't use MCM, change your defaults from here.
local defaults = {
["general/notifications_enable"]=true,
["main_hud/autohide"]=true,
["main_hu/hide_health_threshold"]=0.9,
["main_hud/hide_health_autohide_timeout"]=30,
["main_hud/hide_power_threshold"]=0.9,
["main_hud/hide_psy_threshold"]=0.9,
["main_hud/bg_autohide_timeout"]=5,
["main_hud/bg_preview_on_show"]=true,
["main_hud/bg_preview_time"]=5,
["icons_hud/autohide"]=true,
["icons_hud/autohide_timeout"]=20,
["icons_hud/preview"]=true,
["icons_hud/preview_timer"]=180,
["icons_hud/preview_time"]=10,
["icons_hud/inventory_preview"]=true,
["icons_hud/enable_timers"]=true,
["icons_hud/show_only_expiring"]=30,
["icons_hud/xy_multiply_by"]=1,
["icons_hud/main_hud_on_x"]=0,
["icons_hud/main_hud_on_y"]=0,
["icons_hud/main_hud_on_size_mul"]=1,
["icons_hud/main_hud_on_spacing"]=0,
["icons_hud/main_hud_off_x"]=0,
["icons_hud/main_hud_off_y"]=0,
["icons_hud/main_hud_off_size_mul"]=1,
["icons_hud/main_hud_off_spacing"]=0,
["weapon_hud/autohide"]=true,
["weapon_hud/autohide_timeout"]=10,
["weapon_hud/aim_show"]=true,
["weapon_hud/aim_show_quickhide"]=true,
["weapon_hud/reload_show"]=true,
["weapon_hud/weaponcheck_show"]=true,
["bhs_hud/autohide"]=true,
["bhs_hud/update_hide_timeout"]=10,
["bhs_hud/dismiss_timeout"]=5,
["bhs_hud/dismiss_force"]=false,
["bhs_hud/dismiss_on_mapload"]=false,
["bhs_hud/always_hide"]=false,
["minimap/autohide"]=true,
["minimap/hide"]=true,
["minimap/show"]=true,
["minimap/show_on_wpn_lowered"]=true,
["minimap/show_on_actor_sprint"]=true,
["minimap/show_on_wpn_lowered_timeout"]=4,
["minimap/hide_on_end_sprint_timeout"]=3,
["minimap/autohide_timeout"]=5,
["mags/enable"]=true,
["mags/show_reload"]=true,
["mags/show_ammocheck"]=true,
["mags/autohide_timeout"]=5,
["mags/weapon_check"]=true,
["cold_system/enable"]=true,
["cold_system/safe_threshold"]=600,
["cold_system/critical_threshold"]=1800,
["cold_system/breakpoint"]=100,
["cold_system/show_recovery"]=true,
["companion_hud/enable"]=true,
["companion_hud/check_distance"]=true,
["companion_hud/safe_distance"]=100,
["companion_hud/preview_time"]=5,
}
function get_config(key)
if ui_mcm then return ui_mcm.get("dynahud/"..key) else return defaults[key] end
end
function bhs_available()
if zzz_player_injuries then
return true
else
return false
end
end
function bhs_not_available()
return not bhs_available()
end
function mags_available()
if magazines then
return true
else
return false
end
end
function mags_not_available()
return not mags_available()
end
function cold_available()
if cold_system then
return true
else
return false
end
end
function cold_not_available()
return not cold_available()
end
function xcvb_icon_timer_available()
if actor_status.XCVB_ICON_TIME_IMPL then
return true
else
return false
end
end
function on_mcm_load()
printf("dynahud MCM settings loading")
op = { id= "dynahud",gr={
{ id= "general" ,sh=true, text="ui_mcm_dynahud_menu_general" ,gr={
{id= "title",type= "slide",link= "ui\\dynahud\\Dynahud_Banner.dds",text="ui_mcm_dynahud_general_title",size= {512,50},spacing= 20 },
{id = "help1", type = "desc", clr = {200, 200, 255, 200}, text="ui_mcm_dynahud_general_help1"},
{id = "help2", type = "desc", clr = {200, 200, 255, 200}, text="ui_mcm_dynahud_general_help2"},
{id = "help3", type = "desc", clr = {200, 200, 255, 200}, text="ui_mcm_dynahud_general_help3"},
{id = "help4", type = "desc", clr = {200, 200, 255, 200}, text="ui_mcm_dynahud_general_help4"},
{id = "help5", type = "desc", clr = {200, 200, 255, 200}, text="ui_mcm_dynahud_general_help5"},
{id= "notifications_title",type= "slide",link= "ui_options_slider_news",text="ui_mcm_dynahud_general_notifications_title",size= {512,50},spacing= 20 },
{id = "notifications_help", type = "desc", clr = {200, 200, 255, 200}, text="ui_mcm_dynahud_general_notifications_help"},
{id = "notifications_enable",type = "check", val = 1,def = true}
},},
{ id= "main_hud" ,sh=true, text="ui_mcm_dynahud_menu_main_hud" ,gr={
{id= "title",type= "slide",link= "ui\\dynahud\\Main_Hud_Banner.dds",text="ui_mcm_dynahud_main_hud_title",size= {512,50},spacing= 20 },
{id = "help1", type = "desc", clr = {200, 200, 255, 200}, text="ui_mcm_dynahud_main_hud_help1"},
{id = "autohide",type = "check", val = 1,def = true},
{id = "hide_health_threshold",type ="track",val = 2, min=0.3,max=1,step=0.1, def = 0.9},
{id = "hide_health_autohide_timeout",type="track",val = 2, min=0,max=60,step=1, def = 30},
{id = "hide_power_threshold",type="track",val = 2, min=0.3,max=1,step=0.1, def = 0.9},
{id = "hide_psy_threshold",type ="track",val = 2, min=0.30,max=1,step=0.05, def = 0.90},
{id = "bg_autohide_timeout",type="track",val = 2, min=0,max=60,step=1, def = 5},
{id = "bg_preview_on_show",type="check",val = 1,def = true},
{id = "bg_preview_time",type="track",val = 2, min=0,max=60,step=1, def = 5},
},},
{ id= "icons_hud" ,sh=true, text="ui_mcm_dynahud_menu_icons_hud" ,gr={
{id= "title",type= "slide",link= "ui\\dynahud\\Main_Hud_Banner.dds",text="ui_mcm_dynahud_icons_hud_title",size= {512,50},spacing= 20 },
{id = "help1", type = "desc", clr = {200, 200, 255, 200}, text="ui_mcm_dynahud_icons_hud_help1"},
{id = "help2", type = "desc", clr = {200, 200, 255, 200}, text="ui_mcm_dynahud_icons_hud_help2"},
{id = "help3", type = "desc", clr = {200, 200, 255, 200}, text="ui_mcm_dynahud_icons_hud_help3"},
{id = "autohide",type = "check", val = 1,def = true},
{id = "autohide_timeout",type="track",val = 2, min=0,max=60,step=1, def = 20},
{id = "preview",type = "check", val = 1,def = true},
{id = "preview_timer",type="track",val = 2, min=0,max=300,step=1, def = 180},
{id = "preview_time",type="track",val = 2, min=0,max=60,step=1, def = 10},
{id = "inventory_preview",type = "check", val = 1,def = true},
{id = "enable_timers",type = "check", val = 1,def = true, precondition= {xcvb_icon_timer_available}},
{id = "show_only_expiring",type="track",val = 2, min=0,max=300,step=1, def = 30, precondition= {xcvb_icon_timer_available}},
{id= "title",type= "slide",link= "ui\\dynahud\\Main_Hud_Banner.dds",text="ui_mcm_dynahud_icons_hud_position",size= {512,50},spacing= 20 },
{id = "help4", type = "desc", clr = {200, 200, 255, 200}, text="ui_mcm_dynahud_icons_hud_help4"},
{id = "xy_multiply_by",type="track",val = 2, min=1,max=5,step=1, def = 1},
{id = "main_hud_on_x",type="track",val = 2, min=-400,max=400,step=1, def = 0},
{id = "main_hud_on_y",type="track",val = 2, min=-400,max=400,step=1, def = 0},
{id = "main_hud_on_size_mul",type="track",val = 2, min=0.5,max=2,step=0.1, def = 1},
{id = "main_hud_on_spacing",type="track",val = 2, min=-15,max=30,step=1, def = 0},
{ id = "line", type = "line" },
{id = "main_hud_off_x",type="track",val = 2, min=-400,max=400,step=1, def = 0},
{id = "main_hud_off_y",type="track",val = 2, min=-400,max=400,step=1, def = 0},
{id = "main_hud_off_size_mul",type="track",val = 2, min=0.5,max=2,step=0.1, def = 1},
{id = "main_hud_off_spacing",type="track",val = 2, min=-15,max=30,step=1, def = 0},
},},
{ id= "weapon_hud" ,sh=true, text="ui_mcm_dynahud_menu_weapon_hud" ,gr={
{id= "title",type= "slide",link= "ui_options_slider_gameplay_diff",text="ui_mcm_dynahud_weapon_hud_title",size= {512,50},spacing= 20 },
{id = "help", type = "desc", clr = {200, 200, 255, 200}, text="ui_mcm_dynahud_weapon_hud_help"},
{id = "help1", type = "desc", clr = {200, 200, 255, 200}, text="ui_mcm_dynahud_weapon_hud_help1"},
{id = "autohide",type = "check", val = 1,def = true},
{id = "autohide_timeout",type ="track",val = 2, min=0,max=60,step=1, def = 10},
{id = "aim_show",type = "check", val = 1,def = false},
{id = "aim_show_quickhide",type = "check", val = 1,def = false},
{id = "reload_show",type = "check",precondition= {mags_not_available}, val = 1,def = false},
{id = "weaponcheck_show",type = "check",precondition= {mags_not_available}, val = 1,def = false},
},},
{ id= "companion_hud" ,sh=true, text="ui_mcm_dynahud_companion_hud" ,gr={
{id= "title",type= "slide",link= "ui\\dynahud\\Companion Hud.dds",text="ui_mcm_dynahud_companion_hud_title",size= {512,50},spacing= 20 },
{id = "help1", type = "desc", clr = {200, 200, 255, 200}, text="ui_mcm_dynahud_companion_hud_help1"},
{id = "help2", type = "desc", clr = {200, 200, 255, 200}, text="ui_mcm_dynahud_companion_hud_help2"},
{id = "help3", type = "desc", clr = {200, 200, 255, 200}, text="ui_mcm_dynahud_companion_hud_help3"},
{id = "help4", type = "desc", clr = {200, 200, 255, 200}, text="ui_mcm_dynahud_companion_hud_help4"},
{id = "help5", type = "desc", clr = {200, 200, 255, 200}, text="ui_mcm_dynahud_companion_hud_help5"},
{id = "help6", type = "desc", clr = {200, 200, 255, 200}, text="ui_mcm_dynahud_companion_hud_help6"},
{id = "enable",type = "check", val = 1,def = true},
{id = "check_distance",type = "check", val = 1,def = true},
{id = "safe_distance",type ="track",val = 2, min=50,max=400,step=25, def = 100},
{id = "preview_time",type ="track",val = 2, min=1,max=60,step=1, def = 5},
},},
{ id= "bhs_hud" ,sh=true, text="ui_mcm_dynahud_menu_bhs_hud" ,gr={
{id= "title",type= "slide",link= "ui\\dynahud\\BHS_Banner.dds",text="ui_mcm_dynahud_bhs_hud_title",size= {512,50},spacing= 20 },
{id = "help1", type = "desc", clr = {200, 200, 255, 200}, text="ui_mcm_dynahud_bhs_hud_help1"},
{id = "help2", type = "desc", clr = {200, 200, 255, 200}, text="ui_mcm_dynahud_bhs_hud_help2"},
{id = "help3", type = "desc", clr = {200, 200, 255, 200}, text="ui_mcm_dynahud_bhs_hud_help3"},
{id = "help4", type = "desc", clr = {200, 200, 255, 200}, text="ui_mcm_dynahud_bhs_hud_help4"},
{id = "help5", type = "desc", clr = {200, 200, 255, 200}, text="ui_mcm_dynahud_bhs_hud_help5"},
{id = "autohide",type ="check",precondition= {bhs_available}, val=1,def=true},
{id = "update_hide_timeout",type="track",precondition= {bhs_available},val = 2, min=1,max=60,step=1, def = 10},
{id = "dismiss_timeout",type="track",precondition= {bhs_available},val = 2, min=1,max=15,step=1, def = 5},
{id = "dismiss_force",type ="check",precondition= {bhs_available}, val=1,def=false},
{id = "help6", type = "desc",precondition= {bhs_not_available}, clr = {255,183,47,143}, text="ui_mcm_dynahud_bhs_hud_help6"},
{id = "dismiss_on_mapload",type="check",precondition= {bhs_available},val = 1,def = false},
{id = "always_hide",type="check",precondition= {bhs_available},val = 1,def = false},
},},
{ id= "minimap" ,sh=true, text="ui_mcm_dynahud_menu_minimap" ,gr={
{id= "title",type= "slide",link= "ui_options_slider_fast_travel",text="ui_mcm_dynahud_minimap_title",size= {512,50},spacing= 20 },
{id = "help1", type = "desc", clr = {200, 200, 255, 200}, text="ui_mcm_dynahud_minimap_help1"},
{id = "help2", type = "desc", clr = {200, 200, 255, 200}, text="ui_mcm_dynahud_minimap_help2"},
{id = "help3", type = "desc", clr = {200, 200, 255, 200}, text="ui_mcm_dynahud_minimap_help3"},
{id = "help4", type = "desc", clr = {200, 200, 255, 200}, text="ui_mcm_dynahud_minimap_help4"},
{id = "autohide",type ="check",val=1,def=true},
{id = "help5", type = "desc", clr = {200, 200, 255, 200}, text="ui_mcm_dynahud_minimap_help5"},
{id = "hide",type ="check",val=1,def=true},
{id = "show",type ="check",val=1,def=true},
{id = "autohide_timeout",type="track",val = 2, min=1,max=60,step=1, def = 5},
{id = "show_on_wpn_lowered",type ="check",val=1,def=true},
{id = "show_on_actor_sprint",type ="check",val=1,def=false},
{id = "show_on_wpn_lowered_timeout",type="track",val = 2, min=0,max=10,step=0.5, def = 4},
{id = "hide_on_end_sprint_timeout",type="track",val = 2, min=0,max=10,step=0.5, def = 3},
},},
{ id= "mags" ,sh=true, text="ui_mcm_dynahud_menu_mags" ,gr={
{id= "title",type= "slide",link= "ui_options_slider_gameplay_diff",text="ui_mcm_dynahud_mags_title",size= {512,50},spacing= 20 },
{id = "help", type = "desc", clr = {200, 200, 255, 200}, text="ui_mcm_dynahud_mags_help"},
{id = "enable",type ="check",precondition= {mags_available},val=1,def=true},
{id = "show_reload",type ="check",precondition= {mags_available},val=1,def=true},
{id = "show_ammocheck",type ="check",precondition= {mags_available},val=1,def=true},
{id = "autohide_timeout",type="track",precondition= {mags_available},val = 2, min=1,max=15,step=1, def = 5},
{id = "weapon_check",type ="check",precondition= {mags_available},val=1,def=true},
{id = "help1", type = "desc",precondition= {mags_not_available},clr = {255,183,47,143}, text="ui_mcm_dynahud_mags_help1"},
},},
{ id= "cold_system" ,sh=true, text="ui_mcm_dynahud_menu_cold_system" ,gr={
{id= "title",type= "slide",link= "ui\\dynahud\\Cold Hud.dds",text="ui_mcm_dynahud_cold_system_title",size= {512,50},spacing= 20 },
{id = "help", type = "desc", clr = {200, 200, 255, 200}, text="ui_mcm_dynahud_cold_system_help"},
{id = "help1", type = "desc", clr = {200, 200, 255, 200}, text="ui_mcm_dynahud_cold_system_help1"},
{id = "help2", type = "desc", clr = {200, 200, 255, 200}, text="ui_mcm_dynahud_cold_system_help2"},
{id = "enable",type ="check",precondition= {cold_available},val=1,def=true},
{id = "safe_threshold",type ="track",precondition= {cold_available},val = 2, min=0,max=2000,step=100, def = 600},
{id = "critical_threshold",type ="track",precondition= {cold_available},val = 2, min=0,max=2000,step=100, def = 1800},
{id = "breakpoint",type="track",precondition= {cold_available},val = 2, min=1,max=200,step=10, def = 100},
{id = "show_recovery",type ="check",precondition= {cold_available},val=1,def=true},
{id = "help_not_installed", type = "desc",precondition= {cold_not_available},clr = {255,183,47,143}, text="ui_mcm_dynahud_cold_system_help_not_installed"},
},},
}
}
return op
end
function dynahud_update_settings()
zzzz_dynahud.dynahud_on_mcm_change()
if z_alticons and z_alticons.dynahud_on_mcm_change then
z_alticons.dynahud_on_mcm_change()
end
end
function on_game_start()
RegisterScriptCallback("on_option_change", dynahud_update_settings)
end