Ports baystation character preview system (#2630)

Ports the bay's character preview system, which is far better to observe aesthetic changes in the character creation, also solves the issues such as markings don't showing up at the character selection menu.
This commit is contained in:
Alberyk
2017-06-09 09:14:24 -03:00
committed by skull132
parent a44b65944d
commit 0e977d08e6
13 changed files with 190 additions and 620 deletions
@@ -26,6 +26,7 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
S["organ_data"] >> pref.organ_data
S["rlimb_data"] >> pref.rlimb_data
S["body_markings"] >> pref.body_markings
pref.preview_icon = null
/datum/category_item/player_setup_item/general/body/save_character(var/savefile/S)
S["species"] << pref.species
@@ -166,9 +167,9 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
/datum/category_item/player_setup_item/general/body/content(var/mob/user)
pref.update_preview_icon()
if(pref.preview_icon_front && pref.preview_icon_side)
user << browse_rsc(pref.preview_icon_front, "previewicon.png")
user << browse_rsc(pref.preview_icon_side, "previewicon2.png")
if(!pref.preview_icon)
pref.update_preview_icon()
user << browse_rsc(pref.preview_icon, "previewicon.png")
var/datum/species/mob_species = all_species[pref.species]
. += "<table><tr style='vertical-align:top'><td><b>Body</b> "
@@ -257,7 +258,9 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
else
. += "<br><br>"
. += "</td><td><b>Preview</b><br><img src=previewicon.png height=64 width=64><img src=previewicon2.png height=64 width=64>"
. += "</td><td><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>"
. += "</td></tr></table>"
. += "<b>Hair</b><br>"
@@ -598,6 +601,10 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
var/disability_flag = text2num(href_list["disabilities"])
pref.disabilities ^= disability_flag
return TOPIC_REFRESH
else if(href_list["toggle_clothing"])
pref.dress_mob = !pref.dress_mob
return TOPIC_REFRESH
return ..()
+13 -9
View File
@@ -73,8 +73,6 @@ datum/preferences
//Mob preview
var/icon/preview_icon = null
var/icon/preview_icon_front = null
var/icon/preview_icon_side = null
var/is_updating_icon = 0
//Jobs, uses bitflags
@@ -141,6 +139,8 @@ datum/preferences
var/savefile/loaded_preferences
var/savefile/loaded_character
var/datum/category_collection/player_setup_collection/player_setup
var/dress_mob = TRUE
/datum/preferences/New(client/C)
new_setup()
@@ -238,7 +238,7 @@ datum/preferences
dat += player_setup.content(user)
dat += "</html></body>"
user << browse(dat, "window=preferences;size=625x736")
user << browse(dat, "window=preferences;size=800x800")
/datum/preferences/proc/process_link(mob/user, list/href_list)
if(!user) return
@@ -291,7 +291,7 @@ datum/preferences
ShowChoices(usr)
return 1
/datum/preferences/proc/copy_to(mob/living/carbon/human/character, safety = 0)
/datum/preferences/proc/copy_to(mob/living/carbon/human/character, icon_updates = 1)
// Sanitizing rather than saving as someone might still be editing when copy_to occurs.
player_setup.sanitize_setup()
@@ -305,6 +305,7 @@ datum/preferences
character.real_name = real_name
character.name = character.real_name
character.set_species(species)
if(character.dna)
character.dna.real_name = character.real_name
@@ -335,10 +336,12 @@ datum/preferences
character.g_eyes = g_eyes
character.b_eyes = b_eyes
character.h_style = h_style
character.r_hair = r_hair
character.g_hair = g_hair
character.b_hair = b_hair
character.f_style = f_style
character.r_facial = r_facial
character.g_facial = g_facial
character.b_facial = b_facial
@@ -412,11 +415,12 @@ datum/preferences
backbag = 1 //Same as above
character.backbag = backbag
//Debugging report to track down a bug, which randomly assigned the plural gender to people.
if(character.gender in list(PLURAL, NEUTER))
if(isliving(src)) //Ghosts get neuter by default
message_admins("[character] ([character.ckey]) has spawned with their gender as plural or neuter. Please notify coders.")
character.gender = MALE
if(icon_updates)
character.force_update_limbs()
character.update_mutations(0)
character.update_body(0)
character.update_hair(0)
character.update_icons()
/datum/preferences/proc/open_load_dialog_sql(mob/user)
var/dat = "<body>"