Put clothing on people by clicking on them with clothing inhand + targeting correct area. (#69560)

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
This commit is contained in:
itseasytosee
2022-10-08 18:51:29 -07:00
committed by GitHub
co-authored by Mothblocks
parent cc1d242273
commit e0b706c36c
8 changed files with 129 additions and 33 deletions
+60
View File
@@ -1486,3 +1486,63 @@ GLOBAL_DATUM_INIT(welding_sparks, /mutable_appearance, mutable_appearance('icons
*/
/obj/item/proc/get_writing_implement_details()
return null
/**
* When called on an item, and given a body targeting zone, this will return TRUE if the item slot matches the target zone, and FALSE otherwise.
* Currently supports the jumpsuit, outersuit, backpack, belt, gloves, hat, ears, neck, mask, eyes, and feet slots. All other slots will auto return FALSE.
*/
/obj/item/proc/compare_zone_to_item_slot(zone)
switch(slot_flags)
if(ITEM_SLOT_ICLOTHING, ITEM_SLOT_OCLOTHING, ITEM_SLOT_BACK)
return (zone == BODY_ZONE_CHEST)
if(ITEM_SLOT_BELT)
return (zone == BODY_ZONE_PRECISE_GROIN)
if(ITEM_SLOT_GLOVES)
return (zone == BODY_ZONE_R_ARM || zone == BODY_ZONE_L_ARM)
if(ITEM_SLOT_HEAD, ITEM_SLOT_EARS, ITEM_SLOT_NECK)
return (zone == BODY_ZONE_HEAD)
if(ITEM_SLOT_MASK)
return (zone == BODY_ZONE_PRECISE_MOUTH)
if(ITEM_SLOT_EYES)
return (zone == BODY_ZONE_PRECISE_EYES)
if(ITEM_SLOT_FEET)
return (zone == BODY_ZONE_L_LEG || zone == BODY_ZONE_R_LEG)
return FALSE
/**
* This proc calls at the begining of anytime an item is being equiped to a target by another mob.
* It handles initial messages, AFK stripping, and initial logging.
*/
/obj/item/proc/item_start_equip(atom/target, obj/item/equipping, mob/user, warn_dangerous = TRUE)
if(warn_dangerous && isclothing(equipping))
var/obj/item/clothing/clothing = equipping
if(clothing.clothing_flags & DANGEROUS_OBJECT)
target.visible_message(
span_danger("[user] tries to put [equipping] on [target]."),
span_userdanger("[user] tries to put [equipping] on you."),
ignored_mobs = user,
)
else
target.visible_message(
span_notice("[user] tries to put [equipping] on [target]."),
span_notice("[user] tries to put [equipping] on you."),
ignored_mobs = user,
)
if(ishuman(target))
var/mob/living/carbon/human/victim_human = target
if(victim_human.key && !victim_human.client) // AKA braindead
if(victim_human.stat <= SOFT_CRIT && LAZYLEN(victim_human.afk_thefts) <= AFK_THEFT_MAX_MESSAGES)
var/list/new_entry = list(list(user.name, "tried equipping you with [equipping]", world.time))
LAZYADD(victim_human.afk_thefts, new_entry)
else if(victim_human.is_blind())
to_chat(target, span_userdanger("You feel someone trying to put something on you."))
user.do_item_attack_animation(target, used_item = equipping)
to_chat(user, span_notice("You try to put [equipping] on [target]..."))
user.log_message("is putting [equipping] on [key_name(target)]", LOG_ATTACK, color="red")
target.log_message("is having [equipping] put on them by [key_name(user)]", LOG_VICTIM, color="orange", log_globally=FALSE)
@@ -26,6 +26,7 @@
/obj/item/storage/backpack/Initialize(mapload)
. = ..()
create_storage(max_slots = 21, max_total_storage = 21)
AddElement(/datum/element/attack_equip)
/*
* Backpack Types
+1
View File
@@ -28,6 +28,7 @@
/obj/item/storage/belt/Initialize(mapload)
. = ..()
AddElement(/datum/element/attack_equip)
update_appearance()
/obj/item/storage/belt/utility