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

[still cursed] Volumetric Storage #2377

Merged
merged 30 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
473f632
if I was a storage_border_3 would you still love me
Sun-Soaked Sep 27, 2023
4ebd2ad
trash bag polishing and balance
Sun-Soaked Sep 27, 2023
71763ff
fixes trash
Sun-Soaked Sep 27, 2023
a80aaf1
why did they do it like this
Sun-Soaked Sep 27, 2023
a12051c
liar
Sun-Soaked Sep 27, 2023
c950244
screaming
Sun-Soaked Sep 27, 2023
c26db2f
crying
Sun-Soaked Sep 27, 2023
2948b3e
balance
Sun-Soaked Sep 28, 2023
5605b7e
oopsies
Sun-Soaked Sep 28, 2023
c837844
I was a stupid
Sun-Soaked Sep 28, 2023
ad4e468
Merge remote-tracking branch 'upstream/master' into gostorageboygo
Sun-Soaked Nov 6, 2023
8919ec9
OOPS
Sun-Soaked Nov 6, 2023
d43b33e
linters...
Sun-Soaked Nov 8, 2023
e7e8c2a
Merge branch 'master' into gostorageboygo
Sun-Soaked Feb 4, 2024
1242fa7
Merge remote-tracking branch 'upstream/master' into gostorageboygo
Sun-Soaked Feb 19, 2024
5d193a7
ouugh
Sun-Soaked Feb 19, 2024
c6eebac
g!
Sun-Soaked Feb 19, 2024
00f3932
whoops
Sun-Soaked Feb 19, 2024
d5bbf0c
fixes port
Sun-Soaked Feb 19, 2024
94e0872
Merge remote-tracking branch 'upstream/master' into gostorageboygo
Sun-Soaked Mar 12, 2024
9be0801
It's over
Sun-Soaked Mar 16, 2024
e1e1851
Merge remote-tracking branch 'upstream/master' into gostorageboygo
Sun-Soaked Mar 17, 2024
ad151fd
fixes
Sun-Soaked Mar 17, 2024
f4b3d00
Merge remote-tracking branch 'upstream/master' into gostorageboygo
Sun-Soaked Mar 21, 2024
ad97474
Merge remote-tracking branch 'upstream/master' into gostorageboygo
Sun-Soaked Mar 24, 2024
42f5b78
yeah.
Sun-Soaked Mar 24, 2024
0780b3c
forgot about these
Sun-Soaked Mar 24, 2024
42a6a49
Merge remote-tracking branch 'upstream/master' into gostorageboygo
Sun-Soaked Apr 3, 2024
bd3b148
temp
Sun-Soaked Apr 7, 2024
75c3c9e
Merge branch 'master' into gostorageboygo
Sun-Soaked May 18, 2024
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
4 changes: 4 additions & 0 deletions code/__DEFINES/dcs/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,10 @@
///from [/obj/structure/closet/supplypod/proc/endlaunch]:
#define COMSIG_SUPPLYPOD_LANDED "supplypodgoboom"

// Item mouse siganls
#define COMSIG_ITEM_MOUSE_EXIT "item_mouse_exit" //from base of obj/item/MouseExited(): (location, control, params)
#define COMSIG_ITEM_MOUSE_ENTER "item_mouse_enter" //from base of obj/item/MouseEntered(): (location, control, params)

///Called when an item is being offered, from [/obj/item/proc/on_offered(mob/living/carbon/offerer)]
#define COMSIG_ITEM_OFFERING "item_offering"
///Interrupts the offer proc
Expand Down
14 changes: 0 additions & 14 deletions code/__DEFINES/inventory.dm
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
/*ALL DEFINES RELATED TO INVENTORY OBJECTS, MANAGEMENT, ETC, GO HERE*/

