Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pill bottle emptying bugfix #7357

Merged
merged 2 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 26 additions & 13 deletions code/__DEFINES/equipment.dm
Original file line number Diff line number Diff line change
Expand Up @@ -526,19 +526,32 @@ GLOBAL_LIST_INIT(uniform_categories, list(


// Storage flags
#define STORAGE_ALLOW_EMPTY (1<<0) // Whether the storage object has the 'empty' verb, which dumps all the contents on the floor
#define STORAGE_QUICK_EMPTY (1<<1) // Whether the storage object can quickly be emptied (no delay)
#define STORAGE_QUICK_GATHER (1<<2) // Whether the storage object can quickly collect all items from a tile via the 'toggle mode' verb
#define STORAGE_ALLOW_DRAWING_METHOD_TOGGLE (1<<3) // Whether this storage object can have its items drawn (pouches)
#define STORAGE_USING_DRAWING_METHOD (1<<4) // Whether this storage object has its items drawn (versus just opening it)
#define STORAGE_USING_FIFO_DRAWING (1<<5) // Wether the storage object can have items in it's leftmost slot be drawn
#define STORAGE_CLICK_EMPTY (1<<6) // Whether you can click to empty an item
#define STORAGE_CLICK_GATHER (1<<7) // Whether it is possible to use this storage object in an inverse way,
// so you can have the item in your hand and click items on the floor to pick them up
#define STORAGE_SHOW_FULLNESS (1<<8) // Whether our storage object on hud changes color when full
#define STORAGE_CONTENT_NUM_DISPLAY (1<<9) // Whether the storage object groups contents of the same type and displays them as a number. Only works for slot-based storage objects.
#define STORAGE_GATHER_SIMULTAENOUSLY (1<<10) // Whether the storage object can pick up all the items in a tile
#define STORAGE_ALLOW_QUICKDRAW (1<<11) // Whether the storage can be drawn with E or Holster verb
/// Whether the storage object has the 'empty' verb, which dumps all the contents on the floor
#define STORAGE_ALLOW_EMPTY (1<<0)
/// Whether the storage object can quickly be emptied (no delay)
#define STORAGE_QUICK_EMPTY (1<<1)
/// Whether the storage object can quickly collect all items from a tile via the 'toggle mode' verb
#define STORAGE_QUICK_GATHER (1<<2)
/// Whether this storage object can have its items drawn (pouches)
#define STORAGE_ALLOW_DRAWING_METHOD_TOGGLE (1<<3)
/// Whether this storage object has its items drawn (versus just opening it)
#define STORAGE_USING_DRAWING_METHOD (1<<4)
/// Wether the storage object can have items in it's leftmost slot be drawn
#define STORAGE_USING_FIFO_DRAWING (1<<5)
/// Whether you can click to empty an item
#define STORAGE_CLICK_EMPTY (1<<6)
/// Whether it is possible to use this storage object in an inverse way, so you can have the item in your hand and click items on the floor to pick them up
#define STORAGE_CLICK_GATHER (1<<7)
/// Whether our storage object on hud changes color when full
#define STORAGE_SHOW_FULLNESS (1<<8)
/// Whether the storage object groups contents of the same type and displays them as a number. Only works for slot-based storage objects.
#define STORAGE_CONTENT_NUM_DISPLAY (1<<9)
/// Whether the storage object can pick up all the items in a tile
#define STORAGE_GATHER_SIMULTAENOUSLY (1<<10)
/// Whether the storage can be drawn with E or Holster verb
#define STORAGE_ALLOW_QUICKDRAW (1<<11)
/// Whether using this item will try not to empty it if possible
#define STORAGE_DISABLE_USE_EMPTY (1<<12)

#define STORAGE_FLAGS_DEFAULT (STORAGE_SHOW_FULLNESS|STORAGE_GATHER_SIMULTAENOUSLY|STORAGE_ALLOW_EMPTY)
#define STORAGE_FLAGS_BOX (STORAGE_FLAGS_DEFAULT)
Expand Down
1 change: 1 addition & 0 deletions code/_globalvars/bitfields.dm
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ DEFINE_BITFIELD(storage_flags, list(
"STORAGE_CONTENT_NUM_DISPLAY" = STORAGE_CONTENT_NUM_DISPLAY,
"STORAGE_GATHER_SIMULTAENOUSLY" = STORAGE_GATHER_SIMULTAENOUSLY,
"STORAGE_ALLOW_QUICKDRAW" = STORAGE_ALLOW_QUICKDRAW,
"STORAGE_DISABLE_USE_EMPTY" = STORAGE_DISABLE_USE_EMPTY,
))

DEFINE_BITFIELD(datum_flags, list(
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/storage/firstaid.dm
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@
/obj/item/toy/dice,
/obj/item/paper,
)
storage_flags = STORAGE_FLAGS_BOX|STORAGE_CLICK_GATHER|STORAGE_QUICK_GATHER
storage_flags = STORAGE_FLAGS_BOX|STORAGE_CLICK_GATHER|STORAGE_QUICK_GATHER|STORAGE_DISABLE_USE_EMPTY
storage_slots = null
use_sound = "pillbottle"
max_storage_space = 16
Expand Down Expand Up @@ -759,7 +759,7 @@
max_w_class = 0
max_storage_space = 4
skilllock = SKILL_MEDICAL_DEFAULT
storage_flags = STORAGE_FLAGS_BOX
storage_flags = STORAGE_FLAGS_BOX|STORAGE_DISABLE_USE_EMPTY
display_maptext = FALSE

/obj/item/storage/pill_bottle/packet/Initialize()
Expand Down
3 changes: 2 additions & 1 deletion code/game/objects/items/storage/storage.dm
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,8 @@ W is always an item. stop_warning prevents messaging. user may be null.**/

//Clicking on itself will empty it, if it has contents and the verb to do that. Contents but no verb means nothing happens.
if(length(contents))
empty(user)
if (!(storage_flags & STORAGE_DISABLE_USE_EMPTY))
empty(user)
return

//Otherwise we'll try to fold it.
Expand Down
Loading