mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +00:00
[MIRROR] adds body marking zone customization (#6756)
Co-authored-by: Heroman3003 <31296024+Heroman3003@users.noreply.github.com> Co-authored-by: CHOMPStation2 <chompsation2@gmail.com>
This commit is contained in:
@@ -37,6 +37,7 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
|
||||
var/r_wing3 = 30 // Wing tertiary color
|
||||
var/g_wing3 = 30 // Wing tertiary color
|
||||
var/b_wing3 = 30 // Wing tertiary color
|
||||
var/datum/browser/markings_subwindow = null
|
||||
|
||||
// Sanitize ear/wing/tail styles
|
||||
/datum/preferences/proc/sanitize_body_styles()
|
||||
@@ -75,6 +76,16 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
|
||||
continue
|
||||
.[instance.name] = instance
|
||||
|
||||
/datum/preferences/proc/mass_edit_marking_list(var/marking, var/change_on = TRUE, var/change_color = TRUE, var/marking_value = null, var/on = TRUE, var/color = "#000000")
|
||||
var/datum/sprite_accessory/marking/mark_datum = body_marking_styles_list[marking]
|
||||
var/list/new_marking = marking_value||mark_datum.body_parts
|
||||
for (var/NM in new_marking)
|
||||
if (marking_value && !islist(new_marking[NM])) continue
|
||||
new_marking[NM] = list("on" = (!change_on && marking_value) ? marking_value[NM]["on"] : on, "color" = (!change_color && marking_value) ? marking_value[NM]["color"] : color)
|
||||
if (change_color)
|
||||
new_marking["color"] = color
|
||||
return new_marking
|
||||
|
||||
/datum/category_item/player_setup_item/general/body
|
||||
name = "Body"
|
||||
sort_order = 3
|
||||
@@ -252,6 +263,10 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
|
||||
if(!pref.rlimb_data) pref.rlimb_data = list()
|
||||
if(!pref.body_markings) pref.body_markings = list()
|
||||
else pref.body_markings &= body_marking_styles_list
|
||||
for (var/M in pref.body_markings) //VOREStation Edit
|
||||
if (!islist(pref.body_markings[M]))
|
||||
var/col = istext(pref.body_markings[M]) ? pref.body_markings[M] : "#000000"
|
||||
pref.body_markings[M] = pref.mass_edit_marking_list(M,color=col)
|
||||
if(!pref.bgstate || !(pref.bgstate in pref.bgstate_options))
|
||||
pref.bgstate = "000"
|
||||
|
||||
@@ -420,12 +435,12 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
|
||||
for(var/M in pref.body_markings)
|
||||
priority += 1
|
||||
var/datum/sprite_accessory/marking/mark_datum = body_marking_styles_list[M]
|
||||
var/mark_color = "[pref.body_markings[M]]"
|
||||
//var/mark_color = "[pref.body_markings[M]]" //VOREStation Edit
|
||||
|
||||
for(var/BP in mark_datum.body_parts)
|
||||
var/obj/item/organ/external/O = character.organs_by_name[BP]
|
||||
if(O)
|
||||
O.markings[M] = list("color" = mark_color, "datum" = mark_datum, "priority" = priority)
|
||||
O.markings[M] = list("color" = pref.body_markings[M][BP]["color"], "datum" = mark_datum, "priority" = priority, "on" = pref.body_markings[M][BP]["on"])
|
||||
character.markings_len = priority
|
||||
|
||||
var/list/last_descriptors = list()
|
||||
@@ -644,7 +659,7 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
|
||||
. += "<br><a href='?src=\ref[src];marking_style=1'>Body Markings +</a><br>"
|
||||
. += "<table>"
|
||||
for(var/M in pref.body_markings)
|
||||
. += "<tr><td>[M]</td><td>[pref.body_markings.len > 1 ? "<a href='?src=\ref[src];marking_up=[M]'>˄</a> <a href='?src=\ref[src];marking_down=[M]'>˅</a> <a href='?src=\ref[src];marking_move=[M]'>mv</a> " : ""]<a href='?src=\ref[src];marking_remove=[M]'>-</a> <a href='?src=\ref[src];marking_color=[M]'>Color</a>[color_square(hex = pref.body_markings[M])]</td></tr>"
|
||||
. += "<tr><td>[M]</td><td>[pref.body_markings.len > 1 ? "<a href='?src=\ref[src];marking_up=[M]'>˄</a> <a href='?src=\ref[src];marking_down=[M]'>˅</a> <a href='?src=\ref[src];marking_move=[M]'>mv</a> " : ""]<a href='?src=\ref[src];marking_remove=[M]'>-</a> <a href='?src=\ref[src];marking_color=[M]'>Color</a>[color_square(hex = pref.body_markings[M]["color"] ? pref.body_markings[M]["color"] : "#000000")] - <a href='?src=\ref[src];marking_submenu=[M]'>Customize</a></td></tr>"
|
||||
|
||||
. += "</table>"
|
||||
. += "<br>"
|
||||
@@ -906,7 +921,7 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
|
||||
*/ //VOREStation Removal End
|
||||
var/new_marking = tgui_input_list(user, "Choose a body marking:", "Character Preference", usable_markings)
|
||||
if(new_marking && CanUseTopic(user))
|
||||
pref.body_markings[new_marking] = "#000000" //New markings start black
|
||||
pref.body_markings[new_marking] = pref.mass_edit_marking_list(new_marking) //New markings start black
|
||||
return TOPIC_REFRESH_UPDATE_PREVIEW
|
||||
|
||||
else if(href_list["marking_up"])
|
||||
@@ -942,16 +957,69 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
|
||||
|
||||
else if(href_list["marking_remove"])
|
||||
var/M = href_list["marking_remove"]
|
||||
winshow(user, "prefs_markings_subwindow", FALSE)
|
||||
pref.body_markings -= M
|
||||
return TOPIC_REFRESH_UPDATE_PREVIEW
|
||||
|
||||
else if(href_list["marking_color"])
|
||||
var/M = href_list["marking_color"]
|
||||
var/mark_color = input(user, "Choose the [M] color: ", "Character Preference", pref.body_markings[M]) as color|null
|
||||
if (isnull(pref.body_markings[M]["color"]))
|
||||
if (tgui_alert(user, "You currently have customized marking colors. This will reset each bodypart's color. Are you sure you want to continue?","Reset Bodypart Colors",list("Yes","No")) == "No")
|
||||
return TOPIC_NOACTION
|
||||
var/mark_color = input(user, "Choose the [M] color: ", "Character Preference", pref.body_markings[M]["color"]) as color|null
|
||||
if(mark_color && CanUseTopic(user))
|
||||
pref.body_markings[M] = "[mark_color]"
|
||||
pref.body_markings[M] = pref.mass_edit_marking_list(M,FALSE,TRUE,pref.body_markings[M],color="[mark_color]")
|
||||
return TOPIC_REFRESH_UPDATE_PREVIEW
|
||||
|
||||
else if (href_list["marking_submenu"])
|
||||
var/M = href_list["marking_submenu"]
|
||||
markings_subwindow(user, M)
|
||||
return TOPIC_NOACTION
|
||||
|
||||
else if (href_list["toggle_all_marking_selection"])
|
||||
var/toggle = text2num(href_list["toggle"])
|
||||
var/marking = href_list["toggle_all_marking_selection"]
|
||||
if (pref.body_markings.Find(marking) == 0)
|
||||
winshow(user, "prefs_markings_subwindow", FALSE)
|
||||
return TOPIC_NOACTION
|
||||
pref.body_markings[marking] = pref.mass_edit_marking_list(marking,TRUE,FALSE,pref.body_markings[marking],on=toggle)
|
||||
markings_subwindow(user, marking)
|
||||
return TOPIC_REFRESH_UPDATE_PREVIEW
|
||||
|
||||
else if (href_list["color_all_marking_selection"])
|
||||
var/marking = href_list["color_all_marking_selection"]
|
||||
if (pref.body_markings.Find(marking) == 0)
|
||||
winshow(user, "prefs_markings_subwindow", FALSE)
|
||||
return TOPIC_NOACTION
|
||||
var/mark_color = input(user, "Choose the [marking] color: ", "Character Preference", pref.body_markings[marking]["color"]) as color|null
|
||||
if(mark_color && CanUseTopic(user))
|
||||
pref.body_markings[marking] = pref.mass_edit_marking_list(marking,FALSE,TRUE,pref.body_markings[marking],color="[mark_color]")
|
||||
markings_subwindow(user, marking)
|
||||
return TOPIC_REFRESH_UPDATE_PREVIEW
|
||||
|
||||
else if (href_list["zone_marking_color"])
|
||||
var/marking = href_list["zone_marking_color"]
|
||||
if (pref.body_markings.Find(marking) == 0)
|
||||
winshow(user, "prefs_markings_subwindow", FALSE)
|
||||
return TOPIC_NOACTION
|
||||
var/zone = href_list["zone"]
|
||||
pref.body_markings[marking]["color"] = null //turn off the color button outside the submenu
|
||||
var/mark_color = input(user, "Choose the [marking] color: ", "Character Preference", pref.body_markings[marking]["color"]) as color|null
|
||||
if(mark_color && CanUseTopic(user))
|
||||
pref.body_markings[marking][zone]["color"] = "[mark_color]"
|
||||
markings_subwindow(user, marking)
|
||||
return TOPIC_REFRESH_UPDATE_PREVIEW
|
||||
|
||||
else if (href_list["zone_marking_toggle"])
|
||||
var/marking = href_list["zone_marking_toggle"]
|
||||
if (pref.body_markings.Find(marking) == 0)
|
||||
winshow(user, "prefs_markings_subwindow", FALSE)
|
||||
return TOPIC_NOACTION
|
||||
var/zone = href_list["zone"]
|
||||
pref.body_markings[marking][zone]["on"] = text2num(href_list["toggle"])
|
||||
markings_subwindow(user, marking)
|
||||
return TOPIC_REFRESH_UPDATE_PREVIEW
|
||||
|
||||
else if(href_list["reset_limbs"])
|
||||
reset_limbs()
|
||||
return TOPIC_REFRESH_UPDATE_PREVIEW
|
||||
@@ -1406,3 +1474,23 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
|
||||
dat += "</center></body>"
|
||||
|
||||
user << browse(dat, "window=species;size=700x400")
|
||||
|
||||
/datum/category_item/player_setup_item/general/body/proc/markings_subwindow(mob/user, marking)
|
||||
var/static/list/part_to_string = list(BP_HEAD = "Head", BP_TORSO = "Upper Body", BP_GROIN = "Lower Body", BP_R_ARM = "Right Arm", BP_L_ARM = "Left Arm", BP_R_HAND = "Right Hand", BP_L_HAND = "Left Hand", BP_R_LEG = "Right Leg", BP_L_LEG = "Left Leg", BP_R_FOOT = "Right Foot", BP_L_FOOT = "Left Foot")
|
||||
var/dat = "<html><body><center><h2>Editing '[marking]'</h2><br>"
|
||||
dat += "<a href='?src=\ref[src];toggle_all_marking_selection=[marking];toggle=1'>Enable All</a> "
|
||||
dat += "<a href='?src=\ref[src];toggle_all_marking_selection=[marking];toggle=0'>Disable All</a> "
|
||||
dat += "<a href='?src=\ref[src];color_all_marking_selection=[marking]'>Change Color of All</a><br></center>"
|
||||
dat += "<br>"
|
||||
for (var/bodypart in pref.body_markings[marking])
|
||||
if (!islist(pref.body_markings[marking][bodypart])) continue
|
||||
dat += "[part_to_string[bodypart]]: [color_square(hex = pref.body_markings[marking][bodypart]["color"])] "
|
||||
dat += "<a href='?src=\ref[src];zone_marking_color=[marking];zone=[bodypart]'>Change</a> "
|
||||
dat += "<a href='?src=\ref[src];zone_marking_toggle=[marking];zone=[bodypart];toggle=[!pref.body_markings[marking][bodypart]["on"]]'>[pref.body_markings[marking][bodypart]["on"] ? "Toggle Off" : "Toggle On"]</a><br>"
|
||||
|
||||
dat += "</body></html>"
|
||||
winshow(user, "prefs_markings_subwindow", TRUE)
|
||||
pref.markings_subwindow = new(user, "prefs_markings_browser", "Marking Editor", 400, 400)
|
||||
pref.markings_subwindow.set_content(dat)
|
||||
pref.markings_subwindow.open(FALSE)
|
||||
onclose(user, "prefs_markings_subwindow", src)
|
||||
|
||||
@@ -125,7 +125,7 @@ var/list/preferences_datums = list()
|
||||
var/list/rlimb_data = list()
|
||||
var/list/player_alt_titles = new() // the default name of a job like "Medical Doctor"
|
||||
|
||||
var/list/body_markings = list() // "name" = "#rgbcolor"
|
||||
var/list/body_markings = list() // "name" = "#rgbcolor" //VOREStation Edit: "name" = list(BP_HEAD = list("on" = <enabled>, "color" = "#rgbcolor"), BP_TORSO = ...)
|
||||
|
||||
var/list/flavor_texts = list()
|
||||
var/list/flavour_texts_robot = list()
|
||||
|
||||
@@ -31,7 +31,7 @@ var/static/icon/ingame_hud_med_vr = icon('icons/mob/hud_med_vr.dmi')
|
||||
var/obj/item/organ/external/O = organs_by_name[BP]
|
||||
if(O)
|
||||
success = TRUE
|
||||
O.markings[mark_datum.name] = list("color" = mark_color, "datum" = mark_datum, "priority" = markings_len + 1)
|
||||
O.markings[mark_datum.name] = list("color" = mark_color, "datum" = mark_datum, "priority" = markings_len + 1, "on" = TRUE)
|
||||
if (success)
|
||||
markings_len += 1
|
||||
update_dna()
|
||||
@@ -93,18 +93,32 @@ var/static/icon/ingame_hud_med_vr = icon('icons/mob/hud_med_vr.dmi')
|
||||
for (var/marking in O.markings)
|
||||
var/priority = num2text(O.markings[marking]["priority"])
|
||||
if (markings[priority])
|
||||
markings[priority] |= list("[marking]" = O.markings[marking]["color"]) //yes I know technically you could have a limb that was attached that has the same marking as another limb with a different color but I'm too tired
|
||||
if (markings[priority][marking])
|
||||
markings[priority][marking] |= list(O.organ_tag = list("on" = O.markings[marking]["on"], "color" = O.markings[marking]["color"]))
|
||||
else
|
||||
markings[priority] |= list("[marking]" = list(O.organ_tag = list("on" = O.markings[marking]["on"], "color" = O.markings[marking]["color"]))) //yes I know technically you could have a limb that was attached that has the same marking as another limb with a different color but I'm too tired
|
||||
else
|
||||
priorities |= O.markings[marking]["priority"]
|
||||
markings[priority] = list("[marking]" = O.markings[marking]["color"])
|
||||
markings[priority] = list("[marking]" = list(O.organ_tag = list("on" = O.markings[marking]["on"], "color" = O.markings[marking]["color"])))
|
||||
var/list/sorted = list()
|
||||
while (priorities.len > 0)
|
||||
var/priority = min(priorities)
|
||||
priorities.Remove(priority)
|
||||
priority = num2text(priority)
|
||||
for (var/marking in markings[priority])
|
||||
if (!(marking in sorted))
|
||||
if (isnull(sorted[marking]))
|
||||
sorted[marking] = markings[priority][marking]
|
||||
else
|
||||
sorted[marking] |= markings[priority][marking]
|
||||
for (var/marking in sorted)
|
||||
var/should_add_color = TRUE
|
||||
var/last_color = null
|
||||
for (var/bp in sorted[marking])
|
||||
if (!isnull(last_color) && sorted[marking][bp]["color"] != last_color)
|
||||
should_add_color = FALSE
|
||||
last_color = sorted[marking][bp]["color"]
|
||||
if (should_add_color)
|
||||
sorted[marking]["color"] = last_color||"#000000"
|
||||
del(markings)
|
||||
del(priorities)
|
||||
markings_len = sorted.len
|
||||
|
||||
@@ -304,7 +304,8 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon()
|
||||
icon_key += "#000000"
|
||||
|
||||
for(var/M in part.markings)
|
||||
icon_key += "[M][part.markings[M]["color"]]"
|
||||
if (part.markings[M]["on"])
|
||||
icon_key += "[M][part.markings[M]["color"]]"
|
||||
|
||||
// VOREStation Edit Start
|
||||
if(part.nail_polish)
|
||||
|
||||
@@ -82,6 +82,8 @@ var/global/list/limb_icon_cache = list()
|
||||
/obj/item/organ/external/proc/get_icon(var/skeletal, var/can_apply_transparency = TRUE)
|
||||
|
||||
for(var/M in markings)
|
||||
if (!markings[M]["on"])
|
||||
continue
|
||||
var/datum/sprite_accessory/marking/mark = markings[M]["datum"]
|
||||
if(mark.organ_override)
|
||||
var/icon/mark_s = new/icon("icon" = mark.icon, "icon_state" = "[mark.icon_state]-[organ_tag]")
|
||||
@@ -90,6 +92,8 @@ var/global/list/limb_icon_cache = list()
|
||||
mob_icon.Blend(mark_s, ICON_OVERLAY) //So when it's on your body, it has icons
|
||||
icon_cache_key = "[M][markings[M]["color"]]"
|
||||
for(var/MM in markings)
|
||||
if (!markings[MM]["on"])
|
||||
continue
|
||||
var/datum/sprite_accessory/marking/mark_style = markings[MM]["datum"]
|
||||
if(mark_style.organ_override)
|
||||
continue
|
||||
@@ -143,6 +147,8 @@ var/global/list/limb_icon_cache = list()
|
||||
//Body markings, actually does not include head this time. Done separately above.
|
||||
if(!istype(src,/obj/item/organ/external/head))
|
||||
for(var/M in markings)
|
||||
if (!markings[M]["on"])
|
||||
continue
|
||||
var/datum/sprite_accessory/marking/mark_style = markings[M]["datum"]
|
||||
var/icon/mark_s = new/icon("icon" = mark_style.icon, "icon_state" = "[mark_style.icon_state]-[organ_tag]")
|
||||
mark_s.Blend(markings[M]["color"], mark_style.color_blend_mode) // VOREStation edit
|
||||
@@ -173,6 +179,8 @@ var/global/list/limb_icon_cache = list()
|
||||
apply_colouration(mob_icon)
|
||||
if(owner && owner.synth_markings)
|
||||
for(var/M in markings)
|
||||
if (!markings[M]["on"])
|
||||
continue
|
||||
var/datum/sprite_accessory/marking/mark_style = markings[M]["datum"]
|
||||
var/icon/mark_s = new/icon("icon" = mark_style.icon, "icon_state" = "[mark_style.icon_state]-[organ_tag]")
|
||||
mark_s.Blend(markings[M]["color"], mark_style.color_blend_mode) // VOREStation edit
|
||||
|
||||
@@ -386,6 +386,8 @@
|
||||
|
||||
//Head markings
|
||||
for(var/M in markings)
|
||||
if (!markings[M]["on"])
|
||||
continue
|
||||
var/datum/sprite_accessory/marking/mark_style = markings[M]["datum"]
|
||||
var/icon/mark_s = new/icon("icon" = mark_style.icon, "icon_state" = "[mark_style.icon_state]-[organ_tag]")
|
||||
mark_s.Blend(markings[M]["color"], mark_style.color_blend_mode)
|
||||
|
||||
@@ -408,7 +408,7 @@
|
||||
var/list/markings_data[0]
|
||||
markings = target.get_prioritised_markings()
|
||||
for (var/marking in markings)
|
||||
markings_data[++markings_data.len] = list("marking_name" = marking, "marking_color" = markings[marking])
|
||||
markings_data[++markings_data.len] = list("marking_name" = marking, "marking_color" = markings[marking]["color"] ? markings[marking]["color"] : "#000000") //too tired to add in another submenu for bodyparts here
|
||||
data["markings"] = markings_data
|
||||
// VOREStation Add End
|
||||
|
||||
|
||||
@@ -1291,6 +1291,30 @@ window "outputwindow"
|
||||
enable-http-images = true
|
||||
max-lines = 0
|
||||
|
||||
window "prefs_markings_subwindow"
|
||||
elem "prefs_markings_subwindow"
|
||||
type = MAIN
|
||||
pos = 281,0
|
||||
size = 400x400
|
||||
anchor1 = -1,-1
|
||||
anchor2 = -1,-1
|
||||
background-color = none
|
||||
is-visible = false
|
||||
saved-params = "pos;size;is-minimized;is-maximized"
|
||||
title = "Marking Selection Editing"
|
||||
statusbar = false
|
||||
can-minimize = false
|
||||
outer-size = 416x439
|
||||
inner-size = 400x400
|
||||
elem "prefs_markings_browser"
|
||||
type = BROWSER
|
||||
pos = 0,0
|
||||
size = 400x400
|
||||
anchor1 = -1,-1
|
||||
anchor2 = -1,-1
|
||||
background-color = none
|
||||
saved-params = ""
|
||||
|
||||
window "rpane"
|
||||
elem "rpane"
|
||||
type = MAIN
|
||||
|
||||
Reference in New Issue
Block a user