storage
This commit is contained in:
@@ -1,13 +1,5 @@
|
||||
/*ALL DEFINES RELATED TO INVENTORY OBJECTS, MANAGEMENT, ETC, GO HERE*/
|
||||
|
||||
//ITEM INVENTORY WEIGHT, FOR w_class
|
||||
#define WEIGHT_CLASS_TINY 1 //Usually items smaller then a human hand, ex: Playing Cards, Lighter, Scalpel, Coins/Money
|
||||
#define WEIGHT_CLASS_SMALL 2 //Pockets can hold small and tiny items, ex: Flashlight, Multitool, Grenades, GPS Device
|
||||
#define WEIGHT_CLASS_NORMAL 3 //Standard backpacks can carry tiny, small & normal items, ex: Fire extinguisher, Stunbaton, Gas Mask, Metal Sheets
|
||||
#define WEIGHT_CLASS_BULKY 4 //Items that can be weilded or equipped but not stored in a normal bag, ex: Defibrillator, Backpack, Space Suits
|
||||
#define WEIGHT_CLASS_HUGE 5 //Usually represents objects that require two hands to operate, ex: Shotgun, Two Handed Melee Weapons - Can not fit in Boh
|
||||
#define WEIGHT_CLASS_GIGANTIC 6 //Essentially means it cannot be picked up or placed in an inventory, ex: Mech Parts, Safe - Can not fit in Boh
|
||||
|
||||
//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
|
||||
|
||||
32
code/__DEFINES/storage.dm
Normal file
32
code/__DEFINES/storage.dm
Normal file
@@ -0,0 +1,32 @@
|
||||
// storage_flags variable on /datum/component/storage
|
||||
|
||||
// Storage limits. These can be combined I guess but you really, really shouldn't (don't do it really)
|
||||
/// Check max_items and contents.len when trying to insert
|
||||
#define STORAGE_LIMIT_MAX_ITEMS (1<<0)
|
||||
/// Check w_class and max_combined_w_class, aka legacy behavior if you combine it with [STORAGE_LIMIT_MAX_ITEMS].
|
||||
#define STORAGE_LIMIT_COMBINED_W_CLASS (1<<1)
|
||||
/// Use max_w_class for maximum w_class but 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)
|
||||
|
||||
//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
|
||||
/// Pockets can hold small and tiny items, ex: Flashlight, Multitool, Grenades, GPS Device
|
||||
#define WEIGHT_CLASS_SMALL 2
|
||||
/// Standard backpacks can carry tiny, small & normal items, ex: Fire extinguisher, Stunbaton, Gas Mask, Metal Sheets
|
||||
#define WEIGHT_CLASS_NORMAL 3
|
||||
/// Items that can be weilded or equipped but not stored in a normal bag, ex: Defibrillator, Backpack, Space Suits
|
||||
#define WEIGHT_CLASS_BULKY 4
|
||||
/// Usually represents objects that require two hands to operate, ex: Shotgun, Two Handed Melee Weapons - Can not fit in Boh
|
||||
#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
|
||||
|
||||
/// Macro for automatically getting the volume of an item from its w_class.
|
||||
#define AUTO_SCALE_VOLUME(w_class) (w_class ** 2)
|
||||
/// Macro for automatically getting the volume of a storage item from its max_w_class and max_items.
|
||||
#define AUTO_SCALE_STORAGE_VOLUME(w_class, max_items) (AUTO_SCALE_VOLUME(w_class) * max_items)
|
||||
|
||||
// UI defines
|
||||
/// Minimum pixels an item must have in volumetric scaled storage UI
|
||||
#define MINIMUM_PIXELS_PER_ITEM 5
|
||||
@@ -3,6 +3,7 @@
|
||||
allow_quick_gather = TRUE
|
||||
allow_quick_empty = TRUE
|
||||
click_gather = TRUE
|
||||
storage_flags = STORAGE_LIMIT_MAX_ITEMS | STORAGE_LIMIT_COMBINED_W_CLASS
|
||||
max_w_class = WEIGHT_CLASS_NORMAL
|
||||
max_combined_w_class = 100
|
||||
max_items = 100
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
//Stack-only storage.
|
||||
/datum/component/storage/concrete/stack
|
||||
display_numerical_stacking = TRUE
|
||||
storage_flags = STORAGE_LIMIT_COMBINED_W_CLASS | STORAGE_LIMIT_MAX_ITEMS
|
||||
var/max_combined_stack_amount = 300
|
||||
max_w_class = WEIGHT_CLASS_NORMAL
|
||||
max_combined_w_class = WEIGHT_CLASS_NORMAL * 14
|
||||
|
||||
@@ -21,9 +21,16 @@
|
||||
|
||||
var/locked = FALSE //when locked nothing can see inside or use it.
|
||||
|
||||
var/max_w_class = WEIGHT_CLASS_SMALL //max size of objects that will fit.
|
||||
var/max_combined_w_class = 14 //max combined sizes of objects that will fit.
|
||||
var/max_items = 7 //max number of objects that will fit.
|
||||
/// Storage flags, including what kinds of limiters we use for how many items we can hold
|
||||
var/storage_flags = STORAGE_LIMIT_VOLUME
|
||||
/// Max w_class we can hold. Applies to [STORAGE_LIMIT_COMBINED_W_CLASS] and [STORAGE_LIMIT_VOLUME]
|
||||
var/max_w_class = WEIGHT_CLASS_SMALL
|
||||
/// Max combined w_class. Applies to [STORAGE_LIMIT_COMBINED_W_CLASS]
|
||||
var/max_combined_w_class = WEIGHT_CLASS_SMALL * 7
|
||||
/// Max items we can hold. Applies to [STORAGE_LIMIT_MAX_ITEMS]
|
||||
var/max_items = 7
|
||||
/// Max volume we can hold. Applies to [STORAGE_LIMIT_VOLUME]. Auto scaled on New() if unset.
|
||||
var/max_volume
|
||||
|
||||
var/emp_shielded = FALSE
|
||||
|
||||
@@ -65,6 +72,8 @@
|
||||
/datum/component/storage/Initialize(datum/component/storage/concrete/master)
|
||||
if(!isatom(parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
if(isnull(max_volume))
|
||||
max_volume = AUTO_SCALE_STORAGE_VOLUME(max_w_class, max_items)
|
||||
if(master)
|
||||
change_master(master)
|
||||
boxes = new(null, src)
|
||||
|
||||
@@ -33,7 +33,12 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE)
|
||||
var/hitsound = null
|
||||
var/usesound = null
|
||||
var/throwhitsound = null
|
||||
|
||||
/// Weight class for how much storage capacity it uses and how big it physically is meaning storages can't hold it if their maximum weight class isn't as high as it.
|
||||
var/w_class = WEIGHT_CLASS_NORMAL
|
||||
/// Volume override for the item, otherwise automatically calculated from w_class.
|
||||
var/volume
|
||||
|
||||
var/total_mass //Total mass in arbitrary pound-like values. If there's no balance reasons for an item to have otherwise, this var should be the item's weight in pounds.
|
||||
var/slot_flags = 0 //This is used to determine on which slots an item can fit.
|
||||
pass_flags = PASSTABLE
|
||||
@@ -850,3 +855,7 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE)
|
||||
if (HAS_TRAIT(src, TRAIT_NODROP))
|
||||
return
|
||||
return ..()
|
||||
|
||||
/// Get an item's volume that it uses when being stored.
|
||||
/obj/item/proc/get_volume()
|
||||
return isnull(volume)? AUTOSCALE_VOLUME(w_class) : volume
|
||||
|
||||
@@ -98,6 +98,7 @@
|
||||
#include "code\__DEFINES\stat.dm"
|
||||
#include "code\__DEFINES\stat_tracking.dm"
|
||||
#include "code\__DEFINES\status_effects.dm"
|
||||
#include "code\__DEFINES\storage.dm"
|
||||
#include "code\__DEFINES\subsystems.dm"
|
||||
#include "code\__DEFINES\tgs.config.dm"
|
||||
#include "code\__DEFINES\tgs.dm"
|
||||
|
||||
Reference in New Issue
Block a user