From d4ffc624f31cfa2e27bb5e1a0d110d1ac7bddc32 Mon Sep 17 00:00:00 2001 From: Geeves Date: Sun, 21 Nov 2021 22:03:30 +0200 Subject: [PATCH] Toggling Headgear Hair Blocking (#12759) --- .../preference_setup/loadout/loadout_head.dm | 30 +++++++++++++++++++ code/modules/clothing/clothing.dm | 18 +++++++++++ code/modules/clothing/head/helmet.dm | 11 +------ html/changelogs/geeves-readd_flb.yml | 7 +++++ 4 files changed, 56 insertions(+), 10 deletions(-) create mode 100644 html/changelogs/geeves-readd_flb.yml diff --git a/code/modules/client/preference_setup/loadout/loadout_head.dm b/code/modules/client/preference_setup/loadout/loadout_head.dm index b08c6b00a99..ff21efa5e23 100644 --- a/code/modules/client/preference_setup/loadout/loadout_head.dm +++ b/code/modules/client/preference_setup/loadout/loadout_head.dm @@ -4,6 +4,10 @@ slot = slot_head sort_category = "Hats and Headwear" +/datum/gear/head/New() + ..() + gear_tweaks += list(gear_tweak_hair_block) + /datum/gear/head/ushanka_grey display_name = "ushanka, grey" path = /obj/item/clothing/head/ushanka/grey @@ -344,3 +348,29 @@ display_name = "dominian consular cap" path = /obj/item/clothing/head/dominia allowed_roles = list("Consular Officer") + + +/* + Block Hair Adjustment +*/ +var/datum/gear_tweak/hair_block/gear_tweak_hair_block = new() + +/datum/gear_tweak/hair_block/get_contents(var/metadata) + return "Blocks Hair: [metadata]" + +/datum/gear_tweak/hair_block/get_default() + return "Default" + +/datum/gear_tweak/hair_block/get_metadata(var/user, var/metadata) + return input(user, "Choose whether you want your headgear to block hair, or use the headgear's default.", "Hair Blocking", metadata) as anything in list("Yes", "No", "Default") + +/datum/gear_tweak/hair_block/tweak_item(var/obj/item/clothing/head/H, var/metadata) + if(!istype(H)) + return + if(!H.allow_hair_covering) + return + switch(metadata) + if("Yes") + H.flags_inv |= BLOCKHEADHAIR + if("No") + H.flags_inv &= ~BLOCKHEADHAIR diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index a2a544ffa5a..11f90e3a2a4 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -492,11 +492,29 @@ drop_sound = 'sound/items/drop/hat.ogg' pickup_sound = 'sound/items/pickup/hat.ogg' + var/allow_hair_covering = TRUE //in case if you want to allow someone to switch the BLOCKHEADHAIR var from the helmet or not + var/light_overlay = "helmet_light" var/light_applied var/brightness_on var/on = 0 +/obj/item/clothing/head/Initialize(mapload, material_key) + . = ..() + if(allow_hair_covering) + verbs += /obj/item/clothing/head/proc/toggle_block_hair + +/obj/item/clothing/head/proc/toggle_block_hair() + set name = "Toggle Hair Coverage" + set category = "Object" + + if(allow_hair_covering) + flags_inv ^= BLOCKHEADHAIR + to_chat(usr, SPAN_NOTICE("[src] will now [flags_inv & BLOCKHEADHAIR ? "hide" : "show"] hair.")) + if(ishuman(usr)) + var/mob/living/carbon/human/H = usr + H.update_hair() + /obj/item/clothing/head/get_image_key_mod() return on diff --git a/code/modules/clothing/head/helmet.dm b/code/modules/clothing/head/helmet.dm index 4476576fce9..db72a9c8b6f 100644 --- a/code/modules/clothing/head/helmet.dm +++ b/code/modules/clothing/head/helmet.dm @@ -22,7 +22,6 @@ siemens_coefficient = 0.5 w_class = ITEMSIZE_NORMAL var/obj/machinery/camera/camera - var/allow_hair_covering = TRUE //in case if you want to allow someone to switch the BLOCKHEADHAIR var from the helmet or not drop_sound = 'sound/items/drop/helm.ogg' pickup_sound = 'sound/items/pickup/helm.ogg' @@ -53,14 +52,6 @@ to_chat(user, FONT_SMALL(SPAN_NOTICE("To toggle the helmet camera, right click the helmet and press Toggle Helmet Camera."))) to_chat(user, "This helmet has a built-in camera. It's [!ispath(camera) && camera.status ? "" : "in"]active.") -/obj/item/clothing/head/helmet/verb/toggle_block_hair() - set name = "Toggle Helmet Hair Coverage" - set category = "Object" - - if(allow_hair_covering) - flags_inv ^= BLOCKHEADHAIR - to_chat(usr, "[src] will now [flags_inv & BLOCKHEADHAIR ? "hide" : "show"] hair.") - /obj/item/clothing/head/helmet/hos name = "head of security helmet" desc = "A special Internal Security Division helmet designed to protect the precious craniums of important installation security officers." @@ -422,4 +413,4 @@ brightness_on = 6 light_wedge = LIGHT_WIDE camera = /obj/machinery/camera/network/tcfl - on = 0 \ No newline at end of file + on = 0 diff --git a/html/changelogs/geeves-readd_flb.yml b/html/changelogs/geeves-readd_flb.yml new file mode 100644 index 00000000000..a12244f00af --- /dev/null +++ b/html/changelogs/geeves-readd_flb.yml @@ -0,0 +1,7 @@ +author: Geeves + +delete-after: True + +changes: + - rscadd: "Toggling whether headgear blocks hair has been moved from helmets to root level headgear, meaning any headwear can be made to toggle hair or not. Additionally, loadout headgear can now be set to block hair or not, so you don't have to do it each round." + - rscadd: "Toggling headgear's hair coverage now instantly updates your hair icon." \ No newline at end of file