Skip to content

Commit

Permalink
[MODULAR] Fixes an oversight with paper masks + adds action button (#…
Browse files Browse the repository at this point in the history
…24326)

* Fixes an oversight with paper masks + adds action button

* Makes action button have a right click and a left click

* Adds ability to hide strap

* Hideable strap + cleaning up the crap
  • Loading branch information
vinylspiders authored and Iajret committed Oct 15, 2023
1 parent 3ab93db commit 675ff6a
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 16 deletions.
Binary file modified modular_skyrat/master_files/icons/mob/clothing/mask.dmi
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
to_chat(user, "You pull the balaclava up to cover your whole head.")
open = 0
user.update_body_parts()
user.update_inv_ears(0)
user.update_inv_ears()
user.update_worn_mask() //Updates mob icons

/obj/item/clothing/mask/balaclavaadjust/attack_self(mob/user)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/datum/action/item_action/adjust/papermask
name = "Adjust paper mask"
desc = "LMB: Change mask face. RMB: Adjust mask."

/datum/action/item_action/adjust/papermask/Trigger(trigger_flags)
. = ..()
if(!.)
return
var/obj/item/clothing/mask/paper/paper_mask = target
if(trigger_flags & TRIGGER_SECONDARY_ACTION)
paper_mask.adjust_mask(usr)
else
paper_mask.reskin_obj(usr)

/obj/item/clothing/mask/paper
name = "paper mask"
desc = "It's true. Once you wear a mask for so long, you forget about who you are. Wonder if that happens with shitty paper ones."
Expand All @@ -7,8 +21,7 @@
clothing_flags = MASKINTERNALS
flags_inv = HIDEFACIALHAIR|HIDESNOUT
w_class = WEIGHT_CLASS_SMALL
/// Whether or not the mask is currently being layered over (or under!) hair.
var/wear_over_hair = TRUE
actions_types = list(/datum/action/item_action/adjust/papermask)
unique_reskin = list(
"Blank" = "mask_paper",
"Neutral" = "mask_neutral",
Expand Down Expand Up @@ -37,40 +50,85 @@
"Sad" = "mask_sad",
)

/// Whether or not the mask is currently being layered over (or under!) hair. FALSE/null means the mask is layered over the hair (this is how it starts off).
var/wear_hair_over
/// Whether or not the strap is currently hidden or visible
var/strap_hidden

/obj/item/clothing/mask/paper/Initialize(mapload)
. = ..()
register_context()
if(wear_over_hair)
if(wear_hair_over)
alternate_worn_layer = BACK_LAYER

/obj/item/clothing/mask/paper/worn_overlays(mutable_appearance/standing, isinhands, icon_file)
. = ..()
if(!strap_hidden)
. += mutable_appearance(icon_file, "mask_paper_strap")

/obj/item/clothing/mask/paper/alt_click_secondary(mob/user)
. = ..()
if(.)
return
if(user.can_perform_action(src, NEED_DEXTERITY))
adjust_mask(user)

/obj/item/clothing/mask/paper/CtrlClick(mob/user)
. = ..()
if(.)
return
if(user.can_perform_action(src, NEED_DEXTERITY))
adjust_strap(user)

/obj/item/clothing/mask/paper/add_context(atom/source, list/context, obj/item/held_item, mob/user)
. = ..()
context[SCREENTIP_CONTEXT_ALT_LMB] = "Change Mask Face"
context[SCREENTIP_CONTEXT_ALT_RMB] = "Adjust Mask"
context[SCREENTIP_CONTEXT_CTRL_LMB] = "Hide/Show Strap"
return CONTEXTUAL_SCREENTIP_SET

/obj/item/clothing/mask/paper/reskin_obj(mob/user)
if(!user.is_holding_item_of_type(/obj/item/pen))
balloon_alert(user, "must be holding a pen!")
return

. = ..()
user.update_worn_mask()

var/mob/living/carbon/carbon_user
if(iscarbon(user))
carbon_user = user
if(carbon_user.wear_mask == src)
carbon_user.update_worn_mask()

current_skin = null //so we can infinitely reskin

/obj/item/clothing/mask/paper/proc/adjust_mask(mob/living/carbon/human/user)
if(!istype(user))
return
if(!user.incapacitated())
wear_over_hair = !wear_over_hair
if(wear_over_hair)
var/is_worn = user.wear_mask == src
wear_hair_over = !wear_hair_over
if(wear_hair_over)
alternate_worn_layer = BACK_LAYER
to_chat(user, "You sweep your hair over the mask.")
to_chat(user, "You [is_worn ? "" : "will "]sweep your hair over the mask.")
else
alternate_worn_layer = initial(alternate_worn_layer)
to_chat(user, "You sweep your hair under the mask.")
to_chat(user, "You [is_worn ? "" : "will "]sweep your hair under the mask.")

user.update_worn_mask()

/obj/item/clothing/mask/paper/proc/adjust_strap(mob/living/carbon/human/user)
if(!istype(user))
return
if(!user.incapacitated())
var/is_worn = user.wear_mask == src
strap_hidden = !strap_hidden
to_chat(user, "You [is_worn ? "" : "will "][strap_hidden ? "hide" : "show"] the mask strap.")

user.update_body_parts()
user.update_inv_ears(0)
user.update_worn_mask()

/obj/item/clothing/mask/paper/verb/toggle()
set category = "Object"
set name = "Adjust Mask"
set src in usr
adjust_mask(usr)
// Because alternate_worn_layer can potentially get reset on unequipping the mask (ex: for 'Top' snouts), let's make sure we don't lose it our settings
/obj/item/clothing/mask/paper/dropped(mob/living/carbon/human/user)
var/prev_alternate_worn_layer = alternate_worn_layer
. = ..()
alternate_worn_layer = prev_alternate_worn_layer

0 comments on commit 675ff6a

Please sign in to comment.