Refactors ITEM_SLOT_BACKPACK and ITEM_SLOT_BELTPACK out of inventory code (#90869)

<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request

So yesterday I've spotted that we had wrong SLOTS_AMT value set, and
went a bit down a rabbit hole and found how abhorrent our
ITEM_SLOT_BACKPACK and ITEM_SLOT_BELTPACK usage is. They're not real
inventory slots, but just "hints" at items being located in backpacks or
belts, or instructions to put an item into a belt/backpack. This PR
rewrites all usages of them as "hints", and adds an equip_to_storage
proc used to equip an item into a storage positioned in a certain slot,
so ``equip_to_slot_if_possible(item, ITEM_SLOT_BACKPACK)`` is now
``equip_to_storage(item, ITEM_SLOT_BACK)``

## Why It's Good For The Game

Its really stupid and we shouldn't have those as slot flags,
ITEM_SLOT_HANDS at least makes sense but those two are just absurd.
Should make equipping things into non-backpack storage a bit easier too,
in case we end up going through with the idea of suit/uniform pockets
being a major part of player inventory.

## Changelog

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Be sure to properly
mark your PRs to prevent unnecessary GBP loss. You can read up on GBP
and its effects on PRs in the tgstation guides for contributors. Please
note that maintainers freely reserve the right to remove and add tags
should they deem it appropriate. You can attempt to finagle the system
all you want, but it's best to shoot for clear communication right off
the bat. -->

🆑
refactor: Refactored how backpack and belt contents are handled in mob
inventory code, report any issues with lingering item effects or
inability to equip things into them!
/🆑

<!-- Both 🆑's are required for the changelog to work! You can put
your name to the right of the first 🆑 if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->
This commit is contained in:
SmArtKar
2025-05-15 02:07:41 +02:00
committed by Roxy
parent 39694ec642
commit 0f01987115
50 changed files with 233 additions and 237 deletions

View File

@@ -66,13 +66,6 @@
#define COMSIG_CARBON_GAIN_ORGAN "carbon_gain_organ"
///from /item/organ/proc/Remove() (/obj/item/organ/)
#define COMSIG_CARBON_LOSE_ORGAN "carbon_lose_organ"
///from /mob/living/carbon/doUnEquip(obj/item/I, force, newloc, no_move, invdrop, silent)
#define COMSIG_CARBON_EQUIP_HAT "carbon_equip_hat"
///from /mob/living/carbon/doUnEquip(obj/item/I, force, newloc, no_move, invdrop, silent)
#define COMSIG_CARBON_UNEQUIP_HAT "carbon_unequip_hat"
///from /mob/living/carbon/doUnEquip(obj/item/I, force, newloc, no_move, invdrop, silent)
#define COMSIG_CARBON_UNEQUIP_SHOECOVER "carbon_unequip_shoecover"
#define COMSIG_CARBON_EQUIP_SHOECOVER "carbon_equip_shoecover"
///Called when someone attempts to cuff a carbon
#define COMSIG_CARBON_CUFF_ATTEMPTED "carbon_attempt_cuff"
#define COMSIG_CARBON_CUFF_PREVENT (1<<0)

View File

@@ -51,23 +51,19 @@
#define ITEM_SLOT_NECK (1<<12)
/// A character's hand slots
#define ITEM_SLOT_HANDS (1<<13)
/// Inside of a character's backpack
#define ITEM_SLOT_BACKPACK (1<<14)
/// Suit Storage slot
#define ITEM_SLOT_SUITSTORE (1<<15)
#define ITEM_SLOT_SUITSTORE (1<<14)
/// Left Pocket slot
#define ITEM_SLOT_LPOCKET (1<<16)
#define ITEM_SLOT_LPOCKET (1<<15)
/// Right Pocket slot
#define ITEM_SLOT_RPOCKET (1<<17)
#define ITEM_SLOT_RPOCKET (1<<16)
/// Handcuff slot
#define ITEM_SLOT_HANDCUFFED (1<<18)
#define ITEM_SLOT_HANDCUFFED (1<<17)
/// Legcuff slot (bolas, beartraps)
#define ITEM_SLOT_LEGCUFFED (1<<19)
/// Inside of a character's BELT.........
#define ITEM_SLOT_BELTPACK (1<<20)
#define ITEM_SLOT_LEGCUFFED (1<<18)
/// Total amount of slots
#define SLOTS_AMT 20 // Keep this up to date!
#define SLOTS_AMT 19 // Keep this up to date!
///Inventory slots that can be blacklisted by a species from being equipped into
DEFINE_BITFIELD(no_equip_flags, list(
@@ -350,21 +346,22 @@ GLOBAL_LIST_INIT(tool_items, list(
/obj/item/spess_knife,
))
/// String for items placed into the left pocket.
// Keys for equip_in_one_of_slots, if you add new ones update the assoc lists in equip_in_one_of_slots
/// Items placed into the left pocket.
#define LOCATION_LPOCKET "in your left pocket"
/// String for items placed into the right pocket
/// Items placed into the right pocket
#define LOCATION_RPOCKET "in your right pocket"
/// String for items placed into the backpack.
/// Items placed into the backpack.
#define LOCATION_BACKPACK "in your backpack"
/// String for items placed into the hands.
/// Items placed into the hands.
#define LOCATION_HANDS "in your hands"
/// String for items placed in the glove slot.
/// Items placed in the glove slot.
#define LOCATION_GLOVES "on your hands"
/// String for items placed in the eye/glasses slot.
/// Items placed in the eye/glasses slot.
#define LOCATION_EYES "covering your eyes"
/// String for items placed on the head/hat slot.
/// Items placed on the head/hat slot.
#define LOCATION_HEAD "on your head"
/// String for items placed in the neck slot.
/// Items placed in the neck slot.
#define LOCATION_NECK "around your neck"
/// String for items placed in the id slot
/// Items placed in the id slot
#define LOCATION_ID "in your ID slot"

View File

@@ -769,10 +769,6 @@ GLOBAL_LIST_INIT(skin_tone_names, list(
slot_strings += "hand"
if(slot_flags & ITEM_SLOT_DEX_STORAGE)
slot_strings += "dextrous storage"
if(slot_flags & ITEM_SLOT_BACKPACK)
slot_strings += "backpack"
if(slot_flags & ITEM_SLOT_BELTPACK)
slot_strings += "belt" // ?
return slot_strings
///Returns the direction that the initiator and the target are facing

View File

@@ -853,10 +853,10 @@ SUBSYSTEM_DEF(job)
var/paper = new /obj/item/folder/biscuit/confidential/spare_id_safe_code()
var/list/slots = list(
LOCATION_LPOCKET = ITEM_SLOT_LPOCKET,
LOCATION_RPOCKET = ITEM_SLOT_RPOCKET,
LOCATION_BACKPACK = ITEM_SLOT_BACKPACK,
LOCATION_HANDS = ITEM_SLOT_HANDS
LOCATION_LPOCKET,
LOCATION_RPOCKET,
LOCATION_BACKPACK,
LOCATION_HANDS,
)
var/where = new_captain.equip_in_one_of_slots(paper, slots, FALSE, indirect_action = TRUE) || "at your feet"

View File

@@ -36,7 +36,7 @@
/datum/component/anti_magic/Initialize(
antimagic_flags = MAGIC_RESISTANCE,
charges = INFINITY,
inventory_flags = ~ITEM_SLOT_BACKPACK, // items in a backpack won't activate, anywhere else is fine
inventory_flags = ALL,
datum/callback/drain_antimagic,
datum/callback/expiration,
)

View File

@@ -289,8 +289,8 @@
RegisterSignal(parent, COMSIG_COMPONENT_CLEAN_ACT, PROC_REF(on_clean))
RegisterSignal(parent, COMSIG_STEP_ON_BLOOD, PROC_REF(on_step_blood))
RegisterSignal(parent, COMSIG_CARBON_UNEQUIP_SHOECOVER, PROC_REF(unequip_shoecover))
RegisterSignal(parent, COMSIG_CARBON_EQUIP_SHOECOVER, PROC_REF(equip_shoecover))
RegisterSignal(parent, COMSIG_MOB_EQUIPPED_ITEM, PROC_REF(unequip_shoecover))
RegisterSignal(parent, COMSIG_MOB_UNEQUIPPED_ITEM, PROC_REF(equip_shoecover))
/datum/component/bloodysoles/feet/update_icon()
if(!ishuman(wielder) || HAS_TRAIT(wielder, TRAIT_NO_BLOOD_OVERLAY))
@@ -321,16 +321,12 @@
return wielder.check_covered_slots() & ITEM_SLOT_FEET
/datum/component/bloodysoles/feet/on_moved(datum/source, OldLoc, Dir, Forced)
if(wielder.num_legs < 2)
return
..()
if(wielder.num_legs >= 2)
return ..()
/datum/component/bloodysoles/feet/on_step_blood(datum/source, obj/effect/decal/cleanable/pool)
if(wielder.num_legs < 2)
return
..()
if(wielder.num_legs >= 2)
return ..()
/datum/component/bloodysoles/feet/share_blood(obj/effect/decal/cleanable/pool)
. = ..()
@@ -340,14 +336,14 @@
bloody_feet.color = get_blood_dna_color(GET_ATOM_BLOOD_DNA(pool))
update_icon()
/datum/component/bloodysoles/feet/proc/unequip_shoecover(datum/source)
/datum/component/bloodysoles/feet/proc/equip_shoecover(datum/source, obj/item/item)
SIGNAL_HANDLER
if ((item.body_parts_covered & FEET) || (item.flags_inv & HIDESHOES))
update_icon()
update_icon()
/datum/component/bloodysoles/feet/proc/equip_shoecover(datum/source)
/datum/component/bloodysoles/feet/proc/unequip_shoecover(datum/source, obj/item/item)
SIGNAL_HANDLER
update_icon()
if ((item.body_parts_covered & FEET) || (item.flags_inv & HIDESHOES))
update_icon()
#undef BLOOD_PERCENT_LOSS_ON_STEP

View File

@@ -263,7 +263,7 @@
if(!isnum(number))//Default to 1
number = 1
for(var/i in 1 to number)
EQUIP_OUTFIT_ITEM(path, ITEM_SLOT_BACKPACK)
user.equip_to_storage(SSwardrobe.provide_type(path, user), ITEM_SLOT_BACK, indirect_action = TRUE, del_on_fail = TRUE)
if(belt_contents)
for(var/path in belt_contents)
@@ -271,7 +271,7 @@
if(!isnum(number))//Default to 1
number = 1
for(var/i in 1 to number)
EQUIP_OUTFIT_ITEM(path, ITEM_SLOT_BELTPACK)
user.equip_to_storage(SSwardrobe.provide_type(path, user), ITEM_SLOT_BELT, indirect_action = TRUE, del_on_fail = TRUE)
post_equip(user, visuals_only)

View File

@@ -217,7 +217,7 @@
* If no valid slot is available for an item, the item is left at the mob's feet.
* Arguments:
* * quirk_item - The item to give to the quirk holder. If the item is a path, the item will be spawned in first on the player's turf.
* * valid_slots - Assoc list of descriptive location strings to item slots that is fed into [/mob/living/carbon/proc/equip_in_one_of_slots]. list(LOCATION_BACKPACK = ITEM_SLOT_BACKPACK)
* * valid_slots - List of LOCATION_X that is fed into [/mob/living/carbon/proc/equip_in_one_of_slots].
* * flavour_text - Optional flavour text to append to the where_items_spawned string after the item's location.
* * default_location - If the item isn't possible to equip in a valid slot, this is a description of where the item was spawned.
* * notify_player - If TRUE, adds strings to where_items_spawned list to be output to the player in [/datum/quirk/item_quirk/post_add()]

View File

@@ -43,10 +43,10 @@
give_item_to_holder(
drug_instance,
list(
LOCATION_LPOCKET = ITEM_SLOT_LPOCKET,
LOCATION_RPOCKET = ITEM_SLOT_RPOCKET,
LOCATION_BACKPACK = ITEM_SLOT_BACKPACK,
LOCATION_HANDS = ITEM_SLOT_HANDS,
LOCATION_LPOCKET,
LOCATION_RPOCKET,
LOCATION_BACKPACK,
LOCATION_HANDS,
),
flavour_text = drug_flavour_text,
)
@@ -55,10 +55,10 @@
give_item_to_holder(
accessory_type,
list(
LOCATION_LPOCKET = ITEM_SLOT_LPOCKET,
LOCATION_RPOCKET = ITEM_SLOT_RPOCKET,
LOCATION_BACKPACK = ITEM_SLOT_BACKPACK,
LOCATION_HANDS = ITEM_SLOT_HANDS,
LOCATION_LPOCKET,
LOCATION_RPOCKET,
LOCATION_BACKPACK,
LOCATION_HANDS,
)
)

View File

@@ -39,7 +39,7 @@
var/mob/living/carbon/human/human_holder = quirk_holder
var/obj/item/clothing/accessory/dogtag/allergy/dogtag = new(get_turf(human_holder), allergy_string)
give_item_to_holder(dogtag, list(LOCATION_BACKPACK = ITEM_SLOT_BACKPACK, LOCATION_HANDS = ITEM_SLOT_HANDS), flavour_text = "Make sure medical staff can see this...")
give_item_to_holder(dogtag, list(LOCATION_BACKPACK, LOCATION_HANDS), flavour_text = "Make sure medical staff can see this...")
/datum/quirk/item_quirk/allergic/post_add()
quirk_holder.add_mob_memory(/datum/memory/key/quirk_allergy, allergy_string = allergy_string)

View File

@@ -18,7 +18,7 @@
var/obj/item/clothing/glasses/blindfold/white/blindfold = new
blindfold.add_atom_colour(client_source?.prefs.read_preference(/datum/preference/color/blindfold_color), FIXED_COLOUR_PRIORITY)
blindfold.colored_before = TRUE
give_item_to_holder(blindfold, list(LOCATION_EYES = ITEM_SLOT_EYES, LOCATION_BACKPACK = ITEM_SLOT_BACKPACK, LOCATION_HANDS = ITEM_SLOT_HANDS))
give_item_to_holder(blindfold, list(LOCATION_EYES, LOCATION_HANDS))
/datum/quirk/item_quirk/blindness/add(client/client_source)
quirk_holder.become_blind(QUIRK_TRAIT)

View File

@@ -20,10 +20,10 @@
give_item_to_holder(
/obj/item/storage/pill_bottle/mannitol/braintumor,
list(
LOCATION_LPOCKET = ITEM_SLOT_LPOCKET,
LOCATION_RPOCKET = ITEM_SLOT_RPOCKET,
LOCATION_BACKPACK = ITEM_SLOT_BACKPACK,
LOCATION_HANDS = ITEM_SLOT_HANDS,
LOCATION_LPOCKET,
LOCATION_RPOCKET,
LOCATION_BACKPACK,
LOCATION_HANDS,
),
flavour_text = "These will keep you alive until you can secure a supply of medication. Don't rely on them too much!",
)

View File

@@ -14,5 +14,5 @@
quirk_holder.ForceContractDisease(hms)
/datum/quirk/item_quirk/chronic_illness/add_unique(client/client_source)
give_item_to_holder(/obj/item/storage/pill_bottle/sansufentanyl, list(LOCATION_BACKPACK = ITEM_SLOT_BACKPACK),flavour_text = "You've been provided with medication to help manage your condition. Take it regularly to avoid complications.")
give_item_to_holder(/obj/item/healthanalyzer/simple/disease, list(LOCATION_BACKPACK = ITEM_SLOT_BACKPACK))
give_item_to_holder(/obj/item/storage/pill_bottle/sansufentanyl, list(LOCATION_BACKPACK), flavour_text = "You've been provided with medication to help manage your condition. Take it regularly to avoid complications.")
give_item_to_holder(/obj/item/healthanalyzer/simple/disease, list(LOCATION_BACKPACK))

View File

@@ -11,4 +11,4 @@
mail_goodies = list(/obj/item/clothing/mask/whistle)
/datum/quirk/item_quirk/deafness/add_unique(client/client_source)
give_item_to_holder(/obj/item/clothing/accessory/deaf_pin, list(LOCATION_BACKPACK = ITEM_SLOT_BACKPACK, LOCATION_HANDS = ITEM_SLOT_HANDS))
give_item_to_holder(/obj/item/clothing/accessory/deaf_pin, list(LOCATION_BACKPACK, LOCATION_HANDS))

View File

@@ -34,10 +34,10 @@
give_item_to_holder(
new_heirloom,
list(
LOCATION_LPOCKET = ITEM_SLOT_LPOCKET,
LOCATION_RPOCKET = ITEM_SLOT_RPOCKET,
LOCATION_BACKPACK = ITEM_SLOT_BACKPACK,
LOCATION_HANDS = ITEM_SLOT_HANDS,
LOCATION_LPOCKET,
LOCATION_RPOCKET,
LOCATION_BACKPACK,
LOCATION_HANDS,
),
flavour_text = "This is a precious family heirloom, passed down from generation to generation. Keep it safe!",
)

View File

@@ -13,17 +13,17 @@
/datum/quirk/item_quirk/fluoride_stare/add_unique(client/client_source)
var/obj/item/reagent_containers/cup/bottle/salglu_solution/saline = new(get_turf(quirk_holder))
give_item_to_holder(saline, list(
LOCATION_LPOCKET = ITEM_SLOT_LPOCKET,
LOCATION_RPOCKET = ITEM_SLOT_RPOCKET,
LOCATION_BACKPACK = ITEM_SLOT_BACKPACK,
LOCATION_HANDS = ITEM_SLOT_HANDS,
LOCATION_LPOCKET,
LOCATION_RPOCKET,
LOCATION_BACKPACK,
LOCATION_HANDS,
))
var/obj/item/reagent_containers/dropper/dropper = new(get_turf(quirk_holder))
give_item_to_holder(dropper, list(
LOCATION_LPOCKET = ITEM_SLOT_LPOCKET,
LOCATION_RPOCKET = ITEM_SLOT_RPOCKET,
LOCATION_BACKPACK = ITEM_SLOT_BACKPACK,
LOCATION_HANDS = ITEM_SLOT_HANDS,
LOCATION_LPOCKET,
LOCATION_RPOCKET,
LOCATION_BACKPACK,
LOCATION_HANDS,
))
/datum/quirk/item_quirk/fluoride_stare/add(client/client_source)

View File

@@ -46,4 +46,4 @@ GLOBAL_LIST_INIT(possible_food_allergies, list(
to_chat(client_source.mob, span_info("You are allergic to [what_are_we_actually_killed_by]. Watch what you eat!"))
var/obj/item/clothing/accessory/dogtag/allergy/dogtag = new(quirk_holder, what_are_we_actually_killed_by)
give_item_to_holder(dogtag, list(LOCATION_BACKPACK = ITEM_SLOT_BACKPACK, LOCATION_HANDS = ITEM_SLOT_HANDS), flavour_text = "Keep it close around the kitchen.")
give_item_to_holder(dogtag, list(LOCATION_BACKPACK, LOCATION_HANDS), flavour_text = "Keep it close around the kitchen.")

View File

@@ -22,9 +22,9 @@
glasses_type = GLOB.nearsighted_glasses[glasses_name]
give_item_to_holder(glasses_type, list(
LOCATION_EYES = ITEM_SLOT_EYES,
LOCATION_BACKPACK = ITEM_SLOT_BACKPACK,
LOCATION_HANDS = ITEM_SLOT_HANDS,
LOCATION_EYES,
LOCATION_BACKPACK,
LOCATION_HANDS,
))
/datum/quirk/item_quirk/nearsighted/add(client/client_source)

View File

@@ -17,9 +17,9 @@
/datum/quirk/item_quirk/scarred_eye/add_unique(client/client_source)
if (client_source?.prefs.read_preference(/datum/preference/choiced/scarred_eye) == "Double")
give_item_to_holder(new /obj/item/clothing/glasses/blindfold/white(get_turf(quirk_holder)), list(
LOCATION_EYES = ITEM_SLOT_EYES,
LOCATION_BACKPACK = ITEM_SLOT_BACKPACK,
LOCATION_HANDS = ITEM_SLOT_HANDS,
LOCATION_EYES,
LOCATION_BACKPACK,
LOCATION_HANDS,
))
return
@@ -28,9 +28,9 @@
if (human_holder.get_eye_scars() & LEFT_EYE_SCAR)
eyepatch.flip_eyepatch()
give_item_to_holder(eyepatch, list(
LOCATION_EYES = ITEM_SLOT_EYES,
LOCATION_BACKPACK = ITEM_SLOT_BACKPACK,
LOCATION_HANDS = ITEM_SLOT_HANDS,
LOCATION_EYES,
LOCATION_BACKPACK,
LOCATION_HANDS,
))
/datum/quirk/item_quirk/scarred_eye/add(client/client_source)

View File

@@ -16,8 +16,8 @@
var/mob/living/carbon/human/human_holder = quirk_holder
old_hair = human_holder.hairstyle
human_holder.set_hairstyle("Bald", update = TRUE)
RegisterSignal(human_holder, COMSIG_CARBON_EQUIP_HAT, PROC_REF(equip_hat))
RegisterSignal(human_holder, COMSIG_CARBON_UNEQUIP_HAT, PROC_REF(unequip_hat))
RegisterSignal(human_holder, COMSIG_MOB_EQUIPPED_ITEM, PROC_REF(equip_hat))
RegisterSignal(human_holder, COMSIG_MOB_UNEQUIPPED_ITEM, PROC_REF(unequip_hat))
/datum/quirk/item_quirk/bald/add_unique(client/client_source)
var/obj/item/clothing/head/wig/natural/baldie_wig = new(get_turf(quirk_holder))
@@ -28,7 +28,7 @@
baldie_wig.update_appearance()
give_item_to_holder(baldie_wig, list(LOCATION_HEAD = ITEM_SLOT_HEAD, LOCATION_BACKPACK = ITEM_SLOT_BACKPACK, LOCATION_HANDS = ITEM_SLOT_HANDS), notify_player = FALSE)
give_item_to_holder(baldie_wig, list(LOCATION_HEAD, LOCATION_BACKPACK, LOCATION_HANDS), notify_player = FALSE)
/datum/quirk/item_quirk/bald/give_item_to_holder(obj/item/quirk_item, list/valid_slots, flavour_text = null, default_location = "at your feet", notify_player = TRUE)
var/any_head = FALSE
@@ -69,20 +69,24 @@
var/mob/living/carbon/human/human_holder = quirk_holder
if(human_holder.hairstyle == "Bald" && old_hair != "Bald")
human_holder.set_hairstyle(old_hair, update = TRUE)
UnregisterSignal(human_holder, list(COMSIG_CARBON_EQUIP_HAT, COMSIG_CARBON_UNEQUIP_HAT))
UnregisterSignal(human_holder, list(COMSIG_MOB_EQUIPPED_ITEM, COMSIG_MOB_UNEQUIPPED_ITEM))
human_holder.clear_mood_event("bad_hair_day")
///Checks if the headgear equipped is a wig and sets the mood event accordingly
/datum/quirk/item_quirk/bald/proc/equip_hat(mob/user, obj/item/hat)
/datum/quirk/item_quirk/bald/proc/equip_hat(mob/user, obj/item/possible_hat, slot)
SIGNAL_HANDLER
if(istype(hat, /obj/item/clothing/head/wig))
if (!(slot & ITEM_SLOT_HEAD))
return
if(istype(possible_hat, /obj/item/clothing/head/wig))
quirk_holder.add_mood_event("bad_hair_day", /datum/mood_event/confident_mane) //Our head is covered, but also by a wig so we're happy.
else
quirk_holder.clear_mood_event("bad_hair_day") //Our head is covered
///Applies a bad moodlet for having an uncovered head
/datum/quirk/item_quirk/bald/proc/unequip_hat(mob/user, obj/item/clothing, force, newloc, no_move, invdrop, silent)
/datum/quirk/item_quirk/bald/proc/unequip_hat(mob/user, obj/item/possible_hat, old_slot, force, newloc, no_move, invdrop, silent)
SIGNAL_HANDLER
quirk_holder.add_mood_event("bad_hair_day", /datum/mood_event/bald)
if (old_slot & ITEM_SLOT_HEAD)
quirk_holder.add_mood_event("bad_hair_day", /datum/mood_event/bald)

View File

@@ -11,4 +11,4 @@
if(is_banned_from(client_source.ckey, JOB_CYBORG))
return FALSE
var/obj/item/clothing/accessory/dogtag/borg_ready/borgtag = new(get_turf(quirk_holder))
give_item_to_holder(borgtag, list(LOCATION_BACKPACK = ITEM_SLOT_BACKPACK, LOCATION_HANDS = ITEM_SLOT_HANDS))
give_item_to_holder(borgtag, list(LOCATION_BACKPACK, LOCATION_HANDS))

View File

@@ -16,14 +16,14 @@
photo_album.persistence_load()
photo_album.name = "[human_holder.real_name]'s photo album"
give_item_to_holder(photo_album, list(LOCATION_BACKPACK = ITEM_SLOT_BACKPACK, LOCATION_HANDS = ITEM_SLOT_HANDS))
give_item_to_holder(photo_album, list(LOCATION_BACKPACK, LOCATION_HANDS))
give_item_to_holder(
/obj/item/camera,
list(
LOCATION_NECK = ITEM_SLOT_NECK,
LOCATION_LPOCKET = ITEM_SLOT_LPOCKET,
LOCATION_RPOCKET = ITEM_SLOT_RPOCKET,
LOCATION_BACKPACK = ITEM_SLOT_BACKPACK,
LOCATION_HANDS = ITEM_SLOT_HANDS
LOCATION_NECK,
LOCATION_LPOCKET,
LOCATION_RPOCKET,
LOCATION_BACKPACK,
LOCATION_HANDS
)
)

View File

@@ -24,7 +24,7 @@
)
/datum/quirk/item_quirk/clown_enjoyer/add_unique(client/client_source)
give_item_to_holder(/obj/item/clothing/accessory/clown_enjoyer_pin, list(LOCATION_BACKPACK = ITEM_SLOT_BACKPACK, LOCATION_HANDS = ITEM_SLOT_HANDS))
give_item_to_holder(/obj/item/clothing/accessory/clown_enjoyer_pin, list(LOCATION_BACKPACK, LOCATION_HANDS))
/datum/quirk/item_quirk/clown_enjoyer/add(client/client_source)
var/datum/atom_hud/fan = GLOB.huds[DATA_HUD_FAN]

View File

@@ -22,7 +22,7 @@
)
/datum/quirk/item_quirk/mime_fan/add_unique(client/client_source)
give_item_to_holder(/obj/item/clothing/accessory/mime_fan_pin, list(LOCATION_BACKPACK = ITEM_SLOT_BACKPACK, LOCATION_HANDS = ITEM_SLOT_HANDS))
give_item_to_holder(/obj/item/clothing/accessory/mime_fan_pin, list(LOCATION_BACKPACK, LOCATION_HANDS))
/datum/quirk/item_quirk/mime_fan/add(client/client_source)
var/datum/atom_hud/fan = GLOB.huds[DATA_HUD_FAN]

View File

@@ -10,4 +10,4 @@
mail_goodies = list(/obj/effect/spawner/random/entertainment/musical_instrument, /obj/item/instrument/piano_synth/headphones)
/datum/quirk/item_quirk/musician/add_unique(client/client_source)
give_item_to_holder(/obj/item/choice_beacon/music, list(LOCATION_BACKPACK = ITEM_SLOT_BACKPACK, LOCATION_HANDS = ITEM_SLOT_HANDS))
give_item_to_holder(/obj/item/choice_beacon/music, list(LOCATION_BACKPACK, LOCATION_HANDS))

View File

@@ -11,7 +11,7 @@
var/mob/living/carbon/human/posterboy = quirk_holder
var/obj/item/storage/box/posterbox/newbox = new()
newbox.add_quirk_posters(posterboy.mind)
give_item_to_holder(newbox, list(LOCATION_BACKPACK = ITEM_SLOT_BACKPACK, LOCATION_HANDS = ITEM_SLOT_HANDS))
give_item_to_holder(newbox, list(LOCATION_BACKPACK, LOCATION_HANDS))
/obj/item/storage/box/posterbox
name = "Box of Posters"

View File

@@ -34,8 +34,8 @@
human_quirkholder.add_traits(settler_traits, QUIRK_TRAIT)
/datum/quirk/item_quirk/settler/add_unique(client/client_source)
give_item_to_holder(/obj/item/storage/box/papersack/wheat, list(LOCATION_BACKPACK = ITEM_SLOT_BACKPACK, LOCATION_HANDS = ITEM_SLOT_HANDS))
give_item_to_holder(/obj/item/storage/toolbox/fishing/small, list(LOCATION_BACKPACK = ITEM_SLOT_BACKPACK, LOCATION_HANDS = ITEM_SLOT_HANDS))
give_item_to_holder(/obj/item/storage/box/papersack/wheat, list(LOCATION_BACKPACK, LOCATION_HANDS))
give_item_to_holder(/obj/item/storage/toolbox/fishing/small, list(LOCATION_BACKPACK, LOCATION_HANDS))
/datum/quirk/item_quirk/settler/remove()
if(QDELING(quirk_holder))

View File

@@ -14,7 +14,7 @@
var/obj/item/clothing/gloves/gloves_type = /obj/item/clothing/gloves/radio
if(isplasmaman(quirk_holder))
gloves_type = /obj/item/clothing/gloves/color/plasmaman/radio
give_item_to_holder(gloves_type, list(LOCATION_GLOVES = ITEM_SLOT_GLOVES, LOCATION_BACKPACK = ITEM_SLOT_BACKPACK, LOCATION_HANDS = ITEM_SLOT_HANDS))
give_item_to_holder(gloves_type, list(LOCATION_GLOVES, LOCATION_HANDS))
/datum/quirk/item_quirk/signer/remove()
qdel(quirk_holder.GetComponent(/datum/component/sign_language))

View File

@@ -64,7 +64,7 @@
// Supply them with some patches to help out on their new assignment
var/obj/item/storage/pill_bottle/ondansetron/disgust_killers = new()
disgust_killers.desc += " Best to take one when travelling to a planet's surface."
if(quirk_holder.equip_to_slot_if_possible(disgust_killers, ITEM_SLOT_BACKPACK, qdel_on_fail = TRUE, initial = TRUE, indirect_action = TRUE))
if(quirk_holder.equip_to_storage(disgust_killers, ITEM_SLOT_BACK, indirect_action = TRUE, del_on_fail = TRUE))
to_chat(quirk_holder, span_info("You have[isnull(spacer_account) ? " " : " also "]been given some anti-emetic patches to assist in adjusting to planetary gravity."))
/datum/quirk/spacer_born/remove()

View File

@@ -16,5 +16,5 @@
)
/datum/quirk/item_quirk/spiritual/add_unique(client/client_source)
give_item_to_holder(/obj/item/storage/fancy/candle_box, list(LOCATION_BACKPACK = ITEM_SLOT_BACKPACK, LOCATION_HANDS = ITEM_SLOT_HANDS))
give_item_to_holder(/obj/item/storage/box/matches, list(LOCATION_BACKPACK = ITEM_SLOT_BACKPACK, LOCATION_HANDS = ITEM_SLOT_HANDS))
give_item_to_holder(/obj/item/storage/fancy/candle_box, list(LOCATION_BACKPACK, LOCATION_HANDS))
give_item_to_holder(/obj/item/storage/box/matches, list(LOCATION_BACKPACK, LOCATION_HANDS))

View File

@@ -21,4 +21,4 @@
/datum/quirk/item_quirk/tagger/add_unique(client/client_source)
var/obj/item/toy/crayon/spraycan/can = new
can.set_painting_tool_color(client_source?.prefs.read_preference(/datum/preference/color/paint_color))
give_item_to_holder(can, list(LOCATION_BACKPACK = ITEM_SLOT_BACKPACK, LOCATION_HANDS = ITEM_SLOT_HANDS))
give_item_to_holder(can, list(LOCATION_BACKPACK, LOCATION_HANDS))

View File

@@ -234,7 +234,7 @@
))
hat = new hat(spawned_mob)
if(!spawned_mob.equip_to_slot_if_possible(hat, ITEM_SLOT_HEAD, disable_warning = TRUE))
spawned_mob.equip_to_slot_or_del(hat, ITEM_SLOT_BACKPACK, indirect_action = TRUE)
spawned_mob.equip_to_storage(hat, ITEM_SLOT_BACK, indirect_action = TRUE)
var/obj/item/toy = pick_weight(list(
/obj/item/reagent_containers/spray/chemsprayer/party = 4,
/obj/item/toy/balloon = 2,
@@ -246,12 +246,12 @@
if(istype(toy, /obj/item/toy/balloon))
spawned_mob.equip_to_slot_or_del(toy, ITEM_SLOT_HANDS) //Balloons do not fit inside of backpacks.
else
spawned_mob.equip_to_slot_or_del(toy, ITEM_SLOT_BACKPACK, indirect_action = TRUE)
spawned_mob.equip_to_storage(toy, ITEM_SLOT_BACK, indirect_action = TRUE)
if(birthday_person_name) //Anyone who joins after the annoucement gets one of these.
var/obj/item/birthday_invite/birthday_invite = new(spawned_mob)
birthday_invite.setup_card(birthday_person_name)
if(!spawned_mob.equip_to_slot_if_possible(birthday_invite, ITEM_SLOT_HANDS, disable_warning = TRUE))
spawned_mob.equip_to_slot_or_del(birthday_invite, ITEM_SLOT_BACKPACK) //Just incase someone spawns with both hands full.
spawned_mob.equip_to_storage(birthday_invite, ITEM_SLOT_BACK, indirect_action = TRUE) //Just incase someone spawns with both hands full.
/obj/item/birthday_invite
name = "birthday invitation"
@@ -311,9 +311,10 @@
// Put their silly little scarf or necktie somewhere else
var/obj/item/silly_little_scarf = humanspawned.wear_neck
if(silly_little_scarf)
var/list/backup_slots = list(LOCATION_LPOCKET, LOCATION_RPOCKET, LOCATION_BACKPACK)
humanspawned.temporarilyRemoveItemFromInventory(silly_little_scarf)
silly_little_scarf.forceMove(get_turf(humanspawned))
humanspawned.equip_in_one_of_slots(silly_little_scarf, ITEM_SLOT_BACKPACK, ITEM_SLOT_LPOCKET, ITEM_SLOT_RPOCKET, qdel_on_fail = FALSE, indirect_action = TRUE)
humanspawned.equip_in_one_of_slots(silly_little_scarf, backup_slots, qdel_on_fail = FALSE)
var/obj/item/clothing/neck/link_scryer/loaded/new_scryer = new(spawned)
new_scryer.label = spawned.name
@@ -477,7 +478,7 @@
if((skub_stance == RANDOM_SKUB && prob(50)) || skub_stance == PRO_SKUB)
var/obj/item/storage/box/stickers/skub/boxie = new(spawned.loc)
spawned.equip_to_slot_if_possible(boxie, ITEM_SLOT_BACKPACK, indirect_action = TRUE)
spawned.equip_to_storage(boxie, ITEM_SLOT_BACK, indirect_action = TRUE)
if(ishuman(spawned))
var/obj/item/clothing/suit/costume/wellworn_shirt/skub/shirt = new(spawned.loc)
if(!spawned.equip_to_slot_if_possible(shirt, ITEM_SLOT_OCLOTHING, indirect_action = TRUE))
@@ -485,7 +486,7 @@
return
var/obj/item/storage/box/stickers/anti_skub/boxie = new(spawned.loc)
spawned.equip_to_slot_if_possible(boxie, ITEM_SLOT_BACKPACK, indirect_action = TRUE)
spawned.equip_to_storage(boxie, ITEM_SLOT_BACK, indirect_action = TRUE)
if(!ishuman(spawned))
return
var/obj/item/clothing/suit/costume/wellworn_shirt/skub/anti/shirt = new(spawned.loc)

View File

@@ -460,7 +460,7 @@ GLOBAL_LIST_EMPTY(cached_storage_typecaches)
* Arguments
* * obj/item/to_insert - the item we're inserting
* * mob/user - (optional) the user who is inserting the item.
* * override - see item_insertion_feedback()
* * override - skip feedback, only do the animation
* * force - bypass locked storage up to a certain level. See [code/__DEFINES/storage.dm]
* * messages - if TRUE, we will create balloon alerts for the user.
*/

View File

@@ -190,16 +190,16 @@ GLOBAL_LIST_EMPTY(objectives) //SKYRAT EDIT ADDITION
/datum/objective/proc/give_special_equipment(special_equipment)
var/datum/mind/receiver = pick(get_owners())
if(receiver?.current)
if(ishuman(receiver.current))
var/mob/living/carbon/human/receiver_current = receiver.current
var/list/slots = list("backpack" = ITEM_SLOT_BACKPACK)
for(var/obj/equipment_path as anything in special_equipment)
var/obj/equipment_object = new equipment_path
if(!receiver_current.equip_in_one_of_slots(equipment_object, slots, indirect_action = TRUE))
LAZYINITLIST(receiver.failed_special_equipment)
receiver.failed_special_equipment += equipment_path
receiver.try_give_equipment_fallback()
if(!ishuman(receiver?.current))
return
var/mob/living/carbon/human/receiver_current = receiver.current
for(var/obj/equipment_path as anything in special_equipment)
var/obj/equipment_object = new equipment_path
if(receiver_current.equip_to_storage(equipment_object, ITEM_SLOT_BACK, indirect_action = TRUE))
continue
LAZYINITLIST(receiver.failed_special_equipment)
receiver.failed_special_equipment += equipment_path
receiver.try_give_equipment_fallback()
/datum/action/special_equipment_fallback
name = "Request Objective-specific Equipment"

View File

@@ -807,7 +807,9 @@
/// Sometimes we only want to grant the item's action if it's equipped in a specific slot.
/obj/item/proc/item_action_slot_check(slot, mob/user, datum/action/action)
if(slot & (ITEM_SLOT_BACKPACK|ITEM_SLOT_LEGCUFFED)) //these aren't true slots, so avoid granting actions there
if(!slot) // Equipped into storage
return FALSE
if(slot & (ITEM_SLOT_HANDCUFFED|ITEM_SLOT_LEGCUFFED)) // These aren't true slots, so avoid granting actions there
return FALSE
if(!isnull(action_slots))
return (slot & action_slots)

View File

@@ -174,7 +174,7 @@
/obj/item/card/id/equipped(mob/user, slot)
. = ..()
if (slot == ITEM_SLOT_ID)
if (slot & ITEM_SLOT_ID)
RegisterSignal(user, COMSIG_MOVABLE_POINTED, PROC_REF(on_pointed))
/obj/item/card/id/dropped(mob/user)

View File

@@ -47,11 +47,11 @@
fake_id.update_icon()
var/placed_in = user.equip_in_one_of_slots(fake_id, list(
LOCATION_ID = ITEM_SLOT_ID,
LOCATION_LPOCKET = ITEM_SLOT_LPOCKET,
LOCATION_RPOCKET = ITEM_SLOT_RPOCKET,
LOCATION_BACKPACK = ITEM_SLOT_BACKPACK,
LOCATION_HANDS = ITEM_SLOT_HANDS,
LOCATION_ID,
LOCATION_LPOCKET,
LOCATION_RPOCKET,
LOCATION_BACKPACK,
LOCATION_HANDS,
), qdel_on_fail = FALSE, indirect_action = TRUE)
if (isnull(placed_in))
fake_id.forceMove(user.drop_location())
@@ -73,10 +73,10 @@
if (original_id)
var/returned_to = user.equip_in_one_of_slots(original_id, list(
LOCATION_BACKPACK = ITEM_SLOT_BACKPACK,
LOCATION_LPOCKET = ITEM_SLOT_LPOCKET,
LOCATION_RPOCKET = ITEM_SLOT_RPOCKET,
LOCATION_HANDS = ITEM_SLOT_HANDS,
LOCATION_BACKPACK,
LOCATION_LPOCKET,
LOCATION_RPOCKET,
LOCATION_HANDS,
), qdel_on_fail = FALSE, indirect_action = TRUE)
if (isnull(returned_to))
fake_id.forceMove(user.drop_location())

View File

@@ -213,11 +213,11 @@
lunatic.set_master(user.mind, user)
var/obj/item/clothing/neck/heretic_focus/moon_amulet/amulet = new(crewmate.drop_location())
var/static/list/slots = list(
"neck" = ITEM_SLOT_NECK,
"hands" = ITEM_SLOT_HANDS,
"backpack" = ITEM_SLOT_BACKPACK,
"right pocket" = ITEM_SLOT_RPOCKET,
"left pocket" = ITEM_SLOT_RPOCKET,
LOCATION_NECK,
LOCATION_HANDS,
LOCATION_RPOCKET,
LOCATION_LPOCKET,
LOCATION_BACKPACK,
)
crewmate.equip_in_one_of_slots(amulet, slots, qdel_on_fail = FALSE)
crewmate.emote("laugh")

View File

@@ -54,7 +54,7 @@
radio.use_command = TRUE
if(ispath(uplink_type, /obj/item/uplink) || tc) // /obj/item/uplink understands 0 tc
var/obj/item/uplink = new uplink_type(nukie, nukie.key, tc)
nukie.equip_to_slot_or_del(uplink, ITEM_SLOT_BACKPACK, indirect_action = TRUE)
nukie.equip_to_storage(uplink, ITEM_SLOT_BACK, indirect_action = TRUE, del_on_fail = TRUE)
var/obj/item/implant/weapons_auth/weapons_implant = new/obj/item/implant/weapons_auth(nukie)
weapons_implant.implant(nukie)

View File

@@ -27,7 +27,7 @@
/datum/outfit/vr/syndicate/post_equip(mob/living/carbon/human/H)
. = ..()
var/obj/item/uplink/U = new /obj/item/uplink/nuclear_restricted(H, H.key, 80)
H.equip_to_slot_or_del(U, ITEM_SLOT_BACKPACK, indirect_action = TRUE)
H.equip_to_storage(U, ITEM_SLOT_BACK, indirect_action = TRUE, del_on_fail = TRUE)
var/obj/item/implant/weapons_auth/W = new/obj/item/implant/weapons_auth(H)
W.implant(H)
var/obj/item/implant/explosive/E = new/obj/item/implant/explosive(H)

View File

@@ -158,10 +158,8 @@
/obj/item/clothing/accessory/proc/on_uniform_equipped(obj/item/clothing/under/source, mob/living/user, slot)
SIGNAL_HANDLER
if(!(slot & source.slot_flags))
return
accessory_equipped(source, user)
if(slot & source.slot_flags)
accessory_equipped(source, user)
/// Signal proc for [COMSIG_ITEM_DROPPED] on the uniform we're pinned to
/obj/item/clothing/accessory/proc/on_uniform_dropped(obj/item/clothing/under/source, mob/living/user)

View File

@@ -54,7 +54,7 @@
if(GLOB.bible_inhand_icon_state)
holy_bible.inhand_icon_state = GLOB.bible_inhand_icon_state
to_chat(human_spawned, span_boldnotice("There is already an established religion onboard the station. You are an acolyte of [GLOB.deity]. Defer to the Chaplain."))
human_spawned.equip_to_slot_or_del(holy_bible, ITEM_SLOT_BACKPACK, indirect_action = TRUE)
human_spawned.equip_to_storage(holy_bible, ITEM_SLOT_BACK, indirect_action = TRUE, del_on_fail = TRUE)
var/nrt = GLOB.holy_weapon_type || /obj/item/nullrod
var/obj/item/nullrod/nullrod = new nrt(human_spawned)
human_spawned.put_in_hands(nullrod)
@@ -105,7 +105,7 @@
GLOB.bible_name = new_bible
GLOB.deity = holy_bible.deity_name
human_spawned.equip_to_slot_or_del(holy_bible, ITEM_SLOT_BACKPACK, indirect_action = TRUE)
human_spawned.equip_to_storage(holy_bible, ITEM_SLOT_BACK, indirect_action = TRUE, del_on_fail = TRUE)
SSblackbox.record_feedback("text", "religion_name", 1, "[new_religion]", 1)
SSblackbox.record_feedback("text", "religion_deity", 1, "[new_deity]", 1)

View File

@@ -309,20 +309,20 @@
return
var/obj/item/storage/wallet/wallet = new(equipper)
if(istype(id_card))
equipper.temporarilyRemoveItemFromInventory(id_card, force = TRUE)
equipper.equip_to_slot_if_possible(wallet, ITEM_SLOT_ID, initial = TRUE)
id_card.forceMove(wallet)
for(var/obj/item/thing in equipper?.back)
// leaves a slot free for whatever they may want
if(length(wallet.contents) >= wallet.atom_storage.max_slots - 1)
break
if(thing.w_class > wallet.atom_storage.max_specific_storage)
continue
wallet.atom_storage.attempt_insert(thing, override = TRUE, force = STORAGE_FULLY_LOCKED, messages = FALSE)
else
if(!istype(id_card))
// They must have a PDA or some other thing in their ID slot, abort
if(!equipper.equip_to_slot_if_possible(wallet, slot = ITEM_SLOT_BACKPACK, initial = TRUE))
if(!equipper.equip_to_storage(wallet, ITEM_SLOT_BACK, indirect_action = TRUE))
wallet.forceMove(equipper.drop_location())
return
equipper.temporarilyRemoveItemFromInventory(id_card, force = TRUE)
equipper.equip_to_slot_if_possible(wallet, ITEM_SLOT_ID, initial = TRUE)
id_card.forceMove(wallet)
for(var/obj/item/thing in equipper?.back)
// leaves a slot free for whatever they may want
if(length(wallet.contents) >= wallet.atom_storage.max_slots - 1)
break
if(thing.w_class > wallet.atom_storage.max_specific_storage)
continue
wallet.atom_storage.attempt_insert(thing, override = TRUE, force = STORAGE_FULLY_LOCKED, messages = FALSE)

View File

@@ -478,6 +478,10 @@
/mob/proc/equip_to_slot(obj/item/equipping, slot, initial = FALSE, redraw_mob = FALSE, indirect_action = FALSE)
return
/// This proc is called after an item has been successfully handled and equipped to a slot.
/mob/proc/has_equipped(obj/item/item, slot, initial = FALSE)
return item.on_equipped(src, slot, initial)
/**
* Equip an item to the slot or delete
*
@@ -540,22 +544,42 @@
if(user.active_storage?.attempt_insert(src, user, messages = FALSE))
return TRUE
var/list/obj/item/possible = list(
user.get_inactive_held_item(),
user.get_item_by_slot(ITEM_SLOT_BELT),
user.get_item_by_slot(ITEM_SLOT_DEX_STORAGE),
user.get_item_by_slot(ITEM_SLOT_BACK),
var/static/list/equip_priorities = list(
ITEM_SLOT_BELT,
ITEM_SLOT_BACK,
ITEM_SLOT_DEX_STORAGE,
ITEM_SLOT_OCLOTHING,
ITEM_SLOT_ICLOTHING,
)
for(var/thing in possible)
if(isnull(thing))
continue
var/obj/item/gear = thing
if(gear.atom_storage?.attempt_insert(src, user, messages = FALSE))
var/list/possible_storages = user.held_items.Copy()
var/obj/item/active_held = user.get_active_held_item()
possible_storages -= active_held
if(active_held != src)
// If something else is equipping us, just in case, do it into the held item
possible_storages.Insert(1, active_held)
for(var/slot in equip_priorities)
possible_storages += user.get_item_by_slot(slot)
for(var/obj/item/gear as anything in possible_storages)
if(gear?.atom_storage?.attempt_insert(src, user, messages = FALSE))
return TRUE
to_chat(user, span_warning("You are unable to equip that!"))
return FALSE
/// Attempts to put an item into storage located in a given slot
/// indirect_action - ignore "soft-locked" storages that can be easily opened
/// del_on_fail - delete the item upon failure
/mob/proc/equip_to_storage(obj/item/item, slot, indirect_action = FALSE, del_on_fail = FALSE, initial = FALSE)
var/obj/item/worn_item = get_item_by_slot(slot)
if (worn_item?.atom_storage?.attempt_insert(item, src, override = TRUE, force = indirect_action ? STORAGE_SOFT_LOCKED : STORAGE_NOT_LOCKED))
return TRUE
if (del_on_fail)
qdel(item)
return FALSE
/mob/verb/quick_equip()
set name = "quick-equip"

View File

@@ -18,7 +18,7 @@
update_worn_mask()
if(slot_flags & ITEM_SLOT_HANDS)
update_held_items()
if(slot_flags & (ITEM_SLOT_HANDS|ITEM_SLOT_BACKPACK|ITEM_SLOT_DEX_STORAGE))
if(slot_flags & (ITEM_SLOT_HANDS|ITEM_SLOT_DEX_STORAGE))
update_inv_internal_storage()
/mob/living/basic/drone/proc/update_inv_internal_storage()

View File

@@ -637,7 +637,7 @@ GLOBAL_LIST_EMPTY(features_by_species)
// Anything that's small or smaller can fit into a pocket by default
if((slot & (ITEM_SLOT_RPOCKET|ITEM_SLOT_LPOCKET)) && I.w_class <= POCKET_WEIGHT_CLASS)
excused = TRUE
else if(slot & (ITEM_SLOT_SUITSTORE|ITEM_SLOT_BACKPACK|ITEM_SLOT_BELTPACK|ITEM_SLOT_HANDS))
else if(slot & (ITEM_SLOT_SUITSTORE|ITEM_SLOT_HANDS))
excused = TRUE
if(!excused)
return FALSE
@@ -674,16 +674,11 @@ GLOBAL_LIST_EMPTY(features_by_species)
return equip_delay_self_check(I, H, bypass_equip_delay_self)
if(ITEM_SLOT_BELT)
var/obj/item/bodypart/O = H.get_bodypart(BODY_ZONE_CHEST)
if(!H.w_uniform && !HAS_TRAIT(H, TRAIT_NO_JUMPSUIT) && (!O || IS_ORGANIC_LIMB(O)))
if(!disable_warning)
to_chat(H, span_warning("You need a jumpsuit before you can attach this [I.name]!"))
return FALSE
return equip_delay_self_check(I, H, bypass_equip_delay_self)
if(ITEM_SLOT_BELTPACK)
if(H.belt && H.belt.atom_storage?.can_insert(I, H, messages = TRUE, force = indirect_action ? STORAGE_SOFT_LOCKED : STORAGE_NOT_LOCKED))
return TRUE
return FALSE
if(ITEM_SLOT_EYES)
if(!H.get_bodypart(BODY_ZONE_HEAD))
return FALSE
@@ -764,10 +759,6 @@ GLOBAL_LIST_EMPTY(features_by_species)
if(H.num_legs < 2)
return FALSE
return TRUE
if(ITEM_SLOT_BACKPACK)
if(H.back && H.back.atom_storage?.can_insert(I, H, messages = TRUE, force = indirect_action ? STORAGE_SOFT_LOCKED : STORAGE_NOT_LOCKED))
return TRUE
return FALSE
return FALSE //Unsupported slot
/datum/species/proc/equip_delay_self_check(obj/item/I, mob/living/carbon/human/H, bypass_equip_delay_self)

View File

@@ -52,9 +52,6 @@
if(looking_for == belt)
return ITEM_SLOT_BELT
if(belt && (looking_for in belt))
return ITEM_SLOT_BELTPACK
if(looking_for == wear_id)
return ITEM_SLOT_ID
@@ -182,9 +179,7 @@
if(ITEM_SLOT_OCLOTHING)
if(wear_suit)
return
wear_suit = equipping
if(wear_suit.breakouttime) //when equipping a straightjacket
ADD_TRAIT(src, TRAIT_RESTRAINED, SUIT_TRAIT)
stop_pulling() //can't pull if restrained
@@ -207,20 +202,13 @@
return
s_store = equipping
update_suit_storage()
if(ITEM_SLOT_BELTPACK)
if(!belt || !belt.atom_storage?.attempt_insert(equipping, src, override = TRUE, force = indirect_action ? STORAGE_SOFT_LOCKED : STORAGE_NOT_LOCKED))
not_handled = TRUE
else
to_chat(src, span_danger("You are trying to equip this item to an unsupported inventory slot. Report this to a coder!"))
not_handled = TRUE
//Item is handled and in slot, valid to call callback, for this proc should always be true
if(!not_handled)
has_equipped(equipping, slot, initial)
hud_used?.update_locked_slots()
// Send a signal for when we equip an item that used to cover our feet/shoes. Used for bloody feet
if(equipping.body_parts_covered & FEET || (equipping.flags_inv | equipping.transparent_protection) & HIDESHOES)
SEND_SIGNAL(src, COMSIG_CARBON_EQUIP_SHOECOVER, equipping, slot, initial, redraw_mob)
return not_handled //For future deeper overrides
@@ -305,10 +293,6 @@
else
not_handled = TRUE
// Send a signal for when we unequip an item that used to cover our feet/shoes. Used for bloody feet
if((I.body_parts_covered & FEET) || (I.flags_inv | I.transparent_protection) & HIDESHOES)
SEND_SIGNAL(src, COMSIG_CARBON_UNEQUIP_SHOECOVER, I, force, newloc, no_move, invdrop, silent)
if(not_handled)
return

View File

@@ -62,9 +62,6 @@
if(looking_for == back)
return ITEM_SLOT_BACK
if(back && (looking_for in back))
return ITEM_SLOT_BACKPACK
if(looking_for == wear_mask)
return ITEM_SLOT_MASK
@@ -98,7 +95,6 @@
ITEM_SLOT_BACK,
ITEM_SLOT_NECK,
ITEM_SLOT_HANDS,
ITEM_SLOT_BACKPACK,
ITEM_SLOT_SUITSTORE,
ITEM_SLOT_HANDCUFFED,
ITEM_SLOT_LEGCUFFED,
@@ -116,9 +112,27 @@
return visible_items
/mob/living/carbon/proc/equip_in_one_of_slots(obj/item/equipping, list/slots, qdel_on_fail = TRUE, indirect_action = FALSE)
var/static/list/equip_slots = list(
LOCATION_LPOCKET,
LOCATION_RPOCKET,
LOCATION_HANDS,
LOCATION_GLOVES,
LOCATION_EYES,
LOCATION_HEAD,
LOCATION_NECK,
LOCATION_ID,
)
var/static/list/storage_slots = list(
LOCATION_BACKPACK,
)
for(var/slot in slots)
if(equip_to_slot_if_possible(equipping, slots[slot], disable_warning = TRUE, indirect_action = indirect_action))
return slot
if(equip_slots[slot])
if(equip_to_slot_if_possible(equipping, equip_slots[slot], disable_warning = TRUE, indirect_action = indirect_action))
return slot
else if (storage_slots[slot])
if(equip_to_storage(equipping, storage_slots[slot], indirect_action = indirect_action))
return slot
if(qdel_on_fail)
qdel(equipping)
return null
@@ -127,6 +141,7 @@
/mob/living/carbon/equip_to_slot(obj/item/equipping, slot, initial = FALSE, redraw_mob = FALSE, indirect_action = FALSE)
if(!slot)
return
if(!istype(equipping))
return
@@ -140,10 +155,12 @@
equipping.screen_loc = null
if(client)
client.screen -= equipping
if(observers?.len)
for(var/mob/dead/observe as anything in observers)
if(observe.client)
observe.client.screen -= equipping
equipping.forceMove(src)
SET_PLANE_EXPLICIT(equipping, ABOVE_HUD_PLANE, src)
equipping.appearance_flags |= NO_CLIENT_COLOR
@@ -164,7 +181,6 @@
if(head)
return
head = equipping
SEND_SIGNAL(src, COMSIG_CARBON_EQUIP_HAT, equipping)
update_worn_head()
if(ITEM_SLOT_NECK)
if(wear_neck)
@@ -180,9 +196,6 @@
if(ITEM_SLOT_HANDS)
put_in_hands(equipping)
update_held_items()
if(ITEM_SLOT_BACKPACK)
if(!back || !back.atom_storage?.attempt_insert(equipping, src, override = TRUE, force = indirect_action ? STORAGE_SOFT_LOCKED : STORAGE_NOT_LOCKED))
not_handled = TRUE
else
not_handled = TRUE
@@ -191,17 +204,16 @@
//in a slot (handled further down inheritance chain, probably living/carbon/human/equip_to_slot
if(!not_handled)
has_equipped(equipping, slot, initial)
hud_used?.update_locked_slots()
return not_handled
/mob/living/carbon/has_equipped(obj/item/item, slot, initial)
. = ..()
hud_used?.update_locked_slots()
/mob/living/carbon/get_equipped_speed_mod_items()
return ..() + get_equipped_items()
/// This proc is called after an item has been successfully handled and equipped to a slot.
/mob/living/carbon/proc/has_equipped(obj/item/item, slot, initial = FALSE)
return item.on_equipped(src, slot, initial)
/mob/living/carbon/doUnEquip(obj/item/I, force, newloc, no_move, invdrop = TRUE, silent = FALSE)
. = ..() //Sets the default return value to what the parent returns.
if(!. || !I) //We don't want to set anything to null if the parent returned 0.
@@ -210,7 +222,6 @@
var/not_handled = FALSE //if we actually unequipped an item, this is because we dont want to run this proc twice, once for carbons and once for humans
if(I == head)
head = null
SEND_SIGNAL(src, COMSIG_CARBON_UNEQUIP_HAT, I, force, newloc, no_move, invdrop, silent)
if(!QDELETED(src))
update_worn_head()
else if(I == back)
@@ -522,13 +533,15 @@
/// in their hands would be a dead giveaway that they are an antagonist.
/// Returns the human readable name of where it placed the item, or null otherwise.
/mob/living/carbon/proc/equip_conspicuous_item(obj/item/item, delete_item_if_failed = TRUE)
var/list/slots = list (
"backpack" = ITEM_SLOT_BACKPACK,
var/static/list/pockets = list(
"left pocket" = ITEM_SLOT_LPOCKET,
"right pocket" = ITEM_SLOT_RPOCKET
)
var/placed_in = equip_in_one_of_slots(item, slots, indirect_action = TRUE)
var/placed_in = equip_in_one_of_slots(item, pockets, indirect_action = TRUE)
if (!placed_in)
placed_in = equip_to_storage(item, ITEM_SLOT_BACK, indirect_action = TRUE)
if (isnull(placed_in) && delete_item_if_failed)
qdel(item)

View File

@@ -300,9 +300,6 @@
/obj/item/mod/module/proc/on_uninstall(deleting = FALSE)
SHOULD_CALL_PARENT(TRUE)
if (deleting)
return
if (mask_worn_overlay)
for (var/obj/item/part as anything in mod.get_parts(all = TRUE))
UnregisterSignal(part, COMSIG_ITEM_GET_SEPARATE_WORN_OVERLAYS)

View File

@@ -84,7 +84,7 @@
for (var/path in backpack_contents)
var/number = backpack_contents[path] || 1
for (var/_ in 1 to number)
if (!H.equip_to_slot_or_del(new path(H), ITEM_SLOT_BACKPACK, TRUE, indirect_action = TRUE))
if (!H.equip_to_storage(new path(H), ITEM_SLOT_BACK, indirect_action = TRUE, del_on_fail = TRUE))
TEST_FAIL("[outfit.name]'s backpack_contents are invalid! Couldn't add [path] to backpack.")
if (outfit.belt_contents)
@@ -92,7 +92,7 @@
for (var/path in belt_contents)
var/number = belt_contents[path] || 1
for (var/_ in 1 to number)
if (!H.equip_to_slot_or_del(new path(H), ITEM_SLOT_BELTPACK, TRUE, indirect_action = TRUE))
if (!H.equip_to_storage(new path(H), ITEM_SLOT_BELT, indirect_action = TRUE, del_on_fail = TRUE))
TEST_FAIL("[outfit.name]'s belt_contents are invalid! Couldn't add [path] to backpack.")