//ITEM INVENTORY WEIGHT, FOR w_class
/// Usually items smaller then a human hand, (e.g. playing cards, lighter, scalpel, coins/holochips)
#define WEIGHT_CLASS_TINY 1
/// Pockets can hold small and tiny items, (e.g. flashlight, multitool, grenades, GPS device)
#define WEIGHT_CLASS_SMALL 2
/// Standard backpacks can carry tiny, small & normal items, (e.g. fire extinguisher, stun baton, gas mask, metal sheets)
#define WEIGHT_CLASS_NORMAL 3
/// Items that can be weilded or equipped but not stored in an inventory, (e.g. defibrillator, backpack, space suits)
#define WEIGHT_CLASS_BULKY 4
/// Usually represents objects that require two hands to operate, (e.g. shotgun, two-handed melee weapons)
#define WEIGHT_CLASS_HUGE 5
/// Essentially means it cannot be picked up or placed in an inventory, (e.g. mech parts, safe)
#define WEIGHT_CLASS_GIGANTIC 6

//Inventory depth: limits how many nested storage items you can access directly.
//1: stuff in mob, 2: stuff in backpack, 3: stuff in box in backpack, etc
#define INVENTORY_DEPTH 3
Expand Down
18 changes: 14 additions & 4 deletions code/__DEFINES/layers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,22 @@
#define HUD_PLANE 42
#define HUD_LAYER 42
#define HUD_RENDER_TARGET "HUD_PLANE"
#define ABOVE_HUD_PLANE 43
#define ABOVE_HUD_LAYER 43
#define VOLUMETRIC_STORAGE_BOX_PLANE 44
#define VOLUMETRIC_STORAGE_BOX_LAYER 44
#define VOLUMETRIC_STORAGE_BOX_RENDER_TARGET "VOLUME_STORAGE_BOX_PLANE"

#define VOLUMETRIC_STORAGE_ITEM_PLANE 46
#define VOLUMETRIC_STORAGE_ITEM_LAYER 46
#define VOLUMETRIC_STORAGE_ACTIVE_ITEM_LAYER 48
#define VOLUMETRIC_STORAGE_ACTIVE_ITEM_PLANE 48
#define VOLUMETRIC_STORAGE_ITEM_RENDER_TARGET "VOLUME_STORAGE_ITEM_PLANE"

#define ABOVE_HUD_PLANE 50
#define ABOVE_HUD_LAYER 50
#define ABOVE_HUD_RENDER_TARGET "ABOVE_HUD_PLANE"

#define SPLASHSCREEN_LAYER 54
#define SPLASHSCREEN_PLANE 54
#define SPLASHSCREEN_LAYER 75
#define SPLASHSCREEN_PLANE 75

#define ADMIN_POPUP_LAYER 1

Expand Down
88 changes: 88 additions & 0 deletions code/__DEFINES/storage.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// storage_flags variable on /datum/component/storage

// Storage limits. These can be combined (and usually are combined).
/// Check max_items and contents.len when trying to insert
#define STORAGE_LIMIT_MAX_ITEMS (1<<0)
/// Check max_combined_w_class.
#define STORAGE_LIMIT_COMBINED_W_CLASS (1<<1)
/// Use the new volume system. Will automatically force rendering to use the new volume/baystation scaling UI so this is kind of incompatible with stuff like stack storage etc etc.
#define STORAGE_LIMIT_VOLUME (1<<2)
/// Use max_w_class
#define STORAGE_LIMIT_MAX_W_CLASS (1<<3)

#define STORAGE_FLAGS_LEGACY_DEFAULT (STORAGE_LIMIT_MAX_ITEMS | STORAGE_LIMIT_COMBINED_W_CLASS | STORAGE_LIMIT_MAX_W_CLASS)
#define STORAGE_FLAGS_VOLUME_DEFAULT (STORAGE_LIMIT_VOLUME | STORAGE_LIMIT_MAX_W_CLASS)

// UI defines
/// Size of volumetric box icon
#define VOLUMETRIC_STORAGE_BOX_ICON_SIZE 32
/// Size of EACH left/right border icon for volumetric boxes
#define VOLUMETRIC_STORAGE_BOX_BORDER_SIZE 1
/// Minimum pixels an item must have in volumetric scaled storage UI
#define MINIMUM_PIXELS_PER_ITEM 8
/// Maximum number of objects that will be allowed to be displayed using the volumetric display system. Arbitrary number to prevent server lockups.
#define MAXIMUM_VOLUMETRIC_ITEMS 256
/// How much padding to give between items
#define VOLUMETRIC_STORAGE_ITEM_PADDING 3
/// How much padding to give to edges
#define VOLUMETRIC_STORAGE_EDGE_PADDING 1

