Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIRROR] [Modular] Adds a action button that lets you toggle if a mask hides your face (and flavortext) #2527

Merged
merged 1 commit into from
Mar 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions code/datums/actions/items/toggles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions modular_nova/master_files/code/datums/items/toggles.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/datum/action/item_action/toggle_hide_face
name = "Toggle Face Hiding"
45 changes: 45 additions & 0 deletions modular_nova/master_files/code/modules/clothing/masks/_masks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 1 addition & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading