Adds clothing traits (#18804)

* clothes

* zap

* Makes boxing gloves use the new system

---------

Co-authored-by: Cameron Lennox <killer65311@gmail.com>
This commit is contained in:
Guti
2025-11-21 06:38:43 -05:00
committed by GitHub
co-authored by Cameron Lennox
parent d5ebd3dbda
commit 29eaa9948e
6 changed files with 38 additions and 22 deletions
+28
View File
@@ -10,6 +10,9 @@
var/list/restricted_accessory_slots
var/list/starting_accessories
/// Trait modification, lazylist of traits to add/take away, on equipment/drop in the correct slot
var/list/clothing_traits
var/flash_protection = FLASH_PROTECTION_NONE
var/tint = TINT_NONE
var/list/enables_planes //Enables these planes in the wearing mob's plane_holder
@@ -54,11 +57,16 @@
..()
if(enables_planes)
user.recalculate_vis()
if(("[slot]" in slot_flags_enumeration) && (slot_flags & slot_flags_enumeration["[slot]"]))
for(var/trait in clothing_traits)
ADD_CLOTHING_TRAIT(user, trait)
/obj/item/clothing/dropped(mob/user)
..()
if(enables_planes)
user.recalculate_vis()
for(var/trait in clothing_traits)
REMOVE_CLOTHING_TRAIT(user, trait)
//BS12: Species-restricted clothing check.
/obj/item/clothing/mob_can_equip(M as mob, slot, disable_warning = FALSE)
@@ -1415,3 +1423,23 @@
/obj/item/clothing/under/equipped(var/mob/user, var/slot)
. = ..()
handle_digitigrade(user)
/obj/item/clothing/proc/attach_clothing_traits(trait_or_traits)
if(!islist(trait_or_traits))
trait_or_traits = list(trait_or_traits)
LAZYOR(clothing_traits, trait_or_traits)
var/mob/wearer = loc
if(istype(wearer) && (wearer.get_inventory_slot(src) & slot_flags))
for(var/new_trait in trait_or_traits)
ADD_CLOTHING_TRAIT(wearer, new_trait)
/obj/item/clothing/proc/detach_clothing_traits(trait_or_traits)
if(!islist(trait_or_traits))
trait_or_traits = list(trait_or_traits)
LAZYREMOVE(clothing_traits, trait_or_traits)
var/mob/wearer = loc
if(istype(wearer))
for(var/new_trait in trait_or_traits)
REMOVE_CLOTHING_TRAIT(wearer, new_trait)
+1 -21
View File
@@ -3,27 +3,7 @@
desc = "Because you really needed another excuse to punch your crewmates."
icon_state = "boxing"
item_state_slots = list(slot_r_hand_str = "red", slot_l_hand_str = "red")
/obj/item/clothing/gloves/boxing/equipped(mob/user, slot)
. = ..()
if(user)
if(slot && slot == slot_gloves)
ADD_TRAIT(user, TRAIT_NONLETHAL_BLOWS, CLOTHING_TRAIT)
return
if(HAS_TRAIT_FROM(user, TRAIT_NONLETHAL_BLOWS, CLOTHING_TRAIT))
REMOVE_TRAIT(user, TRAIT_NONLETHAL_BLOWS, CLOTHING_TRAIT)
/obj/item/clothing/gloves/boxing/dropped(mob/user)
. = ..()
if(HAS_TRAIT_FROM(user, TRAIT_NONLETHAL_BLOWS, CLOTHING_TRAIT))
REMOVE_TRAIT(user, TRAIT_NONLETHAL_BLOWS, CLOTHING_TRAIT)
/*
/obj/item/clothing/gloves/boxing/attackby(obj/item/W, mob/user)
if(W.has_tool_quality(TOOL_WIRECUTTER) || istype(W, /obj/item/surgical/scalpel))
to_chat(user, span_notice("That won't work.")) //Nope
return
..()
*/
clothing_traits = list(TRAIT_NONLETHAL_BLOWS)
/obj/item/clothing/gloves/boxing/green
icon_state = "boxinggreen"
+1 -1
View File
@@ -226,7 +226,7 @@
var/mob/living/L = A
if(SEND_SIGNAL(L, COMSIG_CHECK_FOR_GODMODE) & COMSIG_GODMODE_CANCEL)
continue
if(dist <= zap_range && (dist < closest_dist || !closest_mob) && L.stat != DEAD)
if(dist <= zap_range && (dist < closest_dist || !closest_mob) && L.stat != DEAD && !HAS_TRAIT(L, TRAIT_TESLA_SHOCKIMMUNE))
closest_mob = L
closest_atom = A
closest_dist = dist