//ITEM INVENTORY WEIGHT, FOR w_class
/// Usually items smaller then a human hand, ex: Playing Cards, Lighter, Scalpel, Coins/Money
#define WEIGHT_CLASS_TINY 1
/// Fits within a small pocket, ex: Flashlight, Multitool, Grenades, GPS Device
#define WEIGHT_CLASS_SMALL 2
/// Can be carried in one hand comfortably, ex: Fire extinguisher, Stunbaton, Gas Mask, Metal Sheets
#define WEIGHT_CLASS_NORMAL 3
/// Items that can be wielded or equipped, (e.g. defibrillator, space suits). Often fits inside backpacks.
#define WEIGHT_CLASS_BULKY 4
/// Usually represents objects that require two hands to operate, (e.g. shotgun, two-handed melee weapons) May fit on some inventory slots
#define WEIGHT_CLASS_HUGE 5
/// Essentially means it cannot be picked up or placed in an inventory, ex: Mech Parts, Safe - Can not fit in Boh
#define WEIGHT_CLASS_GIGANTIC 6

// PLEASE KEEP ALL VOLUME DEFINES IN THIS FILE, it's going to be hell to keep track of them later.
#define DEFAULT_VOLUME_TINY 1
#define DEFAULT_VOLUME_SMALL 2
#define DEFAULT_VOLUME_NORMAL 6
#define DEFAULT_VOLUME_BULKY 12
#define DEFAULT_VOLUME_HUGE 24
#define DEFAULT_VOLUME_GIGANTIC 48

GLOBAL_LIST_INIT(default_weight_class_to_volume, list(
"[WEIGHT_CLASS_TINY]" = DEFAULT_VOLUME_TINY,
"[WEIGHT_CLASS_SMALL]" = DEFAULT_VOLUME_SMALL,
"[WEIGHT_CLASS_NORMAL]" = DEFAULT_VOLUME_NORMAL,
"[WEIGHT_CLASS_BULKY]" = DEFAULT_VOLUME_BULKY,
"[WEIGHT_CLASS_HUGE]" = DEFAULT_VOLUME_HUGE,
"[WEIGHT_CLASS_GIGANTIC]" = DEFAULT_VOLUME_GIGANTIC
))

/// Macro for automatically getting the volume of an item from its w_class.
#define AUTO_SCALE_VOLUME(w_class) (GLOB.default_weight_class_to_volume["[w_class]"])
/// Macro for automatically getting the volume of a storage item from its max_w_class and max_combined_w_class.
#define AUTO_SCALE_STORAGE_VOLUME(w_class, max_combined_w_class) (AUTO_SCALE_VOLUME(w_class) * (max_combined_w_class / w_class))

// Let's keep all of this in one place. given what we put above anyways..

// volume amount for items
#define ITEM_VOLUME_DISK DEFAULT_VOLUME_TINY
#define ITEM_VOLUME_CONTAINER_M 12 //makes nested toolboxes & toolbelts less efficient
#define ITEM_VOLUME_MOB 40//prevents mob stacking

// #define SAMPLE_VOLUME_AMOUNT 2

// max_weight_class for storages
//
#define MAX_WEIGHT_CLASS_S_CONTAINER WEIGHT_CLASS_SMALL
#define MAX_WEIGHT_CLASS_M_CONTAINER WEIGHT_CLASS_NORMAL
#define MAX_WEIGHT_CLASS_BACKPACK WEIGHT_CLASS_NORMAL
#define MAX_WEIGHT_CLASS_DUFFEL WEIGHT_CLASS_BULKY

