Skip to content

Commit

Permalink
storage rewrite (#6284)
Browse files Browse the repository at this point in the history
Co-authored-by: silicons <[email protected]>
  • Loading branch information
silicons and silicons authored Feb 17, 2024
1 parent f073efb commit 383308a
Show file tree
Hide file tree
Showing 585 changed files with 4,828 additions and 3,890 deletions.
20 changes: 11 additions & 9 deletions citadel.dme
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
#include "code\__DEFINES\icon_smoothing.dm"
#include "code\__DEFINES\ingredients.dm"
#include "code\__DEFINES\instruments.dm"
#include "code\__DEFINES\inventory_storage.dm"
#include "code\__DEFINES\is_helpers.dm"
#include "code\__DEFINES\items_clothing.dm"
#include "code\__DEFINES\loadout.dm"
Expand Down Expand Up @@ -87,7 +86,6 @@
#include "code\__DEFINES\spells.dm"
#include "code\__DEFINES\stat_tracking.dm"
#include "code\__DEFINES\statpanel.dm"
#include "code\__DEFINES\storage.dm"
#include "code\__DEFINES\targeting.dm"
#include "code\__DEFINES\text.dm"
#include "code\__DEFINES\tgs.config.dm"
Expand Down Expand Up @@ -162,7 +160,6 @@
#include "code\__DEFINES\dcs\signals\signals_fish.dm"
#include "code\__DEFINES\dcs\signals\signals_global.dm"
#include "code\__DEFINES\dcs\signals\signals_object.dm"
#include "code\__DEFINES\dcs\signals\signals_storage.dm"
#include "code\__DEFINES\dcs\signals\signals_turf.dm"
#include "code\__DEFINES\dcs\signals\datums\signals_beam.dm"
#include "code\__DEFINES\dcs\signals\datums\signals_perspective.dm"
Expand All @@ -185,6 +182,8 @@
#include "code\__DEFINES\dcs\signals\signals_atom\tool_system.dm"
#include "code\__DEFINES\dcs\signals\signals_item\signals_item_economy.dm"
#include "code\__DEFINES\dcs\signals\signals_item\signals_item_inventory.dm"
#include "code\__DEFINES\dcs\signals\signals_item\signals_item_mouse.dm"
#include "code\__DEFINES\dcs\signals\signals_item\signals_item_storage.dm"
#include "code\__DEFINES\dcs\signals\signals_mob\signals_mob_appearance.dm"
#include "code\__DEFINES\dcs\signals\signals_mob\signals_mob_combat.dm"
#include "code\__DEFINES\dcs\signals\signals_mob\signals_mob_defense.dm"
Expand All @@ -209,6 +208,7 @@
#include "code\__DEFINES\inventory\procs.dm"
#include "code\__DEFINES\inventory\rendering.dm"
#include "code\__DEFINES\inventory\slots.dm"
#include "code\__DEFINES\inventory\storage.dm"
#include "code\__DEFINES\items\hypospray.dm"
#include "code\__DEFINES\items\inducer.dm"
#include "code\__DEFINES\items\nifs.dm"
Expand Down Expand Up @@ -367,6 +367,7 @@
#include "code\__HELPERS\files\hashing.dm"
#include "code\__HELPERS\files\paths.dm"
#include "code\__HELPERS\files\walk.dm"
#include "code\__HELPERS\game\depth.dm"
#include "code\__HELPERS\graphs\astar.dm"
#include "code\__HELPERS\icons\alpha.dm"
#include "code\__HELPERS\icons\color.dm"
Expand Down Expand Up @@ -1663,25 +1664,25 @@
#include "code\game\objects\items\stock_parts\part_replacer.dm"
#include "code\game\objects\items\stock_parts\scanning_module.dm"
#include "code\game\objects\items\stock_parts\subspace.dm"
#include "code\game\objects\items\storage\_storage.dm"
#include "code\game\objects\items\storage\backpack.dm"
#include "code\game\objects\items\storage\bags.dm"
#include "code\game\objects\items\storage\belt.dm"
#include "code\game\objects\items\storage\bible.dm"
#include "code\game\objects\items\storage\boxes.dm"
#include "code\game\objects\items\storage\briefcase.dm"
#include "code\game\objects\items\storage\fancy.dm"
#include "code\game\objects\items\storage\internal.dm"
#include "code\game\objects\items\storage\laundry_basket.dm"
#include "code\game\objects\items\storage\lockbox.dm"
#include "code\game\objects\items\storage\misc.dm"
#include "code\game\objects\items\storage\quickdraw.dm"
#include "code\game\objects\items\storage\secure.dm"
#include "code\game\objects\items\storage\storage.dm"
#include "code\game\objects\items\storage\toolbox.dm"
#include "code\game\objects\items\storage\uplink_kits.dm"
#include "code\game\objects\items\storage\wallets.dm"
#include "code\game\objects\items\storage\medical\firstaid.dm"
#include "code\game\objects\items\storage\medical\hypokit.dm"
#include "code\game\objects\items\storage\misc_legacy\bible.dm"
#include "code\game\objects\items\storage\misc_legacy\fancy.dm"
#include "code\game\objects\items\storage\misc_legacy\laundry_basket.dm"
#include "code\game\objects\items\storage\misc_legacy\misc.dm"
#include "code\game\objects\items\storage\misc_legacy\trinket_box.dm"
#include "code\game\objects\items\storage\single_use\_single_use.dm"
#include "code\game\objects\items\storage\single_use\med_pouch.dm"
#include "code\game\objects\items\storage\single_use\mre.dm"
Expand Down Expand Up @@ -1921,6 +1922,7 @@
#include "code\game\objects\structures\tables\update_triggers.dm"
#include "code\game\objects\systems\_system.dm"
#include "code\game\objects\systems\cell_slot.dm"
#include "code\game\objects\systems\storage.dm"
#include "code\game\rendering\client.dm"
#include "code\game\rendering\mob.dm"
#include "code\game\rendering\screen.dm"
Expand Down
29 changes: 19 additions & 10 deletions code/__DEFINES/_planes+layers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -342,16 +342,16 @@
#define VERTICALITY_PLANE 40

/**
*! -- Fullscreen Plane
*? Fullscreen overlays.
*! -- Camera Mask Plane
*/
#define FULLSCREEN_PLANE 90
#define CAMERA_MASK_PLANE 70
#define CAMERA_MASK_LAYER_MAIN 1

/**
*! -- Sonar Plane
*? Used for renders for effects like sonar / sensory things
*! -- Fullscreen Plane
*? Fullscreen overlays.
*/
#define SONAR_PLANE 91 // 91 because 90 is the Blind plane, and you should be able to use your ears when your eyes don't work
#define FULLSCREEN_PLANE 75

#define FULLSCREEN_LAYER_OBFUSCATION 19.9
#define FULLSCREEN_LAYER_MAIN 20.1
Expand All @@ -361,10 +361,11 @@
#define FULLSCREEN_LAYER_CURSE 20.5

/**
*! -- Camera Mask Plane
*! -- Sonar Plane
*? Used for renders for effects like sonar / sensory things
* todo: this needs to be under fullscreen plane but above blind.
*/
#define CAMERA_MASK_PLANE 92
#define CAMERA_MASK_LAYER_MAIN 1
#define SONAR_PLANE 80

/**
*! -- Player HUD Plane
Expand All @@ -373,13 +374,21 @@
*
* todo: some layers are unused?
*/
#define HUD_PLANE 95
#define HUD_PLANE 90

#define HUD_LAYER_UNDER 1 /// Under the HUD items.
#define HUD_LAYER_BASE 2 /// The HUD items themselves.
#define HUD_LAYER_ITEM 3 /// Things sitting on HUD items (largely irrelevant because INVENTORY_PLANE).
#define HUD_LAYER_ABOVE 4 /// Things that reside above items (highlights).

/**
*! -- Storage Plane
*/
#define STORAGE_PLANE 95
#define STORAGE_LAYER_CONTAINER 1
#define STORAGE_LAYER_ITEM_INACTIVE 2
#define STORAGE_LAYER_ITEM_ACTIVE 3

/**
*! -- Player HUD Items Plane
*? Separate layer with which to apply colorblindness.
Expand Down
3 changes: 2 additions & 1 deletion code/__DEFINES/combat/atom_damage.dm
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2023 Citadel Station developers. *//

//! Atom destruction types, used in /deconstruct() and its derived/child/called functions.
//* Atom destruction types, used in /deconstruct() and its derived/child/called functions.

/// Atom was neatly deconstructed
#define ATOM_DECONSTRUCT_DISASSEMBLED 0
/// Atom received excess kinetic energy, usually through weaponry
Expand Down
18 changes: 18 additions & 0 deletions code/__DEFINES/dcs/signals/signals_atom/context_system.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,30 @@
#define RAISE_ATOM_CONTEXT_ACT_HANDLED (1<<0)

/// create context
/// todo: this is deprecated, i think.
/// * name: name
/// * image: context menu image
/// * distance: distance where this is valid; much be reachable or actable; null = requires adjacency or adjacency-equivalence
/// * mobility: mobility flags required
#define ATOM_CONTEXT_TUPLE(name, image, distance, mobility) list(name, image, distance, mobility)

/// Creates context list
///
/// @params
/// * name: name
/// * image: context menu image
/// * distance: distance where this is valid; much be reachable or actable; null = requires adjacency or adjacency-equivalence
/// * mobility: mobility flags required
/// * defaultable: allow defaulting if this is the only thing in the list
/atom/proc/atom_context_tuple(name, image/I, distance, mobility, defaultable)
return list(
name,
I,
distance,
mobility,
defaultable,
)

/// when used as distance, telekinetics and other things do not count as adjacency
// todo: currently not implemented
#define ATOM_CONTEXT_FORCE_PHYSICAL_ADJACENCY null
2 changes: 0 additions & 2 deletions code/__DEFINES/dcs/signals/signals_atom/signals_atom_main.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
#define EXAMINE_POSITION_BEFORE (1<<1)
//*End positions
#define COMPONENT_EXNAME_CHANGED (1<<0)
/// From base of atom/handle_atom_del(): (atom/deleted)
////#define COMSIG_ATOM_CONTENTS_DEL "atom_contents_del"
/// From base of atom/has_gravity(): (turf/location, list/forced_gravities)
////#define COMSIG_ATOM_HAS_GRAVITY "atom_has_gravity"
/// For when an atom has been created through processing (atom/original_atom, list/chosen_processing_option)
Expand Down
3 changes: 0 additions & 3 deletions code/__DEFINES/dcs/signals/signals_atom/signals_atom_mouse.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
/// From base of atom/AltClick(): (/mob)
#define COMSIG_CLICK_ALT "alt_click"
#define COMPONENT_CANCEL_CLICK_ALT (1<<0)
/// From base of atom/alt_click_secondary(): (/mob)
////#define COMSIG_CLICK_ALT_SECONDARY "alt_click_secondary"
////#define COMPONENT_CANCEL_CLICK_ALT_SECONDARY (1<<0)
/// From base of atom/CtrlShiftClick(/mob)
////#define COMSIG_CLICK_CTRL_SHIFT "ctrl_shift_click"
/// From base of atom/OnMouseDrop(): (/atom/over, /mob/user, proximity, params)
Expand Down
8 changes: 8 additions & 0 deletions code/__DEFINES/dcs/signals/signals_item/signals_item_mouse.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2023 Citadel Station developers. *//

/// from base of item/MouseEntered: (usr)
#define COMSIG_ITEM_MOUSE_ENTERED "item_mouse_enter"

/// from base of item/MouseExited: (usr)
#define COMSIG_ITEM_MOUSE_EXITED "item_mouse_exit"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

/// From base of obj/item/on_enter_storage(): (datum/object_system/storage/storage)
#define COMSIG_STORAGE_ENTERED "storage_entered"
/// From base of obj/item/on_exit_storage(): (datum/object_system/storage/storage)
#define COMSIG_STORAGE_EXITED "storage_exited"
38 changes: 0 additions & 38 deletions code/__DEFINES/dcs/signals/signals_storage.dm

This file was deleted.

1 change: 1 addition & 0 deletions code/__DEFINES/inventory/misc.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// proc: dropped() on /obj/item
// todo: this should be in procs.dm and the names need to be changed probably
/// relocated; return false
#define ITEM_RELOCATED_BY_DROPPED -1
91 changes: 91 additions & 0 deletions code/__DEFINES/inventory/storage.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2023 Citadel Station developers. *//

//* Storage 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 2
/// Minimum pixels an item must have in volumetric scaled storage UI
/// This must not be smaller than BOX_BORDER_SIZE * 2.
#define VOLUMETRIC_STORAGE_MINIMUM_PIXELS_PER_ITEM 6
/// Maximum number of objects that will be allowed to be displayed using the volumetric display system. Arbitrary number to prevent server lockups.
#define VOLUMETRIC_STORAGE_MAX_ITEMS 128
/// How much padding to give between items
#define VOLUMETRIC_STORAGE_ITEM_PADDING 1
/// How much padding to give to edges
#define VOLUMETRIC_STORAGE_EDGE_PADDING 0
/// Standard pixel width ratio for volumetric storage; 1 volume converts into this many pixels.
#define VOLUMETRIC_STORAGE_STANDARD_PIXEL_RATIO 8

//* Storage access *//

#define STORAGE_REACH_DEPTH 3

//* Storage quick gather modes *//

/// one at a time on click
#define STORAGE_QUICK_GATHER_COLLECT_ONE 1
/// all on tile
#define STORAGE_QUICK_GATHER_COLLECT_ALL 2
/// same typepath
#define STORAGE_QUICK_GATHER_COLLECT_SAME 3

//* Storage UI - we shouldn't hardcode this but I don't care. *//
// todo: we should care

#define STORAGE_UI_START_TILE_X 3
#define STORAGE_UI_START_TILE_Y 1
#define STORAGE_UI_START_PIXEL_X 16
#define STORAGE_UI_START_PIXEL_Y 16
#define STORAGE_UI_TILES_FOR_SCREEN_VIEW_X(X) max(4, X - 8)
#define STORAGE_UI_MAX_ROWS 5

//* w_class *//

// ITEM INVENTORY WEIGHT, FOR w_class
// todo: lmao this is so outdated, semantically
// keep this 1 to n, and make sure w_class_to_volume is updated.

#define WEIGHT_CLASS_MIN 0
#define WEIGHT_CLASS_MAX 6

/// 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

//* Volumetrics - Default Item Volumes *//

#define WEIGHT_VOLUME_TINY 1
#define WEIGHT_VOLUME_SMALL 2
#define WEIGHT_VOLUME_NORMAL 4
#define WEIGHT_VOLUME_BULKY 8
#define WEIGHT_VOLUME_HUGE 16
#define WEIGHT_VOLUME_GIGANTIC 32

GLOBAL_REAL_LIST(w_class_to_volume) = list(
WEIGHT_VOLUME_TINY,
WEIGHT_VOLUME_SMALL,
WEIGHT_VOLUME_NORMAL,
WEIGHT_VOLUME_BULKY,
WEIGHT_VOLUME_HUGE,
WEIGHT_VOLUME_GIGANTIC,
)

//* Volumetrics - Storage Volumes *//

#define STORAGE_VOLUME_BOX (WEIGHT_VOLUME_SMALL * 7)
#define STORAGE_VOLUME_BACKPACK (WEIGHT_VOLUME_NORMAL * 7)
#define STORAGE_VOLUME_DUFFLEBAG (WEIGHT_VOLUME_NORMAL * 9)

//* Volumetrics - Item Volumes *//
Loading

0 comments on commit 383308a

Please sign in to comment.