Helmet Storage Framework (#15615)

This commit is contained in:
Geeves
2023-01-29 12:46:27 +01:00
committed by GitHub
parent 50816b8566
commit 7886e4830c
10 changed files with 112 additions and 5 deletions
@@ -103,6 +103,8 @@ Protectiveness | Armor %
)
contained_sprite = 1
has_storage = FALSE
/obj/item/clothing/head/helmet/bucket/wood
name = "wooden bucket helmet"
icon = 'icons/obj/clothing/material_armor.dmi'
@@ -129,6 +131,7 @@ Protectiveness | Armor %
name = "helmet"
flags_inv = HIDEEARS|HIDEEYES|BLOCKHAIR
default_material = DEFAULT_WALL_MATERIAL
has_storage = FALSE
/obj/item/clothing/head/helmet/material/makeshift
name = "bucket helmet"
@@ -159,4 +162,4 @@ Protectiveness | Armor %
qdel(src)
qdel(kelly)
else
..()
..()
@@ -97,3 +97,36 @@
/obj/item/storage/internal/skrell/Initialize()
. = ..()
name = initial(name)
// Helmet Slots
/obj/item/storage/internal/helmet
var/list/helmet_storage_types = list(
/obj/item/storage/box/fancy/cigarettes = HELMET_GARB_PASS_ICON,
/obj/item/storage/box/fancy/cigarettes/acmeco = HELMET_GARB_PASS_ICON,
/obj/item/storage/box/fancy/cigarettes/blank = HELMET_GARB_PASS_ICON,
/obj/item/storage/box/fancy/cigarettes/dromedaryco = HELMET_GARB_PASS_ICON,
/obj/item/storage/box/fancy/cigarettes/nicotine = HELMET_GARB_PASS_ICON,
/obj/item/storage/box/fancy/cigarettes/rugged = HELMET_GARB_PASS_ICON,
/obj/item/storage/box/fancy/cigarettes/pra = HELMET_GARB_PASS_ICON,
/obj/item/storage/box/fancy/cigarettes/dpra = HELMET_GARB_PASS_ICON,
/obj/item/storage/box/fancy/cigarettes/nka = HELMET_GARB_PASS_ICON
)
can_hold_strict = TRUE
/obj/item/storage/internal/helmet/Initialize(mapload, defer_shrinkwrap)
. = ..()
can_hold = list()
for(var/thing_type in helmet_storage_types)
can_hold += thing_type
/obj/item/storage/internal/helmet/handle_item_insertion(obj/item/W, prevent_messages)
. = ..()
if(. && istype(loc, /obj/item/clothing/head/helmet))
var/obj/item/clothing/head/helmet/helmet = loc
helmet.update_clothing_icon()
/obj/item/storage/internal/helmet/remove_from_storage(obj/item/W, atom/new_location)
. = ..()
if(. && istype(loc, /obj/item/clothing/head/helmet))
var/obj/item/clothing/head/helmet/helmet = loc
helmet.update_clothing_icon()
@@ -17,6 +17,7 @@
icon = 'icons/obj/storage.dmi'
w_class = ITEMSIZE_NORMAL
var/list/can_hold //List of objects which this item can store (if set, it can't store anything else)
var/can_hold_strict = FALSE // if strict, the exact path has to be matched
var/list/cant_hold //List of objects which this item can't store (in effect only if can_hold isn't set)
var/list/is_seeing //List of mobs which are currently seeing the contents of this item's storage
var/max_w_class = ITEMSIZE_NORMAL //Max size of objects that this object can store (in effect only if can_hold isn't set)
@@ -354,7 +355,8 @@
return 0
if(LAZYLEN(can_hold))
if(!is_type_in_list(W, can_hold))
var/can_hold_item = can_hold_strict ? (W.type in can_hold) : is_type_in_list(W, can_hold)
if(!can_hold_item)
if(!stop_messages && ! istype(W, /obj/item/device/hand_labeler))
to_chat(usr, "<span class='notice'>[src] cannot hold \the [W].</span>")
return 0