diff --git a/code/modules/client/preference_setup/vore/07_traits.dm b/code/modules/client/preference_setup/vore/07_traits.dm index c1e20f0d09..d367d6233a 100644 --- a/code/modules/client/preference_setup/vore/07_traits.dm +++ b/code/modules/client/preference_setup/vore/07_traits.dm @@ -64,6 +64,9 @@ . += link + (trait_prefs[identifier] ? "Enabled" : "Disabled") if (2) //TRAIT_PREF_TYPE_COLOR . += " " + color_square(hex = trait_prefs[identifier]) + link + "Change" + if (3) //TRAIT_PREF_TYPE_STRING - CHOMPEdit + var/string = trait_prefs[identifier] + . += link + (length(string) > 0 ? string : "\[Empty\]") . += "" . += "" if (altered) @@ -102,6 +105,9 @@ var/new_color = input(user, "Choose the color for this trait preference:", "Trait Preference", trait_prefs[preference]) as color|null if (new_color) trait_prefs[preference] = new_color + if (3) //TRAIT_PREF_TYPE_STRING - CHOMPEdit + var/new_string = instance.apply_sanitization_to_string(preference, tgui_input_text(user, "What should the new value be?", instance.has_preferences[preference][2], trait_prefs[preference], MAX_NAME_LEN)) + trait_prefs[preference] = new_string // Definition of the stuff for Ears /datum/category_item/player_setup_item/vore/traits diff --git a/code/modules/mob/living/carbon/human/species/station/traits_vr/_traits.dm b/code/modules/mob/living/carbon/human/species/station/traits_vr/_traits.dm index 46a4b4c1d5..1c906b501b 100644 --- a/code/modules/mob/living/carbon/human/species/station/traits_vr/_traits.dm +++ b/code/modules/mob/living/carbon/human/species/station/traits_vr/_traits.dm @@ -8,6 +8,7 @@ #define TRAIT_PREF_TYPE_BOOLEAN 1 #define TRAIT_PREF_TYPE_COLOR 2 +#define TRAIT_PREF_TYPE_STRING 3 #define TRAIT_NO_VAREDIT_TARGET 0 #define TRAIT_VAREDIT_TARGET_SPECIES 1 diff --git a/code/modules/mob/living/carbon/human/species/station/traits_vr/neutral_ch.dm b/code/modules/mob/living/carbon/human/species/station/traits_vr/neutral_ch.dm index 67d36ef9ec..48293bbcac 100644 --- a/code/modules/mob/living/carbon/human/species/station/traits_vr/neutral_ch.dm +++ b/code/modules/mob/living/carbon/human/species/station/traits_vr/neutral_ch.dm @@ -81,13 +81,34 @@ excludes = list(/datum/trait/neutral/autohiss_tajaran, /datum/trait/neutral/autohiss_unathi) /datum/trait/neutral/gargoyle - name = "Gargoyle (adjustable)" - desc = "You turn into a statue (or similiar) at will, but also whenever you run out of energy. Being a statue replenishes your energy slowly." + name = "Gargoyle (Adjustable)" + desc = "You turn into a statue (or similar) at will, but also whenever you run out of energy. Being a statue replenishes your energy slowly." cost = 0 custom_only = FALSE //slimes, xenochimera, diona, proteans, etc, basically anything but custom doesn't make sense (as much as I wanna play a petrifying slime) //Nah makes perfect sense, they could just be gene modded, not to mention we can expand this to have the statue and description of it renameable as well as color adjustable, to support general petrification - //TODO: make Gargoyle Statue Desc, Name and Color adjustable. + has_preferences = list("identifier" = list(TRAIT_PREF_TYPE_STRING, "Identifier", TRAIT_NO_VAREDIT_TARGET, "statue"), + "material" = list(TRAIT_PREF_TYPE_STRING, "Material", TRAIT_NO_VAREDIT_TARGET, "stone"), + "tint" = list(TRAIT_PREF_TYPE_COLOR, "Statue color", TRAIT_NO_VAREDIT_TARGET, "#FFFFFF"), + "adjective" = list(TRAIT_PREF_TYPE_STRING, "Adjective", TRAIT_NO_VAREDIT_TARGET, "hardens")/*, + "pickupable" = list(TRAIT_PREF_TYPE_BOOLEAN, "Can be picked up", TRAIT_NO_VAREDIT_TARGET, FALSE)*/) -/datum/trait/neutral/gargoyle/apply(var/datum/species/S,var/mob/living/carbon/human/H) +/datum/trait/neutral/gargoyle/apply(var/datum/species/S,var/mob/living/carbon/human/H, var/list/trait_prefs) ..(S,H) - H.LoadComponent(/datum/component/gargoyle) + var/datum/component/gargoyle/G = H.LoadComponent(/datum/component/gargoyle) + if (trait_prefs) + G.tint = trait_prefs["tint"] + G.material = lowertext(trait_prefs["material"]) + G.identifier = lowertext(trait_prefs["identifier"]) + G.adjective = lowertext(trait_prefs["adjective"]) + +/datum/trait/neutral/gargoyle/apply_sanitization_to_string(var/pref, var/input) + if (has_preferences[pref][1] != TRAIT_PREF_TYPE_STRING || length(input) <= 0) + return + input = sanitizeSafe(input, 25) + if (length(input) <= 0) + return default_value_for_pref(pref) + input = lowertext(input) + if (pref == "adjective") + if (copytext_char(input, -1) != "s") + input += "s" + return input diff --git a/code/modules/mob/living/carbon/human/species/station/traits_vr/trait.dm b/code/modules/mob/living/carbon/human/species/station/traits_vr/trait.dm index 0de5ae3097..29181208c8 100644 --- a/code/modules/mob/living/carbon/human/species/station/traits_vr/trait.dm +++ b/code/modules/mob/living/carbon/human/species/station/traits_vr/trait.dm @@ -73,4 +73,14 @@ return TRUE if(TRAIT_PREF_TYPE_COLOR) //color return "#ffffff" + if(TRAIT_PREF_TYPE_STRING) //CHOMPEdit - string + return "" return + +/datum/trait/proc/apply_sanitization_to_string(var/pref, var/input) //CHOMPEdit addition + if (has_preferences[pref][1] != TRAIT_PREF_TYPE_STRING || length(input) <= 0) + return default_value_for_pref(pref) + input = sanitizeSafe(input, MAX_NAME_LEN) + if (length(input) <= 0) + return default_value_for_pref(pref) + return input diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index 6ef80b62bd..b85ef97380 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -103,6 +103,10 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon() #define TOTAL_LAYERS 39 //CHOMPStation edit. <---- KEEP THIS UPDATED, should always equal the highest number here, used to initialize a list. ////////////////////////////////// +//These two are only used for gargoyles currently +#define HUMAN_BODY_LAYERS list(MUTATIONS_LAYER, TAIL_LOWER_LAYER, WING_LOWER_LAYER, BODYPARTS_LAYER, SKIN_LAYER, BLOOD_LAYER, MOB_DAM_LAYER, TAIL_UPPER_LAYER, HAIR_LAYER, HAIR_ACCESSORY_LAYER, EYES_LAYER, WING_LAYER, VORE_BELLY_LAYER, VORE_TAIL_LAYER, TAIL_UPPER_LAYER_ALT) +#define HUMAN_OTHER_LAYERS list(MODIFIER_EFFECTS_LAYER, FIRE_LAYER, MOB_WATER_LAYER, TARGETED_LAYER) + /mob/living/carbon/human var/list/overlays_standing[TOTAL_LAYERS] var/previous_damage_appearance // store what the body last looked like, so we only have to update it if something changed @@ -1366,6 +1370,7 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon() update_wing_showing() //Human Overlays Indexes///////// +/* CHOMPEdit - why are these undefined?? #undef MUTATIONS_LAYER #undef SKIN_LAYER #undef MOB_DAM_LAYER @@ -1399,3 +1404,4 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon() #undef WATER_LAYER #undef TARGETED_LAYER #undef TOTAL_LAYERS +*/ diff --git a/modular_chomp/code/datums/components/gargoyle.dm b/modular_chomp/code/datums/components/gargoyle.dm index 33ca4e1b64..4e0cacfafa 100644 --- a/modular_chomp/code/datums/components/gargoyle.dm +++ b/modular_chomp/code/datums/components/gargoyle.dm @@ -12,7 +12,7 @@ var/identifier = "statue" var/adjective = "hardens" var/material = "stone" - var/tint = rgb(255,255,255) + var/tint = "#FFFFFF" /datum/component/gargoyle/Initialize() if (!ishuman(parent)) @@ -21,10 +21,6 @@ gargoyle.verbs += /mob/living/carbon/human/proc/gargoyle_transformation gargoyle.verbs += /mob/living/carbon/human/proc/gargoyle_pause gargoyle.verbs += /mob/living/carbon/human/proc/gargoyle_checkenergy - gargoyle.verbs += /mob/living/carbon/human/proc/gargoyle_verbAdjective - gargoyle.verbs += /mob/living/carbon/human/proc/gargoyle_verbIdentifier - gargoyle.verbs += /mob/living/carbon/human/proc/gargoyle_verbMaterial - gargoyle.verbs += /mob/living/carbon/human/proc/gargoyle_verbColor START_PROCESSING(SSprocessing, src) @@ -41,6 +37,9 @@ if (transformed) if (!statue) transformed = FALSE + else if (gargoyle.loc != statue) + statue.unpetrify(FALSE) + return statue.damage(-0.5) energy = min(energy+0.3, 100) @@ -104,55 +103,3 @@ var/datum/component/gargoyle/comp = GetComponent(/datum/component/gargoyle) if (comp) to_chat(src, "You have [round(comp.energy,0.01)] energy remaining. It is currently [comp.paused ? "stable" : (comp.transformed ? "increasing" : "decreasing")].") - -/mob/living/carbon/human/proc/Gargoyle_Customizer(var/namer,var/type) - var/datum/component/gargoyle/comp = GetComponent(/datum/component/gargoyle) - if (comp) - if(type==1) - return comp.identifier = namer - if(type==2) - return comp.material = namer - if(type==3) - return comp.adjective = namer - if(type==4) - return comp.tint = namer - //Add color code here in the future - if(type==5) - return - //Placeholder for being able to pick up statues - -/mob/living/carbon/human/proc/gargoyle_verbIdentifier() - set name = "Gargoyle - Name Identifier" - set category = "Abilities" - set desc = "Renames your statue to something of your choosing but only the statue part of the name." - var/user_input = input("Enter your statue identifier") - if(!user_input) - return - Gargoyle_Customizer(user_input,1) - -/mob/living/carbon/human/proc/gargoyle_verbMaterial() - set name = "Gargoyle - Name Material" - set category = "Abilities" - set desc = "Renames your statues material to something of your choosing. by default it is (stone)." - var/user_input = input("Enter your petrification material") - if(!user_input) - return - Gargoyle_Customizer(user_input,2) - -/mob/living/carbon/human/proc/gargoyle_verbAdjective() - set name = "Gargoyle - Name Adjective" - set category = "Abilities" - set desc = "Renames your petrification adjective to something of your choosing. by default it is (hardens)." - var/user_input = input("Enter your petrification adjective") - if(!user_input) - return - Gargoyle_Customizer(user_input,3) - -/mob/living/carbon/human/proc/gargoyle_verbColor() - set name = "Gargoyle - Recolor" - set category = "Abilities" - set desc = "Recolor your statue to something of your choosing. by default it is grey." - var/user_input = input(src, "Choose a tint color!") as color|null - if(!user_input) - return - Gargoyle_Customizer(user_input,4) diff --git a/modular_chomp/code/game/objects/structures/gargoyle.dm b/modular_chomp/code/game/objects/structures/gargoyle.dm index 6cd3caadfc..61abab25ad 100644 --- a/modular_chomp/code/game/objects/structures/gargoyle.dm +++ b/modular_chomp/code/game/objects/structures/gargoyle.dm @@ -17,6 +17,10 @@ var/stored_examine var/identifier = "statue" var/material = "stone" + var/adjective = "hardens" + var/list/tail_lower_dirs = list(SOUTH, EAST, WEST) + var/image/tail_image + var/tail_alt = TAIL_UPPER_LAYER /obj/structure/gargoyle/Initialize(mapload, var/mob/living/carbon/human/H) . = ..() @@ -25,54 +29,64 @@ if (!istype(H) || !isturf(H.loc)) return var/datum/component/gargoyle/comp = H.GetComponent(/datum/component/gargoyle) - var/tint = rgb(255,255,255) + var/tint = "#FFFFFF" if (comp) comp.cooldown = world.time + (15 SECONDS) comp.statue = src comp.transformed = TRUE comp.paused = FALSE - identifier = comp.identifier - material = comp.material - tint = comp.tint + identifier = length(comp.identifier) > 0 ? comp.identifier : initial(identifier) + material = length(comp.material) > 0 ? comp.material : initial(material) + tint = length(comp.tint) > 0 ? comp.tint : initial(tint) + adjective = length(comp.adjective) > 0 ? comp.adjective : initial(adjective) + if (copytext_char(adjective, -1) != "s") + adjective += "s" gargoyle = H + if (H.tail_style?.clip_mask_state) + tail_lower_dirs.Cut() + else if (H.tail_style) + tail_lower_dirs = H.tail_style.lower_layer_dirs.Copy() + tail_alt = H.tail_alt ? TAIL_UPPER_LAYER_ALT : TAIL_UPPER_LAYER + max_integrity = H.getMaxHealth() + 100 obj_integrity = H.health + 100 original_int = obj_integrity name = "[identifier] of [H.name]" - desc = "A very lifelike [identifier]." + desc = "A very lifelike [identifier] made of [material]." stored_examine = H.examine() description_fluff = H.get_description_fluff() if (H.buckled) H.buckled.unbuckle_mob(H, TRUE) - icon = H.icon - copy_overlays(H) + //icon = H.icon + //copy_overlays(H) //calculate our tints + var/list/RGB = rgb2num(tint) - var/list/RGB = list( hex2num( "[tint[2]][tint[3]]" ), - hex2num( "[tint[4]][tint[5]]" ), - hex2num( "[tint[6]][tint[7]]" ) - ) + var/colorr = rgb(RGB[1]*0.299, RGB[2]*0.299, RGB[3]*0.299) + var/colorg = rgb(RGB[1]*0.587, RGB[2]*0.587, RGB[3]*0.587) + var/colorb = rgb(RGB[1]*0.114, RGB[2]*0.114, RGB[3]*0.114) - var/colora = rgb( RGB[1]*0.299, - RGB[2]*0.299, - RGB[3]*0.299 - ) - - var/colorb = rgb( RGB[1]*0.587, - RGB[2]*0.587, - RGB[3]*0.587 - ) - - var/colorc = rgb( RGB[1]*0.114, - RGB[2]*0.114, - RGB[3]*0.114 - ) - - color = list( colora, colorb , colorc, rgb(0,0,0)) + var/tint_color = list(colorr, colorg, colorb, "#000000") + var/list/body_layers = HUMAN_BODY_LAYERS + var/list/other_layers = HUMAN_OTHER_LAYERS + for (var/i = 1; i <= length(H.overlays_standing); i++) + if (i in other_layers) + continue + if (istype(H.overlays_standing[i], /image) && (i in body_layers)) + var/image/old_image = H.overlays_standing[i] + var/image/new_image = image(old_image) + if (i == TAIL_LOWER_LAYER || i == TAIL_UPPER_LAYER || i == TAIL_UPPER_LAYER_ALT) + tail_image = new_image + new_image.color = tint_color + new_image.layer = old_image.layer + add_overlay(new_image) + else + if (!isnull(H.overlays_standing[i])) + add_overlay(H.overlays_standing[i]) initial_sleep = H.sleeping initial_blind = H.eye_blind @@ -92,7 +106,7 @@ flapping = H.flapping H.toggle_tail(FALSE, FALSE) H.toggle_wing(FALSE, FALSE) - H.visible_message("[H]'s skin rapidly turns to [material]!", "Your skin abruptly [comp.adjective] as you turn to [material]!") + H.visible_message("[H]'s skin rapidly [adjective] as they turn to [material]!", "Your skin abruptly [adjective] as you turn to [material]!") H.forceMove(src) H.SetBlinded(0) H.SetSleeping(0) @@ -122,7 +136,7 @@ . += stored_examine return -/obj/structure/gargoyle/proc/unpetrify() +/obj/structure/gargoyle/proc/unpetrify(var/deal_damage = TRUE) if (!gargoyle) return var/datum/component/gargoyle/comp = gargoyle.GetComponent(/datum/component/gargoyle) @@ -130,16 +144,17 @@ comp.cooldown = world.time + (15 SECONDS) comp.statue = null comp.transformed = FALSE - gargoyle.forceMove(loc) - gargoyle.transform = transform - gargoyle.pixel_x = pixel_x - gargoyle.pixel_y = pixel_y - gargoyle.is_shifted = initial_is_shifted - gargoyle.dir = dir - gargoyle.lying = initial_lying - gargoyle.lying_prev = initial_lying_prev - gargoyle.toggle_tail(wagging, FALSE) - gargoyle.toggle_wing(flapping, FALSE) + if (gargoyle.loc == src) + gargoyle.forceMove(loc) + gargoyle.transform = transform + gargoyle.pixel_x = pixel_x + gargoyle.pixel_y = pixel_y + gargoyle.is_shifted = initial_is_shifted + gargoyle.dir = dir + gargoyle.lying = initial_lying + gargoyle.lying_prev = initial_lying_prev + gargoyle.toggle_tail(wagging, FALSE) + gargoyle.toggle_wing(flapping, FALSE) gargoyle.sdisabilities &= ~MUTE //why is there no ADD_TRAIT etc here that's actually ussssed gargoyle.status_flags &= ~GODMODE gargoyle.SetBlinded(initial_blind) @@ -148,11 +163,12 @@ gargoyle.canmove = 1 gargoyle.update_canmove() var/hurtmessage = "" - if (obj_integrity < original_int) - var/f = (original_int - obj_integrity) / 10 - for (var/x in 1 to 10) - gargoyle.adjustBruteLoss(f) - hurtmessage = " You feel your body take the damage that was dealt while being [material]!" + if (deal_damage) + if (obj_integrity < original_int) + var/f = (original_int - obj_integrity) / 10 + for (var/x in 1 to 10) + gargoyle.adjustBruteLoss(f) + hurtmessage = " You feel your body take the damage that was dealt while being [material]!" gargoyle.updatehealth() alpha = 0 gargoyle.visible_message("[gargoyle]'s skin rapidly reverts, returning them to normal!", "Your skin reverts, freeing your movement once more![hurtmessage]") @@ -197,4 +213,11 @@ playsound(src, W.hitsound, 50, 1) damage(W.force) else - return ..() \ No newline at end of file + return ..() + +/obj/structure/gargoyle/set_dir(var/new_dir) + . = ..() + if(. && tail_image) + cut_overlay(tail_image) + tail_image.layer = (dir in tail_lower_dirs) ? TAIL_LOWER_LAYER : tail_alt + add_overlay(tail_image) diff --git a/modular_chomp/code/modules/mob/living/carbon/human/update_icons.dm b/modular_chomp/code/modules/mob/living/carbon/human/update_icons.dm index d540e3a66a..085ad1226d 100644 --- a/modular_chomp/code/modules/mob/living/carbon/human/update_icons.dm +++ b/modular_chomp/code/modules/mob/living/carbon/human/update_icons.dm @@ -1,11 +1,6 @@ // Expand shoe layer to allow changing the icon for digi legs // For some reason, suit and uniform already has this funcitonality, but shoes do not. -//Duplicate defines so the code below can compile. See non-modular update_icons.dm for proper placement. -#define SHOES_LAYER_ALT 10 //Shoe-slot item (when set to be under uniform via verb) -#define SHOES_LAYER 13 //Shoe-slot item -#define VORE_BELLY_LAYER 33 //Should be the same that it is in update_icons.dm - /mob/living/carbon/human/update_inv_shoes() //. = ..() remove_layer(SHOES_LAYER)