Adds Cigarette Cases to the loadout. (#20637)

Adds a new item to the smoking loadout tab, an empty metal cigarette
case that can hold 14 cigarettes. Intended to be filled up by rolling
people or those who prefer to keep all of their poison-in-a-stick within
a cute, convenient package.

Fixes an issue wherein the in-hand mob sprites would not display for
cigarette packets and cigar cases, they now do so properly. Modified the
north facing sprites so they don't look out of place (appear BEHIND the
player sprite)

Fixes an issue wherein you could place cigars into smaller cigarette
packets, which became relevant because that meant you could stuff the
cigarette case full of oversized cigars. Now you can only hold cigars in
cigar cases, as you should.

Built for modularity, it should be easy for contributors to add their
own cigarette cases design, and to tweak the existing cigar cases code
to allow for the same handling of open icon states, where multiple
closed icon sprites change to one single batch of open icon sprites,
reducing bloat. Courtesy of Geeves.

While currently out of scope of the P-R, this is intended to be improved
later down the line by allowing you to select which kinds of cigarettes
can spawn in the case in addition to allowing it to start empty, kind of
like how lunch boxes work. Was too complex for me to figure out and
would've taken far longer than needed, but is a planned project for the
future.
This commit is contained in:
shimmeristaken
2025-03-27 11:23:53 +00:00
committed by GitHub
parent 50b908dadc
commit 8db1e0f773
6 changed files with 123 additions and 3 deletions
@@ -295,6 +295,7 @@
slot_l_hand_str = 'icons/mob/items/lefthand_cigs_lighters.dmi',
slot_r_hand_str = 'icons/mob/items/righthand_cigs_lighters.dmi',
)
contained_sprite = FALSE // makes cigarette packets actually visible in hand
drop_sound = 'sound/items/drop/gloves.ogg'
pickup_sound = 'sound/items/pickup/gloves.ogg'
use_sound = 'sound/items/storage/wrapper.ogg'
@@ -303,6 +304,7 @@
slot_flags = SLOT_BELT
storage_slots = 6
can_hold = list(/obj/item/clothing/mask/smokable/cigarette, /obj/item/flame/lighter, /obj/item/trash/cigbutt)
cant_hold = list(/obj/item/clothing/mask/smokable/cigarette/cigar) // prevents cigars from being put in regular cigarettes packs, because thats kind of silly
var/cigarette_to_spawn = /obj/item/clothing/mask/smokable/cigarette
/obj/item/storage/box/fancy/cigarettes/Initialize()
@@ -311,13 +313,17 @@
. = ..()
/obj/item/storage/box/fancy/cigarettes/fill()
for(var/i = 1 to storage_slots)
new cigarette_to_spawn(src)
if(cigarette_to_spawn)
for(var/i = 1 to storage_slots)
new cigarette_to_spawn(src)
/obj/item/storage/box/fancy/cigarettes/update_icon()
. = ..()
if(opened)
icon_state = "[initial(icon_state)][contents.len]"
handle_open_icon()
/obj/item/storage/box/fancy/cigarettes/proc/handle_open_icon()
icon_state = "[initial(icon_state)][contents.len]" // The old open states method, kept here as to not break old packages.
/obj/item/storage/box/fancy/cigarettes/remove_from_storage(obj/item/removed_item, atom/new_location)
var/obj/item/clothing/mask/smokable/cigarette/C = removed_item
@@ -391,6 +397,7 @@
use_sound = 'sound/items/storage/briefcase.ogg'
storage_slots = 8
can_hold = list(/obj/item/clothing/mask/smokable/cigarette/cigar)
cant_hold = list() //allows cigar cases to hold cigars
cigarette_to_spawn = /obj/item/clothing/mask/smokable/cigarette/cigar
chewable = FALSE
@@ -425,6 +432,44 @@
item_state = "Fpacket"
cigarette_to_spawn = /obj/item/clothing/mask/smokable/cigarette/oracle
/obj/item/storage/box/fancy/cigarettes/case
name = "cigarette case"
desc = "A simple cigarette case for the aspiring chain-smoker."
icon_state = "cigarettecase"
item_state = "cigarettecase"
storage_type = "case"
drop_sound = 'sound/items/drop/weldingtool.ogg'
pickup_sound = 'sound/items/pickup/weldingtool.ogg'
use_sound = 'sound/items/storage/briefcase.ogg'
storage_slots = 14
max_storage_space = 14 //A janky but functional solution since I could not figure out how to increase the maximum storage to match how much the case is designed to hold in any other way
cigarette_to_spawn = null
/// Added a new function to allow the base sprite (unopened) to still utilize the regular opened sprites (the ones that go from 0 to 1 to 2 etc etc etc),
/// without needing to add them as separate items in the DMI file. Could be used with the cigar cases in the future if someone chooses to give them new closed sprites for fluff.
/// Also allows contributors to add their own unique cigarette case sprites without adding additional confusing bloat.
/obj/item/storage/box/fancy/cigarettes/case/handle_open_icon()
icon_state = "cigarettecase[contents.len]"
// List of different cigarette cases (unique closed states sprites) - Add new ones here, please
/obj/item/storage/box/fancy/cigarettes/case/mus
name = "decorated cigarette case"
desc = "A fancy cigarette case with some kind of golden inscription on its cover."
icon_state = "cigarettecase_mus"
item_state = "cigarettecase"
/obj/item/storage/box/fancy/cigarettes/case/sol
name = "sol cigarette case"
desc = "A fancy cigarette case with the Solarian emblem on its cover."
icon_state = "cigarettecase_sol"
item_state = "cigarettecase"
/obj/item/storage/box/fancy/cigarettes/case/tc
name = "biesel cigarette case"
desc = "A simple cigarette case with the symbol of the Republic of Biesel on its cover."
icon_state = "cigarettecase_tc"
item_state = "cigarettecase"
/*
* Vial Box
*/