diff --git a/code/datums/actions/items/toggles.dm b/code/datums/actions/items/toggles.dm index 508c6e8639b..80d9e03cb5e 100644 --- a/code/datums/actions/items/toggles.dm +++ b/code/datums/actions/items/toggles.dm @@ -118,3 +118,7 @@ /datum/action/item_action/call_link name = "Call MODlink" +// NOVA EDIT ADDITION START +/datum/action/item_action/toggle_hide_face + name = "Toggle Face Hiding" +// NOVA EDIT ADDITION END diff --git a/modular_nova/master_files/code/datums/items/toggles.dm b/modular_nova/master_files/code/datums/items/toggles.dm new file mode 100644 index 00000000000..208a8d28a92 --- /dev/null +++ b/modular_nova/master_files/code/datums/items/toggles.dm @@ -0,0 +1,2 @@ +/datum/action/item_action/toggle_hide_face + name = "Toggle Face Hiding" diff --git a/modular_nova/master_files/code/modules/clothing/masks/_masks.dm b/modular_nova/master_files/code/modules/clothing/masks/_masks.dm index 8d29816c4fd..d4bd4985078 100644 --- a/modular_nova/master_files/code/modules/clothing/masks/_masks.dm +++ b/modular_nova/master_files/code/modules/clothing/masks/_masks.dm @@ -18,3 +18,48 @@ /obj/item/clothing/mask/dropped(mob/living/carbon/human/user) . = ..() alternate_worn_layer = initial(alternate_worn_layer) + +/obj/item/clothing/mask + var/item_face_toggled + +/obj/item/clothing/mask/Initialize(mapload) + if (src.flags_inv && (src.flags_inv & HIDEFACE)) + if (!islist(actions_types)) + actions_types = list(/datum/action/item_action/toggle_hide_face) + + return ..() + +/datum/action/item_action/toggle_hide_face/Trigger(trigger_flags) + . = ..() + if(!.) + return + var/obj/item/clothing/mask/target_mask = target + target_mask.toggle_hide_face(usr) + +/** + * Toggles the HIDEFACE flag on the user's mask. + * + * @param user The user to toggle the mask for. + * @param force Whether to force the mask to be toggled. + * @return TRUE if the mask was toggled, FALSE otherwise. + */ +/obj/item/clothing/mask/proc/toggle_hide_face(mob/living/carbon/user, force = FALSE) + if(!user.wear_mask && !force) + return FALSE + + if(src.flags_inv & HIDEFACE) + src.flags_inv &= ~HIDEFACE + to_chat(user, "You've revealed your face!") + item_face_toggled = TRUE + else + src.flags_inv |= HIDEFACE + if (!force) + to_chat(user, "You've hidden your face!") + item_face_toggled = FALSE + + return TRUE + +/obj/item/clothing/mask/dropped(mob/living/user) + . = ..() + if(item_face_toggled) + toggle_hide_face(user, force = TRUE) diff --git a/tgstation.dme b/tgstation.dme index 532d2117a28..40bb1f38c67 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -6266,6 +6266,7 @@ #include "modular_nova\master_files\code\datums\id_trim\jobs.dm" #include "modular_nova\master_files\code\datums\id_trim\solfed.dm" #include "modular_nova\master_files\code\datums\id_trim\syndicate.dm" +#include "modular_nova\master_files\code\datums\items\toggles.dm" #include "modular_nova\master_files\code\datums\keybinding\mob.dm" #include "modular_nova\master_files\code\datums\mind\_mind.dm" #include "modular_nova\master_files\code\datums\mood_events\drink_events.dm"