// max_volume for storages
#define STORAGE_VOLUME_CONTAINER_S DEFAULT_VOLUME_NORMAL //3 small items
#define STORAGE_VOLUME_CONTAINER_M (DEFAULT_VOLUME_NORMAL * 2) //6 small items
#define STORAGE_VOLUME_SATCHEL (DEFAULT_VOLUME_NORMAL * 4) //4 normal items
#define STORAGE_VOLUME_BACKPACK (DEFAULT_VOLUME_NORMAL * 6) //6 normal items, or 3 bulky items
#define STORAGE_VOLUME_DUFFLEBAG (DEFAULT_VOLUME_NORMAL * 8) // 2 huge items, or 4 bulky items
#define STORAGE_VOLUME_BAG_OF_HOLDING (DEFAULT_VOLUME_NORMAL * 9) //1.5X backpack
2 changes: 1 addition & 1 deletion code/__HELPERS/_lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#define LAZYREMOVE(L, I) if(L) { L -= I; if(!length(L)) { L = null; } }
#define LAZYADD(L, I) if(!L) { L = list(); } L += I;
#define LAZYOR(L, I) if(!L) { L = list(); } L |= I;
#define LAZYFIND(L, V) L ? L.Find(V) : 0
#define LAZYFIND(L, V) (L ? L.Find(V) : 0)
#define LAZYACCESS(L, I) (L ? (isnum(I) ? (I > 0 && I <= length(L) ? L[I] : null) : L[I]) : null)
#define LAZYSET(L, K, V) if(!L) { L = list(); } L[K] = V;
#define LAZYISIN(L, V) (L ? (V in L) : FALSE)
Expand Down
8 changes: 8 additions & 0 deletions code/_globalvars/bitfields.dm
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,14 @@ DEFINE_BITFIELD(zap_flags, list(
"ZAP_OBJ_DAMAGE" = ZAP_OBJ_DAMAGE,
))


DEFINE_BITFIELD(storage_flags, list(
"STORAGE_LIMIT_MAX_ITEMS" = STORAGE_LIMIT_MAX_ITEMS,
"STORAGE_LIMIT_MAX_W_CLASS" = STORAGE_LIMIT_MAX_W_CLASS,
"STORAGE_LIMIT_COMBINED_W_CLASS" = STORAGE_LIMIT_COMBINED_W_CLASS,
"STORAGE_LIMIT_VOLUME" = STORAGE_LIMIT_VOLUME,
))

DEFINE_BITFIELD(bodytype, list(
"BODYTYPE_ORGANIC" = BODYTYPE_ORGANIC,
"BODYTYPE_ROBOTIC" = BODYTYPE_ROBOTIC,
Expand Down
48 changes: 12 additions & 36 deletions code/_onclick/hud/screen_objects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -241,20 +241,20 @@
user.swap_hand(held_index)
return TRUE

/atom/movable/screen/close
name = "close"
layer = ABOVE_HUD_LAYER
plane = ABOVE_HUD_PLANE
icon_state = "backpack_close"
// /atom/movable/screen/close
// name = "close"
// layer = ABOVE_HUD_LAYER
// plane = ABOVE_HUD_PLANE
// icon_state = "backpack_close"

/atom/movable/screen/close/Initialize(mapload, new_master)
. = ..()
master = new_master
// /atom/movable/screen/close/Initialize(mapload, new_master)
// . = ..()
// master = new_master

/atom/movable/screen/close/Click()
var/datum/component/storage/S = master
S.hide_from(usr)
return TRUE
// /atom/movable/screen/close/Click()
// var/datum/component/storage/S = master
// S.hide_from(usr)
// return TRUE

/atom/movable/screen/drop
name = "drop"
Expand Down Expand Up @@ -437,30 +437,6 @@
icon_state = "[base_icon_state][user.resting ? 0 : null]"
return ..()

/atom/movable/screen/storage
name = "storage"
icon_state = "block"
screen_loc = "7,7 to 10,8"
layer = HUD_LAYER
plane = HUD_PLANE

/atom/movable/screen/storage/Initialize(mapload, new_master)
. = ..()
master = new_master

/atom/movable/screen/storage/Click(location, control, params)
if(world.time <= usr.next_move)
return TRUE
if(usr.incapacitated())
return TRUE
if (ismecha(usr.loc)) // stops inventory actions in a mech
return TRUE
if(master)
var/obj/item/I = usr.get_active_held_item()
if(I)
master.attackby(null, I, usr, params)
return TRUE

/atom/movable/screen/throw_catch
name = "throw/catch"
icon = 'icons/hud/screen_midnight.dmi'
Expand Down
Loading
Loading