Files
CHOMPstation/code/modules/client/preference_setup/vore/01_ears.dm
T
2017-04-22 00:57:14 +01:00

150 lines
6.1 KiB
Plaintext

// Global stuff that will put us on the map
/datum/category_group/player_setup_category/vore
name = "VORE"
sort_order = 7
category_item_type = /datum/category_item/player_setup_item/vore
// Define a place to save appearance in character setup
/datum/preferences
var/custom_species // Custom species name
var/ear_style // Type of selected ear style
var/tail_style // Type of selected tail style
var/r_tail = 30 // Tail/Taur color
var/g_tail = 30 // Tail/Taur color
var/b_tail = 30 // Tail/Taur color
var/dress_mob = TRUE
// Definition of the stuff for Ears
/datum/category_item/player_setup_item/vore/ears
name = "Appearance"
sort_order = 1
/datum/category_item/player_setup_item/vore/ears/load_character(var/savefile/S)
S["custom_species"] >> pref.custom_species
S["ear_style"] >> pref.ear_style
S["tail_style"] >> pref.tail_style
S["r_tail"] >> pref.r_tail
S["g_tail"] >> pref.g_tail
S["b_tail"] >> pref.b_tail
/datum/category_item/player_setup_item/vore/ears/save_character(var/savefile/S)
S["custom_species"] << pref.custom_species
S["ear_style"] << pref.ear_style
S["tail_style"] << pref.tail_style
S["r_tail"] << pref.r_tail
S["g_tail"] << pref.g_tail
S["b_tail"] << pref.b_tail
/datum/category_item/player_setup_item/vore/ears/sanitize_character()
pref.r_tail = sanitize_integer(pref.r_tail, 0, 255, initial(pref.r_tail))
pref.g_tail = sanitize_integer(pref.g_tail, 0, 255, initial(pref.g_tail))
pref.b_tail = sanitize_integer(pref.b_tail, 0, 255, initial(pref.b_tail))
if(pref.ear_style)
pref.ear_style = sanitize_inlist(pref.ear_style, ear_styles_list, initial(pref.ear_style))
if(pref.tail_style)
pref.tail_style = sanitize_inlist(pref.tail_style, tail_styles_list, initial(pref.tail_style))
/datum/category_item/player_setup_item/vore/ears/copy_to_mob(var/mob/living/carbon/human/character)
character.custom_species = pref.custom_species
character.ear_style = ear_styles_list[pref.ear_style]
character.tail_style = tail_styles_list[pref.tail_style]
character.r_tail = pref.r_tail
character.b_tail = pref.b_tail
character.g_tail = pref.g_tail
/datum/category_item/player_setup_item/vore/ears/content(var/mob/user)
. += "<h2>VORE Station Settings</h2>"
if(!pref.preview_icon)
pref.update_preview_icon()
user << browse_rsc(pref.preview_icon, "previewicon.png")
. += "<b>Preview</b><br>"
. += "<div class='statusDisplay'><center><img src=previewicon.png width=[pref.preview_icon.Width()] height=[pref.preview_icon.Height()]></center></div>"
. += "<br><a href='?src=\ref[src];toggle_clothing=1'>[pref.dress_mob ? "Hide equipment" : "Show equipment"]</a><br>"
var/ear_display = "Normal"
if(pref.ear_style && (pref.ear_style in ear_styles_list))
var/datum/sprite_accessory/ears/instance = ear_styles_list[pref.ear_style]
ear_display = instance.name
else if(pref.ear_style)
ear_display = "REQUIRES UPDATE"
. += "<b>Ears</b><br>"
. += " Style: <a href='?src=\ref[src];ear_style=1'>[ear_display]</a><br>"
var/tail_display = "Normal"
if(pref.tail_style && (pref.tail_style in tail_styles_list))
var/datum/sprite_accessory/ears/instance = tail_styles_list[pref.tail_style]
tail_display = instance.name
else if(pref.tail_style)
tail_display = "REQUIRES UPDATE"
. += "<b>Tail</b><br>"
. += " Style: <a href='?src=\ref[src];tail_style=1'>[tail_display]</a><br>"
if(tail_styles_list[pref.tail_style])
var/datum/sprite_accessory/tail/T = tail_styles_list[pref.tail_style]
if (T.do_colouration)
. += "<a href='?src=\ref[src];tail_color=1'>Change Color</a> <font face='fixedsys' size='3' color='#[num2hex(pref.r_tail, 2)][num2hex(pref.g_tail, 2)][num2hex(pref.b_tail, 2)]'><table style='display:inline;' bgcolor='#[num2hex(pref.r_tail, 2)][num2hex(pref.g_tail, 2)][num2hex(pref.b_tail)]'><tr><td>__</td></tr></table> </font><br>"
. += "<b>Custom Species</b> "
. += "<a href='?src=\ref[src];custom_species=1'>[pref.custom_species ? pref.custom_species : "None"]</a><br>"
/datum/category_item/player_setup_item/vore/ears/OnTopic(var/href,var/list/href_list, var/mob/user)
if(!CanUseTopic(user))
return TOPIC_NOACTION
else if(href_list["custom_species"])
var/raw_choice = sanitize(input(user, "Input your character's species:",
"Character Preference", pref.custom_species) as null|text, MAX_NAME_LEN)
if (CanUseTopic(user))
pref.custom_species = raw_choice
return TOPIC_REFRESH
else if(href_list["ear_style"])
// Construct the list of names allowed for this user.
var/list/pretty_ear_styles = list("Normal" = null)
for(var/path in ear_styles_list)
var/datum/sprite_accessory/ears/instance = ear_styles_list[path]
if((!instance.ckeys_allowed) || (usr.ckey in instance.ckeys_allowed))
pretty_ear_styles[instance.name] = path
// Present choice to user
var/selection = input(user, "Pick ears", "Character Preference") as null|anything in pretty_ear_styles
pref.ear_style = pretty_ear_styles[selection]
return TOPIC_REFRESH_UPDATE_PREVIEW
else if(href_list["tail_style"])
// Construct the list of names allowed for this user.
var/list/pretty_tail_styles = list("Normal")
for(var/path in tail_styles_list)
var/datum/sprite_accessory/tail/instance = tail_styles_list[path]
if((!instance.ckeys_allowed) || (user.ckey in instance.ckeys_allowed))
pretty_tail_styles[instance.name] = path
// Present choice to user
var/selection = input(user, "Pick tails", "Character Preference") as null|anything in pretty_tail_styles
if(selection && selection != "Normal")
pref.tail_style = pretty_tail_styles[selection]
else
if(pref.tail_style)
return TOPIC_REFRESH_UPDATE_PREVIEW
else
pref.tail_style = null
return TOPIC_REFRESH_UPDATE_PREVIEW
else if(href_list["tail_color"])
var/new_tailc = input(user, "Choose your character's tail/taur colour:", "Character Preference",
rgb(pref.r_tail, pref.g_tail, pref.b_tail)) as color|null
if(new_tailc)
pref.r_tail = hex2num(copytext(new_tailc, 2, 4))
pref.g_tail = hex2num(copytext(new_tailc, 4, 6))
pref.b_tail = hex2num(copytext(new_tailc, 6, 8))
return TOPIC_REFRESH_UPDATE_PREVIEW
else if(href_list["toggle_clothing"])
pref.dress_mob = !pref.dress_mob
return TOPIC_REFRESH_UPDATE_PREVIEW
return ..()