Duiffel Spotfix (#76442)

## About The Pull Request

Gives duffelbags their proper slot count
They inherited this from backpacks, but I sorta just forgot about that

[Creates "levels" of locked objects, uses that to make locked duffels
work](https://github.com/tgstation/tgstation/pull/76442/commits/c613c00f62fa3ff03bb33737d24da9acbf2050e3)

[c613c00](https://github.com/tgstation/tgstation/pull/76442/commits/c613c00f62fa3ff03bb33737d24da9acbf2050e3)

Turns locked into something that holds defines, this makes life a lot
easier.
Requires a lot of boilerplate because of how many uses of these procs
there are and all the passthrough and shit.

Adds a few outfit subtypes to avoid this class of failure in future.

Renames the args in a few but not all touched procs, one thing at a time

Closes #76407
Closes #76430 Had the lock check in the wrong place
Closes #76441 GOD I HATE TK SO MUCH

Wrote half the pr without glasses so if it's weird gimme some grace
yeah?

## Changelog
🆑
fix: Fixes some fuck with duffelbags, them not holding enough + issues
with spawning gear in them (job shit and all)
/🆑
This commit is contained in:
LemonInTheDark
2023-07-01 15:36:26 +01:00
committed by GitHub
parent 5ac30929e4
commit 8c2c72b0ed
38 changed files with 193 additions and 147 deletions
+4 -2
View File
@@ -704,12 +704,14 @@
* * disable_warning to TRUE if you wish it to not give you text outputs.
* * slot is the slot we are trying to equip to
* * bypass_equip_delay_self for whether we want to bypass the equip delay
* * ignore_equipped ignores any already equipped items in that slot
* * indirect_action allows inserting into "soft locked" bags, things that can be easily opened by the owner
*/
/obj/item/proc/mob_can_equip(mob/living/M, slot, disable_warning = FALSE, bypass_equip_delay_self = FALSE, ignore_equipped = FALSE)
/obj/item/proc/mob_can_equip(mob/living/M, slot, disable_warning = FALSE, bypass_equip_delay_self = FALSE, ignore_equipped = FALSE, indirect_action = FALSE)
if(!M)
return FALSE
return M.can_equip(src, slot, disable_warning, bypass_equip_delay_self, ignore_equipped)
return M.can_equip(src, slot, disable_warning, bypass_equip_delay_self, ignore_equipped, indirect_action = indirect_action)
/obj/item/verb/verb_pickup()
set src in oview(1)
@@ -89,7 +89,10 @@
update_appearance()
/obj/item/storage/portable_chem_mixer/CtrlClick(mob/living/user)
atom_storage.locked = !atom_storage.locked
if(atom_storage.locked)
atom_storage.locked = STORAGE_NOT_LOCKED
else
atom_storage.locked = STORAGE_FULLY_LOCKED
if (!atom_storage.locked)
update_contents()
if (atom_storage.locked)
+14 -14
View File
@@ -78,16 +78,12 @@
icon_state = "giftbag0"
inhand_icon_state = "giftbag"
w_class = WEIGHT_CLASS_BULKY
storage_type = /datum/storage/backpack/santabag
/obj/item/storage/backpack/santabag/Initialize(mapload)
. = ..()
regenerate_presents()
/obj/item/storage/backpack/santabag/Initialize(mapload)
. = ..()
atom_storage.max_specific_storage = WEIGHT_CLASS_NORMAL
atom_storage.max_total_storage = 60
/obj/item/storage/backpack/santabag/suicide_act(mob/living/user)
user.visible_message(span_suicide("[user] places [src] over [user.p_their()] head and pulls it tight! It looks like [user.p_they()] [user.p_are()]n't in the Christmas spirit..."))
return OXYLOSS
@@ -101,7 +97,7 @@
if(user.mind && HAS_TRAIT(user.mind, TRAIT_CANNOT_OPEN_PRESENTS))
var/turf/floor = get_turf(src)
var/obj/item/thing = new /obj/item/a_gift/anything(floor)
if(!atom_storage.attempt_insert(thing, user, override = TRUE))
if(!atom_storage.attempt_insert(thing, user, override = TRUE, force = STORAGE_SOFT_LOCKED))
qdel(thing)
@@ -395,8 +391,10 @@
inhand_icon_state = "duffel"
actions_types = list(/datum/action/item_action/zipper)
storage_type = /datum/storage/duffel
// How much to slow you down if your bag isn't zipped up
var/zip_slowdown = 1
/// If this bag is zipped (contents hidden) up or not
/// Starts enabled so people need to figure it out to use the thing
/// Starts enabled so you're forced to interact with it to "get" it
var/zipped_up = TRUE
/obj/item/storage/backpack/duffelbag/Initialize(mapload)
@@ -408,6 +406,8 @@
desc = "[initial(desc)]<br>[zipped_up ? "It's zipped up, preventing you from accessing its contents." : "It's unzipped, and harder to move in."]"
/obj/item/storage/backpack/duffelbag/attack_self(mob/user, modifiers)
if(loc != user) // God fuck TK
return ..()
if(zipped_up)
return attack_hand(user, modifiers)
else
@@ -439,9 +439,9 @@
// Vis versa
/obj/item/storage/backpack/duffelbag/attack_hand_secondary(mob/user, list/modifiers)
if(loc != user)
return ..()
if(zipped_up)
if(loc != user)
return ..()
return SECONDARY_ATTACK_CALL_NORMAL
balloon_alert(user, "zipping...")
@@ -462,13 +462,13 @@
zipped_up = new_zip
SEND_SIGNAL(src, COMSIG_DUFFEL_ZIP_CHANGE, new_zip)
if(zipped_up)
slowdown = 0
atom_storage.locked = TRUE
slowdown = initial(slowdown)
atom_storage.locked = STORAGE_SOFT_LOCKED
atom_storage.display_contents = FALSE
atom_storage.close_all()
else
slowdown = 1
atom_storage.locked = FALSE
slowdown = zip_slowdown
atom_storage.locked = STORAGE_NOT_LOCKED
atom_storage.display_contents = TRUE
if(isliving(loc))
@@ -483,7 +483,7 @@
then it might have negative effects on the bag..."
icon_state = "duffel-curse"
inhand_icon_state = "duffel-curse"
slowdown = 2
zip_slowdown = 2
max_integrity = 100
/obj/item/storage/backpack/duffelbag/cursed/Initialize(mapload)
+15 -8
View File
@@ -30,7 +30,10 @@
balloon_alert(user, "broken!")
return
if(allowed(user))
atom_storage.locked = !locked
if(atom_storage.locked)
atom_storage.locked = STORAGE_NOT_LOCKED
else
atom_storage.locked = STORAGE_FULLY_LOCKED
locked = atom_storage.locked
if(locked)
icon_state = icon_locked
@@ -52,7 +55,7 @@
/obj/item/storage/lockbox/emag_act(mob/user)
if(!broken)
broken = TRUE
atom_storage.locked = FALSE
atom_storage.locked = STORAGE_NOT_LOCKED
icon_state = src.icon_broken
if(user)
visible_message(span_warning("\The [src] is broken by [user] with an electromagnetic card!"))
@@ -116,11 +119,12 @@
. += span_notice("Alt-click to [open ? "close":"open"] it.")
/obj/item/storage/lockbox/medal/AltClick(mob/user)
if(user.can_perform_action(src))
if(!atom_storage.locked)
open = (open ? FALSE : TRUE)
update_appearance()
..()
if(!user.can_perform_action(src))
return
if(!atom_storage.locked)
open = (open ? FALSE : TRUE)
update_appearance()
..()
/obj/item/storage/lockbox/medal/PopulateContents()
new /obj/item/clothing/accessory/medal/gold/captain(src)
@@ -244,7 +248,10 @@
balloon_alert(user, "incorrect bank account!")
return
atom_storage.locked = !privacy_lock
if(privacy_lock)
atom_storage.locked = STORAGE_NOT_LOCKED
else
atom_storage.locked = STORAGE_FULLY_LOCKED
privacy_lock = atom_storage.locked
user.visible_message(span_notice("[user] [privacy_lock ? "" : "un"]locks [src]'s privacy lock."),
span_notice("You [privacy_lock ? "" : "un"]lock [src]'s privacy lock."))
+3 -3
View File
@@ -96,14 +96,14 @@
lock_code = entered_code
lock_set = TRUE
else if ((entered_code == lock_code) && lock_set)
atom_storage.locked = FALSE
atom_storage.locked = STORAGE_NOT_LOCKED
update_appearance()
entered_code = null
else
entered_code = "ERROR"
else
if (href_list["type"] == "R")
atom_storage.locked = TRUE
atom_storage.locked = STORAGE_FULLY_LOCKED
update_appearance()
entered_code = null
atom_storage.hide_contents(usr)
@@ -231,7 +231,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/item/storage/secure/safe/caps_spare, 32)
atom_storage.set_holdable(can_hold_list = list(/obj/item/card/id))
lock_code = SSid_access.spare_id_safe_code
lock_set = TRUE
atom_storage.locked = TRUE
atom_storage.locked = STORAGE_FULLY_LOCKED
update_appearance()
/obj/item/storage/secure/safe/caps_spare/PopulateContents()