Choose type of headset from loadout (#10540)

Choose type of headset from loadout
This commit is contained in:
Wowzewow (Wezzy)
2020-11-22 19:45:26 +08:00
committed by GitHub
parent 3704902e64
commit c4ce4dd232
20 changed files with 217 additions and 63 deletions

View File

@@ -12,6 +12,7 @@
S["backbag"] >> pref.backbag
S["backbag_style"] >> pref.backbag_style
S["pda_choice"] >> pref.pda_choice
S["headset_choice"] >> pref.headset_choice
/datum/category_item/player_setup_item/general/equipment/save_character(var/savefile/S)
S["all_underwear"] << pref.all_underwear
@@ -19,6 +20,7 @@
S["backbag"] << pref.backbag
S["backbag_style"] << pref.backbag_style
S["pda_choice"] << pref.pda_choice
S["headset_choice"] << pref.headset_choice
/datum/category_item/player_setup_item/general/equipment/gather_load_query()
return list(
@@ -28,7 +30,8 @@
"all_underwear_metadata",
"backbag",
"backbag_style",
"pda_choice"
"pda_choice",
"headset_choice"
),
"args" = list("id")
)
@@ -45,6 +48,7 @@
"backbag",
"backbag_style",
"pda_choice",
"headset_choice",
"id" = 1,
"ckey" = 1
)
@@ -57,6 +61,7 @@
"backbag" = pref.backbag,
"backbag_style" = pref.backbag_style,
"pda_choice" = pref.pda_choice,
"headset_choice" = pref.headset_choice,
"id" = pref.current_character,
"ckey" = PREF_CLIENT_CKEY
)
@@ -66,6 +71,7 @@
pref.backbag = text2num(pref.backbag)
pref.backbag_style = text2num(pref.backbag_style)
pref.pda_choice = text2num(pref.pda_choice)
pref.headset_choice = text2num(pref.headset_choice)
if(istext(pref.all_underwear))
var/before = pref.all_underwear
try
@@ -109,6 +115,7 @@
pref.backbag = sanitize_integer(pref.backbag, 1, backbaglist.len, initial(pref.backbag))
pref.backbag_style = sanitize_integer(pref.backbag_style, 1, backbagstyles.len, initial(pref.backbag_style))
pref.pda_choice = sanitize_integer(pref.pda_choice, 1, pdalist.len, initial(pref.pda_choice))
pref.headset_choice = sanitize_integer(pref.headset_choice, 1, headsetlist.len, initial(pref.headset_choice))
/datum/category_item/player_setup_item/general/equipment/content(var/mob/user)
. = list()
@@ -127,6 +134,7 @@
. += "Backpack Type: <a href='?src=\ref[src];change_backpack=1'><b>[backbaglist[pref.backbag]]</b></a><br>"
. += "Backpack Style: <a href='?src=\ref[src];change_backpack_style=1'><b>[backbagstyles[pref.backbag_style]]</b></a><br>"
. += "PDA Type: <a href='?src=\ref[src];change_pda=1'><b>[pdalist[pref.pda_choice]]</b></a><br>"
. += "Headset Type: <a href='?src=\ref[src];change_headset=1'><b>[headsetlist[pref.headset_choice]]</b></a><br>"
return jointext(., null)
@@ -165,6 +173,12 @@
pref.pda_choice = pdalist.Find(new_pda)
return TOPIC_REFRESH_UPDATE_PREVIEW
else if(href_list["change_headset"])
var/new_headset = input(user, "Choose your character's headset type:", "Character Preference", headsetlist[pref.headset_choice]) as null|anything in headsetlist
if(!isnull(new_headset) && CanUseTopic(user))
pref.headset_choice = headsetlist.Find(new_headset)
return TOPIC_REFRESH_UPDATE_PREVIEW
else if(href_list["change_underwear"])
var/datum/category_group/underwear/UWC = global_underwear.categories_by_name[href_list["change_underwear"]]
if(!UWC)
@@ -186,4 +200,3 @@
return TOPIC_REFRESH_UPDATE_PREVIEW
return ..()