Elevates (almost all) inventory variables from /carbon to /human (#96955)

## About The Pull Request

Moves all inventory slots but handcuffs/legcuffs (as those can be used
by xenos) from ``/carbon`` onto ``/human``, as xenos do not use any of
those inventory slots, only leaving them in use by humans. Their
presence on ``/carbon`` is an artifact of times when monkeys weren't
humans, and some of the slots had to be shared by all carbons.
In some places I've used ``get_item_by_slot`` rather than swapping
checks to ``ishuman`` for simplicity's sake, in some places it might not
be the most optimal solution but in cases like help act any other
solution would require a refactor of the whole (massive) proc.

## Why It's Good For The Game

Cleaner/more sensible code, one step closer to fully datumized
inventories.

## Changelog
🆑
refactor: Moved a lot of human-specific inventory code onto human mobs,
report if inventories break!
/🆑
This commit is contained in:
SmArtKar
2026-07-16 03:03:50 -07:00
committed by GitHub
parent 156beffc62
commit 677f070995
43 changed files with 288 additions and 412 deletions
+8 -9
View File
@@ -305,11 +305,10 @@ CIGARETTE PACKETS ARE IN FANCY.DM
/obj/item/cigarette/dropped(mob/dropee)
. = ..()
// Moving the cigarette from mask to hands (or pocket I guess) will emit a larger puff of smoke
if(!QDELETED(src) && !QDELETED(dropee) && how_long_have_we_been_smokin >= 4 SECONDS && iscarbon(dropee) && iscarbon(loc))
var/mob/living/carbon/smoker = dropee
if(!QDELETED(src) && !QDELETED(dropee) && how_long_have_we_been_smokin >= 4 SECONDS && dropee == loc && iscarbon(dropee))
// This relies on the fact that dropped is called before slot is nulled
if(src == smoker.wear_mask && !smoker.incapacitated)
long_exhale(smoker)
if(dropee.get_item_by_slot(ITEM_SLOT_MASK) == src && !dropee.incapacitated)
long_exhale(dropee)
UnregisterSignal(dropee, list(COMSIG_HUMAN_FORCESAY, COMSIG_ATOM_DIR_CHANGE))
QDEL_NULL(mob_smoke)
@@ -373,9 +372,9 @@ CIGARETTE PACKETS ARE IN FANCY.DM
var/datum/gas_mixture/air = return_air()
if (!isnull(air) && air.has_gas(/datum/gas/oxygen, 1))
return TRUE
if (!iscarbon(user))
if (!ishuman(user))
return FALSE
var/mob/living/carbon/the_smoker = user
var/mob/living/carbon/human/the_smoker = user
return the_smoker.can_breathe_helmet()
/obj/item/cigarette/interact_with_atom(atom/interacting_with, mob/living/user, list/modifiers)
@@ -466,7 +465,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
if(iscarbon(loc))
var/mob/living/carbon/smoker = loc
if(src == smoker.wear_mask)
if(smoker.get_item_by_slot(ITEM_SLOT_MASK) == src)
make_mob_smoke(smoker)
/obj/item/cigarette/extinguish()
@@ -563,7 +562,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
reagents.remove_all(to_smoke)
return
else
if(src != smoker.wear_mask)
if(smoker.get_item_by_slot(ITEM_SLOT_MASK) != src)
reagents.remove_all(to_smoke)
return
@@ -1181,7 +1180,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
return
var/mob/living/carbon/vaper = loc
if(!iscarbon(vaper) || src != vaper.wear_mask)
if(!iscarbon(vaper) || vaper.get_item_by_slot(ITEM_SLOT_MASK) != src)
reagents.remove_all(REAGENTS_METABOLISM)
return
@@ -237,7 +237,7 @@
//Intensity of the laser dot to pass to flash_act
var/severity = pick(0, 1, 2)
var/always_fail = FALSE
if(istype(target_humanoid.glasses, /obj/item/clothing/glasses/eyepatch) && prob(50))
if(istype(target_humanoid.get_item_by_slot(ITEM_SLOT_EYES), /obj/item/clothing/glasses/eyepatch) && prob(50))
always_fail = TRUE
//chance to actually hit the eyes depends on internal component
@@ -33,11 +33,9 @@
//ATTACK HAND IGNORING PARENT RETURN VALUE
/obj/item/electropack/attack_hand(mob/user, list/modifiers)
if(iscarbon(user))
var/mob/living/carbon/C = user
if(src == C.back)
to_chat(user, span_warning("You need help taking this off!"))
return
if(user.get_item_by_slot(ITEM_SLOT_BACK) == src)
to_chat(user, span_warning("You need help taking this off!"))
return
return ..()
/obj/item/electropack/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
@@ -33,7 +33,7 @@
uses--
carbon_imp_in.uncuff()
var/obj/item/clothing/shoes/shoes = carbon_imp_in.shoes
var/obj/item/clothing/shoes/shoes = carbon_imp_in.get_item_by_slot(ITEM_SLOT_FEET)
if(istype(shoes) && shoes.tied == SHOES_KNOTTED)
shoes.adjust_laces(SHOES_TIED, carbon_imp_in)
@@ -45,7 +45,7 @@
if(implanted_in.handcuffed || implanted_in.legcuffed)
return TRUE
var/obj/item/clothing/shoes/shoes = implanted_in.shoes
var/obj/item/clothing/shoes/shoes = implanted_in.get_item_by_slot(ITEM_SLOT_FEET)
if(istype(shoes) && shoes.tied == SHOES_KNOTTED)
return TRUE
@@ -192,10 +192,8 @@
if(!HAS_TRAIT(src, TRAIT_WIELDED))
return ""
var/in_mouth = ""
if(iscarbon(user))
var/mob/living/carbon/C = user
if(C.wear_mask)
in_mouth = ", barely missing [user.p_their()] nose"
if(iscarbon(user) && user.get_item_by_slot(ITEM_SLOT_MASK))
in_mouth = ", barely missing [user.p_their()] nose"
. = span_rose("[user] swings [user.p_their()] [name][in_mouth]. [user.p_They()] light[user.p_s()] [A.loc == user ? "[user.p_their()] [A.name]" : A] in the process.")
playsound(loc, hitsound, get_clamped_volume(), TRUE, -1)
add_fingerprint(user)
@@ -87,10 +87,8 @@
return ""
var/in_mouth = ""
if(iscarbon(user))
var/mob/living/carbon/carbon_user = user
if(carbon_user.wear_mask)
in_mouth = ", barely missing [carbon_user.p_their()] nose"
if(ishuman(user) && user.get_item_by_slot(ITEM_SLOT_MASK))
in_mouth = ", barely missing [user.p_their()] nose"
. = span_rose("[user] swings [user.p_their()] [name][in_mouth]. [user.p_They()] light[user.p_s()] [user.p_their()] [atom.name] in the process.")
playsound(loc, hitsound, get_clamped_volume(), TRUE, -1)
add_fingerprint(user)
@@ -162,10 +162,9 @@
if(tt.target_zone != BODY_ZONE_HEAD)
return
if(iscarbon(hit_atom))
var/mob/living/carbon/H = hit_atom
if(!H.wear_mask)
H.equip_to_slot_if_possible(src, ITEM_SLOT_MASK)
H.visible_message(span_warning("The plunger slams into [H]'s face!"), span_warning("The plunger suctions to your face!"))
var/mob/living/carbon/victim = hit_atom
if(victim.equip_to_slot_if_possible(src, ITEM_SLOT_MASK, disable_warning = TRUE))
victim.visible_message(span_warning("The plunger slams into [victim]'s face!"), span_warning("The plunger suctions to your face!"))
/obj/item/plunger/attack_self(mob/user)
. = ..()