Skip to content

Commit

Permalink
tweak(storage): adds inspect_state aka opened icons
Browse files Browse the repository at this point in the history
  • Loading branch information
TobyThorne authored Feb 28, 2024
1 parent 9358fe7 commit 4e9ca13
Show file tree
Hide file tree
Showing 22 changed files with 235 additions and 141 deletions.
29 changes: 24 additions & 5 deletions code/game/objects/items/storage/backpack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
)
icon = 'icons/obj/storage/backpacks.dmi'
icon_state = "backpack"
inspect_state = TRUE
item_state = null
w_class = ITEM_SIZE_HUGE
slot_flags = SLOT_BACK
Expand Down Expand Up @@ -68,6 +69,7 @@
desc = "A backpack that opens into a localized pocket of Blue Space."
origin_tech = list(TECH_BLUESPACE = 4)
icon_state = "holdingpack"
inspect_state = FALSE
max_w_class = ITEM_SIZE_GARGANTUAN
max_storage_space = 56

Expand All @@ -87,6 +89,7 @@
desc = "Space Santa uses this to deliver toys to all the nice children in space for Christmas! Wow, it's pretty big!"
icon_state = "giftbag0"
item_state = "giftbag"
inspect_state = FALSE
w_class = ITEM_SIZE_HUGE
max_w_class = ITEM_SIZE_NORMAL
max_storage_space = 400 // can store a ton of shit!
Expand Down Expand Up @@ -235,13 +238,21 @@
icon_state = "satchel"
color = "#3d2711"

/obj/item/storage/backpack/satchel/leather/Initialize()
. = ..()
update_icon()

/obj/item/storage/backpack/satchel/leather/on_update_icon()
ClearOverlays()
AddOverlays(OVERLAY(icon, (being_inspected ? "satchel_overlay-open" : "satchel_overlay"), alpha, RESET_COLOR))

/obj/item/storage/backpack/satchel/leather/khaki
name = "khaki leather satchel"
color = "#baa481"

/obj/item/storage/backpack/satchel/leather/black
name = "black leather satchel"
color = "#212121"
color = "#3F3F3F"

/obj/item/storage/backpack/satchel/leather/navy
name = "navy leather satchel"
Expand All @@ -259,16 +270,21 @@
name = "black pocketbook"
desc = "A neat little folding clasp pocketbook with a shoulder sling."
icon_state = "pocketbook"
w_class = ITEM_SIZE_HUGE // to avoid recursive backpacks
slot_flags = SLOT_BACK
max_w_class = ITEM_SIZE_NORMAL
max_storage_space = DEFAULT_LARGEBOX_STORAGE
color = "#212121"
color = "#3F3F3F"
item_state_slots = list(
slot_l_hand_str = "satchel-flat",
slot_r_hand_str = "satchel-flat",
)

/obj/item/storage/backpack/satchel/pocketbook/Initialize()
. = ..()
update_icon()

/obj/item/storage/backpack/satchel/pocketbook/on_update_icon()
ClearOverlays()
AddOverlays(OVERLAY(icon, (being_inspected ? "pocketbook_overlay-open" : "pocketbook_overlay"), alpha, RESET_COLOR))

