Skip to content

Commit

Permalink
[Modular] Adds a action button that lets you toggle if a mask hides y…
Browse files Browse the repository at this point in the history
…our face (and flavortext) (#1491) (#2527)

* Face Revel

* check if mask hides face

* Apply suggestions from code review



* Things Broke but pushing anyways

* Action button

* Remove Verb

The action button functions for the verb, and this doesnt even work

* Only add actions to masks that dont have them

this should only affect welding masks which already have a action to not hide your face

* woops

* fix docs

* Apply suggestions from code review



* File movements

* woops i accidentially undid the reviews

---------

Co-authored-by: SomeRandomOwl <[email protected]>
Co-authored-by: Bloop <[email protected]>
  • Loading branch information
3 people authored Mar 24, 2024
1 parent bdd57ea commit fdc0447
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
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

0 comments on commit fdc0447

Please sign in to comment.