/obj/item/storage/backpack/satchel/pocketbook/brown
name = "brown pocketbook"
color = "#3d2711"
Expand Down Expand Up @@ -341,6 +357,7 @@
name = "emergency response team backpack"
desc = "A spacious backpack with lots of pockets, used by members of the Emergency Response Team."
icon_state = "ert_commander"
inspect_state = FALSE
item_state_slots = list(
slot_l_hand_str = "securitypack",
slot_r_hand_str = "securitypack",
Expand Down Expand Up @@ -458,6 +475,7 @@
name = "Space carp backpack"
desc = "It's a backpack made of real space carp."
icon_state = "carppack"
inspect_state = FALSE
item_state_slots = list(
slot_l_hand_str = "backpack",
slot_r_hand_str = "backpack",
Expand All @@ -476,6 +494,7 @@
name = "Spaceship backpack"
desc = "Some say that humanity conquered space inside such things. Today it has obviously broken but looks neat, and you can store your stuff inside."
icon_state = "shipack"
inspect_state = FALSE
item_state_slots = list(
slot_l_hand_str = "shipack",
slot_r_hand_str = "shipack",
Expand Down
51 changes: 38 additions & 13 deletions code/game/objects/items/storage/boxes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,18 @@
icon = 'icons/obj/storage/boxes.dmi'
icon_state = "box"
item_state = "syringe_kit"
inspect_state = "box-open"
max_storage_space = DEFAULT_BOX_STORAGE
var/obj/item/foldable = /obj/item/stack/material/cardboard // BubbleWrap - if set, can be folded (when empty) into a sheet of cardboard
use_sound = SFX_SEARCH_CLOTHES

drop_sound = SFX_DROP_CARDBOARD
pickup_sound = SFX_PICKUP_CARDBOARD

/obj/item/storage/box/large
name = "large box"
icon_state = "largebox"
w_class = ITEM_SIZE_LARGE
max_w_class = ITEM_SIZE_NORMAL
max_storage_space = DEFAULT_LARGEBOX_STORAGE
/obj/item/storage/box/on_update_icon()
ClearOverlays()
if(being_inspected && istext(inspect_state))
AddOverlays(OVERLAY(icon, inspect_state))

// BubbleWrap - A box can be folded up to make card
/obj/item/storage/box/attack_self(mob/user)
Expand Down Expand Up @@ -74,10 +73,20 @@
..()
foldable = null //special form fitted boxes should not be foldable.


/obj/item/storage/box/large
name = "large box"
icon_state = "largebox"
inspect_state = "large-open"
w_class = ITEM_SIZE_LARGE
max_w_class = ITEM_SIZE_NORMAL
max_storage_space = DEFAULT_LARGEBOX_STORAGE

/obj/item/storage/box/survival
name = "crew survival kit"
desc = "A durable plastic box decorated in warning colors that contains a limited supply of survival tools. The panel and white stripe indicate this one contains oxygen. It has special foldlines, making it able to be folded into an emergency crowbar."
icon_state = "survival"
inspect_state = "survival-open"
foldable = /obj/item/crowbar/emergency
startswith = list(/obj/item/clothing/mask/breath = 1,
/obj/item/tank/emergency/oxygen = 1,
Expand All @@ -90,6 +99,7 @@
name = "vox survival kit"
desc = "A durable plastic box decorated in warning colors that contains a limited supply of survival tools. The panel and black stripe indicate this one contains nitrogen. It has special foldlines, making it able to be folded into an emergency crowbar."
icon_state = "survivalvox"
inspect_state = "survival-open"
foldable = /obj/item/crowbar/emergency/vox
startswith = list(/obj/item/clothing/mask/breath = 1,
/obj/item/tank/emergency/nitrogen = 1,
Expand All @@ -101,6 +111,7 @@
name = "engineer survival kit"
desc = "A durable plastic box decorated in warning colors that contains a limited supply of survival tools. The panel and orange stripe indicate this one as the engineering variant. It has special foldlines, making it able to be folded into an emergency crowbar."
icon_state = "survivaleng"
inspect_state = "survival-open"
foldable = /obj/item/crowbar/emergency/eng
startswith = list(/obj/item/clothing/mask/breath = 1,
/obj/item/tank/emergency/oxygen/engi = 1,
Expand All @@ -114,6 +125,7 @@
name = "security survival kit"
desc = "A durable plastic box decorated in warning colors that contains a limited supply of survival tools. The panel and red & black stripe indicate this one as the security variant. It has special foldlines, making it able to be folded into an emergency crowbar."
icon_state = "survivalsec"
inspect_state = "survival-open"
foldable = /obj/item/crowbar/emergency/sec
startswith = list(/obj/item/clothing/mask/breath = 1,
/obj/item/tank/emergency/oxygen = 1,
Expand Down Expand Up @@ -174,19 +186,19 @@
max_storage_space = 20
drop_sound = SFX_DROP_AMMOBOX
pickup_sound = SFX_PICKUP_AMMOBOX
inspect_state = FALSE

/obj/item/storage/box/shotgun/on_update_icon()
. = ..()

ClearOverlays()

for (var/i = 1, i < contents.len, i++)
if (i == 1 || i % 3 == 0)
var/icon/I = icon(icon, "[contents[i].icon_state]")
if(!length(contents))
return

if (i != 1)
for(var/i = 1, i < contents.len, i++)
if(i == 1 || i % 3 == 0)
var/icon/I = icon(icon, "[contents[i].icon_state]")
if(i != 1)
I.Shift(WEST, i)

AddOverlays(I)

/obj/item/storage/box/shotgun/shells
Expand Down Expand Up @@ -236,6 +248,7 @@
name = "box of flashbangs"
desc = "A box containing 7 antipersonnel flashbang grenades.<br> WARNING: These devices are extremely dangerous and can cause blindness or deafness from repeated use."
icon_state = "flashbang"
inspect_state = "sec-open"
startswith = list(/obj/item/grenade/flashbang = 7)
drop_sound = SFX_DROP_AMMOBOX
pickup_sound = SFX_PICKUP_AMMOBOX
Expand All @@ -244,6 +257,7 @@
name = "box of pepperspray grenades"
desc = "A box containing 7 tear gas grenades. A gas mask is printed on the label.<br> WARNING: Exposure carries risk of serious injury or death. Keep away from persons with lung conditions."
icon_state = "peppers"
inspect_state = "sec-open"
startswith = list(/obj/item/grenade/chem_grenade/teargas = 7)
drop_sound = SFX_DROP_AMMOBOX
pickup_sound = SFX_PICKUP_AMMOBOX
Expand All @@ -252,6 +266,7 @@
name = "box of emp grenades"
desc = "A box containing 5 military grade EMP grenades.<br> WARNING: Do not use near unshielded electronics or biomechanical augmentations, death or permanent paralysis may occur."
icon_state = "EMPs"
inspect_state = "sec-open"
startswith = list(/obj/item/grenade/empgrenade = 5)
drop_sound = SFX_DROP_AMMOBOX
pickup_sound = SFX_PICKUP_AMMOBOX
Expand All @@ -260,6 +275,7 @@
name = "box of frag grenades"
desc = "A box containing 5 military grade fragmentation grenades.<br> WARNING: Live explosives. Misuse may result in serious injury or death."
icon_state = "frags"
inspect_state = "sec-open"
startswith = list(/obj/item/grenade/frag = 5)
drop_sound = SFX_DROP_AMMOBOX
pickup_sound = SFX_PICKUP_AMMOBOX
Expand All @@ -268,6 +284,7 @@
name = "box of frag shells"
desc = "A box containing 5 military grade fragmentation shells.<br> WARNING: Live explosive munitions. Misuse may result in serious injury or death."
icon_state = "fragshells"
inspect_state = "sec-open"
startswith = list(/obj/item/grenade/frag/shell = 5)
drop_sound = SFX_DROP_AMMOBOX
pickup_sound = SFX_PICKUP_AMMOBOX
Expand All @@ -276,6 +293,7 @@
name = "box of smoke bombs"
desc = "A box containing 5 smoke bombs."
icon_state = "smokebombs"
inspect_state = "sec-open"
startswith = list(/obj/item/grenade/smokebomb = 5)
drop_sound = SFX_DROP_AMMOBOX
pickup_sound = SFX_PICKUP_AMMOBOX
Expand All @@ -284,6 +302,7 @@
name = "box of anti-photon grenades"
desc = "A box containing 5 experimental photon disruption grenades."
icon_state = "antiphotons"
inspect_state = "sec-open"
startswith = list(/obj/item/grenade/anti_photon = 5)
drop_sound = SFX_DROP_AMMOBOX
pickup_sound = SFX_PICKUP_AMMOBOX
Expand Down Expand Up @@ -355,6 +374,7 @@
desc = "Drymate brand monkey cubes. Just add water!"
icon = 'icons/obj/food.dmi'
icon_state = "monkeycubebox"
inspect_state = TRUE
can_hold = list(/obj/item/reagent_containers/food/monkeycube)
startswith = list(/obj/item/reagent_containers/food/monkeycube/wrapped = 5)

Expand Down Expand Up @@ -389,12 +409,14 @@
name = "box of spare R.O.B.U.S.T. Cartridges"
desc = "A box full of R.O.B.U.S.T. Cartridges, used by Security."
icon_state = "seccarts"
inspect_state = "sec-open"
startswith = list(/obj/item/cartridge/security = 7)

/obj/item/storage/box/handcuffs
name = "box of spare handcuffs"
desc = "A box full of handcuffs."
icon_state = "handcuff"
inspect_state = "sec-open"
startswith = list(/obj/item/handcuffs = 7)

/obj/item/storage/box/mousetraps
Expand All @@ -417,6 +439,7 @@
desc = "Eight wrappers of fun! Ages 8 and up. Not suitable for children."
icon = 'icons/obj/toy.dmi'
icon_state = "spbox"
inspect_state = TRUE
can_hold = list(/obj/item/toy/snappop)
startswith = list(/obj/item/toy/snappop = 8)

Expand All @@ -426,6 +449,7 @@
icon = 'icons/obj/cigarettes.dmi'
icon_state = "matchbox"
item_state = "zippo"
inspect_state = FALSE
w_class = ITEM_SIZE_TINY
slot_flags = SLOT_BELT
can_hold = list(/obj/item/flame/match)
Expand Down Expand Up @@ -565,6 +589,7 @@
icon = 'icons/obj/storage/misc.dmi'
icon_state = "portafreezer"
item_state = "portafreezer"
inspect_state = TRUE
foldable = null
max_w_class = ITEM_SIZE_NORMAL
w_class = ITEM_SIZE_HUGE
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/items/storage/briefcase.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
desc = "It's made of AUTHENTIC faux-leather and has a price-tag still attached. Its owner must be a real professional."
icon_state = "briefcase"
item_state = "briefcase"
inspect_state = TRUE
obj_flags = OBJ_FLAG_CONDUCTIBLE
force = 8.0
throw_range = 4
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/items/storage/fancy.dm
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@
icon = 'icons/obj/vialbox.dmi'
icon_state = "vialbox0"
item_state = "syringe_kit"
inspect_state = FALSE
w_class = ITEM_SIZE_NORMAL
max_w_class = ITEM_SIZE_TINY
max_storage_space = null
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/items/storage/firstaid.dm
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
desc = "Contains tools for surgery. Has precise foam fitting for safe transport and automatically sterilizes the content between uses."
icon_state = "surgerykit"
item_state = "firstaid-surgery"
inspect_state = TRUE

storage_slots = 14
max_w_class = ITEM_SIZE_NORMAL
Expand Down
14 changes: 2 additions & 12 deletions code/game/objects/items/storage/garment.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
desc = "A bag for storing multiple clothig items in a better and convenient way!"

icon = 'icons/obj/storage/misc.dmi'
icon_state = "garment0"
icon_state = "garment"

can_hold = list(
/obj/item/clothing
Expand All @@ -17,17 +17,7 @@
allow_quick_empty = TRUE
allow_quick_gather = TRUE

/obj/item/storage/garment/Initialize()
. = ..()

register_signal(src, SIGNAL_STORAGE_OPENED, nameof(.proc/on_storage_opened))
register_signal(src, SIGNAL_STORAGE_CLOSED, nameof(.proc/on_storage_closed))

/obj/item/storage/garment/proc/on_storage_opened(obj/item/storage/source, mob/user)
icon_state = "garment1"

/obj/item/storage/garment/proc/on_storage_closed(obj/item/storage/source, mob/user)
icon_state = "garment0"
inspect_state = TRUE

/obj/item/storage/garment/hos
name = "head of security's garment bag"
Expand Down
Loading

0 comments on commit 4e9ca13

Please sign in to comment.