From 154e145e2582b1d741d9735ff498b50bbbf66d92 Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Mon, 6 Apr 2020 18:40:20 -0700 Subject: [PATCH 01/30] storage --- code/__DEFINES/inventory.dm | 8 ----- code/__DEFINES/storage.dm | 32 +++++++++++++++++++ .../components/storage/concrete/rped.dm | 1 + .../components/storage/concrete/stack.dm | 1 + code/datums/components/storage/storage.dm | 15 +++++++-- code/game/objects/items.dm | 9 ++++++ tgstation.dme | 1 + 7 files changed, 56 insertions(+), 11 deletions(-) create mode 100644 code/__DEFINES/storage.dm diff --git a/code/__DEFINES/inventory.dm b/code/__DEFINES/inventory.dm index 2756be76fb..2aba7b496b 100644 --- a/code/__DEFINES/inventory.dm +++ b/code/__DEFINES/inventory.dm @@ -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 diff --git a/code/__DEFINES/storage.dm b/code/__DEFINES/storage.dm new file mode 100644 index 0000000000..065551b975 --- /dev/null +++ b/code/__DEFINES/storage.dm @@ -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 diff --git a/code/datums/components/storage/concrete/rped.dm b/code/datums/components/storage/concrete/rped.dm index 2f95466238..1e609c4107 100644 --- a/code/datums/components/storage/concrete/rped.dm +++ b/code/datums/components/storage/concrete/rped.dm @@ -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 diff --git a/code/datums/components/storage/concrete/stack.dm b/code/datums/components/storage/concrete/stack.dm index 1f0c44c650..76c7bc2af5 100644 --- a/code/datums/components/storage/concrete/stack.dm +++ b/code/datums/components/storage/concrete/stack.dm @@ -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 diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm index 55e5c03c2b..e8fe8c6698 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -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) diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 78dde8d206..278c8bccbc 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -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 diff --git a/tgstation.dme b/tgstation.dme index 7d64b2ce7f..6cf1d09437 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -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" From 7ec669ecd493940f383f08f19f2518fbd4782301 Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Tue, 7 Apr 2020 16:11:58 -0700 Subject: [PATCH 02/30] bet --- code/__DEFINES/dcs/signals.dm | 1 + code/__DEFINES/storage.dm | 2 + code/_onclick/hud/screen_objects.dm | 38 --- code/_onclick/hud/screen_objects/storage.dm | 41 ++++ code/datums/components/storage/storage.dm | 141 ++--------- code/datums/components/storage/ui.dm | 259 ++++++++++++++++++++ code/modules/mob/logout.dm | 1 + icons/mob/screen_gen.dmi | Bin 118425 -> 118971 bytes 8 files changed, 326 insertions(+), 157 deletions(-) create mode 100644 code/_onclick/hud/screen_objects/storage.dm create mode 100644 code/datums/components/storage/ui.dm diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index 1ef8b9bb66..6255319a08 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -190,6 +190,7 @@ #define COMSIG_LIVING_MINOR_SHOCK "living_minor_shock" //sent by stuff like stunbatons and tasers: () #define COMSIG_LIVING_REVIVE "living_revive" //from base of mob/living/revive() (full_heal, admin_revive) #define COMSIG_MOB_CLIENT_LOGIN "comsig_mob_client_login" //sent when a mob/login() finishes: (client) +#define COMSIG_MOB_CLIENT_LOGOUT "comsig_mob_client_logout" //sent when a mob/logout() starts: (client) #define COMSIG_MOB_CLIENT_MOVE "comsig_mob_client_move" //sent when client/Move() finishes with no early returns: (client, direction, n, oldloc) #define COMSIG_LIVING_GUN_PROCESS_FIRE "living_gun_process_fire" //from base of /obj/item/gun/proc/process_fire(): (atom/target, params, zone_override) #define COMSIG_LIVING_COMBAT_ENABLED "combatmode_enabled" //from base of mob/living/enable_combat_mode() (was_forced) diff --git a/code/__DEFINES/storage.dm b/code/__DEFINES/storage.dm index 065551b975..27bf502252 100644 --- a/code/__DEFINES/storage.dm +++ b/code/__DEFINES/storage.dm @@ -30,3 +30,5 @@ // UI defines /// Minimum pixels an item must have in volumetric scaled storage UI #define MINIMUM_PIXELS_PER_ITEM 5 +/// 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 diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index f5eb8535a5..4ed286eb08 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -210,20 +210,6 @@ user.swap_hand(held_index) return TRUE -/obj/screen/close - name = "close" - layer = ABOVE_HUD_LAYER - plane = ABOVE_HUD_PLANE - icon_state = "backpack_close" - -/obj/screen/close/Initialize(mapload, new_master) - . = ..() - master = new_master - -/obj/screen/close/Click() - var/datum/component/storage/S = master - S.hide_from(usr) - return TRUE /obj/screen/drop name = "drop" @@ -406,30 +392,6 @@ else icon_state = "act_rest0" -/obj/screen/storage - name = "storage" - icon_state = "block" - screen_loc = "7,7 to 10,8" - layer = HUD_LAYER - plane = HUD_PLANE - -/obj/screen/storage/Initialize(mapload, new_master) - . = ..() - master = new_master - -/obj/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 - /obj/screen/throw_catch name = "throw/catch" icon = 'icons/mob/screen_midnight.dmi' diff --git a/code/_onclick/hud/screen_objects/storage.dm b/code/_onclick/hud/screen_objects/storage.dm new file mode 100644 index 0000000000..5e78ba45e0 --- /dev/null +++ b/code/_onclick/hud/screen_objects/storage.dm @@ -0,0 +1,41 @@ +/obj/screen/storage + name = "storage" + var/insertion_click = FALSE + +/obj/screen/storage/Initialize(mapload, new_master) + . = ..() + master = new_master + +/obj/screen/storage/Click(location, control, params) + if(!insertion_click) + return ..() + 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 + +/obj/screen/storage/boxes + name = "storage" + icon_state = "block" + screen_loc = "7,7 to 10,8" + layer = HUD_LAYER + plane = HUD_PLANE + insertion_click = TRUE + +/obj/screen/storage/close + name = "close" + layer = ABOVE_HUD_LAYER + plane = ABOVE_HUD_PLANE + icon_state = "backpack_close" + +/obj/screen/storage/close/Click() + var/datum/component/storage/S = master + S.hide_from(usr) + return TRUE diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm index 576bd196dc..c3ac3c48a8 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -46,8 +46,19 @@ var/display_numerical_stacking = FALSE //stack things of the same type and show as a single object with a number. - var/obj/screen/storage/boxes //storage display object - var/obj/screen/close/closer //close button object + /// "legacy"/default view mode's storage "boxes" + var/obj/screen/storage/boxes/ui_boxes + /// New volumetric storage display mode's left side + var/obj/screen/storage/left/ui_left + /// New volumetric storage display mode's right side + var/obj/screen/storage/right/ui_right + /// New volumetric storage display mode's center 'blocks' + var/obj/screen/storage/continuous/ui_continuous + /// The close button, used in all modes. + var/obj/screen/storage/close/ui_closer + /// Associative list of list(item = screen object) for volumetric storage item screen blocks + var/list/ui_item_blocks + var/current_maxscreensize var/allow_big_nesting = FALSE //allow storage objects of the same or greater size. @@ -120,8 +131,15 @@ /datum/component/storage/Destroy() close_all() - QDEL_NULL(boxes) - QDEL_NULL(closer) + QDEL_NULL(ui_boxes) + QDEL_NULL(ui_closer) + QDEL_NULL(ui_continuous) + QDEL_NULL(ui_left) + QDEL_NULL(ui_right) + // DO NOT USE QDEL_LIST_ASSOC. + for(var/i in ui_item_blocks) + qdel(ui_item_blocks[i]) //qdel the screen object not the item + ui_item_blocks.Cut() LAZYCLEARLIST(is_using) return ..() @@ -309,103 +327,6 @@ if(check_locked()) close_all() -/datum/component/storage/proc/_process_numerical_display() - . = list() - for(var/obj/item/I in accessible_items()) - if(QDELETED(I)) - continue - if(!.[I.type]) - .[I.type] = new /datum/numbered_display(I, 1) - else - var/datum/numbered_display/ND = .[I.type] - ND.number++ - . = sortTim(., /proc/cmp_numbered_displays_name_asc, associative = TRUE) - -//This proc determines the size of the inventory to be displayed. Please touch it only if you know what you're doing. -/datum/component/storage/proc/orient2hud(mob/user, maxcolumns) - var/list/accessible_contents = accessible_items() - var/adjusted_contents = length(accessible_contents) - - //Numbered contents display - var/list/datum/numbered_display/numbered_contents - if(display_numerical_stacking) - numbered_contents = _process_numerical_display() - adjusted_contents = numbered_contents.len - - var/columns = CLAMP(max_items, 1, maxcolumns ? maxcolumns : screen_max_columns) - var/rows = CLAMP(CEILING(adjusted_contents / columns, 1), 1, screen_max_rows) - standard_orient_objs(rows, columns, numbered_contents) - -//This proc draws out the inventory and places the items on it. It uses the standard position. -/datum/component/storage/proc/standard_orient_objs(rows, cols, list/obj/item/numerical_display_contents) - boxes.screen_loc = "[screen_start_x]:[screen_pixel_x],[screen_start_y]:[screen_pixel_y] to [screen_start_x+cols-1]:[screen_pixel_x],[screen_start_y+rows-1]:[screen_pixel_y]" - var/cx = screen_start_x - var/cy = screen_start_y - if(islist(numerical_display_contents)) - for(var/type in numerical_display_contents) - var/datum/numbered_display/ND = numerical_display_contents[type] - ND.sample_object.mouse_opacity = MOUSE_OPACITY_OPAQUE - ND.sample_object.screen_loc = "[cx]:[screen_pixel_x],[cy]:[screen_pixel_y]" - ND.sample_object.maptext = "[(ND.number > 1)? "[ND.number]" : ""]" - ND.sample_object.layer = ABOVE_HUD_LAYER - ND.sample_object.plane = ABOVE_HUD_PLANE - cx++ - if(cx - screen_start_x >= cols) - cx = screen_start_x - cy++ - if(cy - screen_start_y >= rows) - break - else - for(var/obj/O in accessible_items()) - if(QDELETED(O)) - continue - O.mouse_opacity = MOUSE_OPACITY_OPAQUE //This is here so storage items that spawn with contents correctly have the "click around item to equip" - O.screen_loc = "[cx]:[screen_pixel_x],[cy]:[screen_pixel_y]" - O.maptext = "" - O.layer = ABOVE_HUD_LAYER - O.plane = ABOVE_HUD_PLANE - cx++ - if(cx - screen_start_x >= cols) - cx = screen_start_x - cy++ - if(cy - screen_start_y >= rows) - break - closer.screen_loc = "[screen_start_x + cols]:[screen_pixel_x],[screen_start_y]:[screen_pixel_y]" - -/datum/component/storage/proc/show_to(mob/M, set_screen_size = TRUE) - if(!M.client) - return FALSE - var/list/cview = getviewsize(M.client.view) - var/maxallowedscreensize = cview[1]-8 - if(set_screen_size) - current_maxscreensize = maxallowedscreensize - else if(current_maxscreensize) - maxallowedscreensize = current_maxscreensize - if(M.active_storage != src && (M.stat == CONSCIOUS)) - for(var/obj/item/I in accessible_items()) - if(I.on_found(M)) - return FALSE - if(M.active_storage) - M.active_storage.hide_from(M) - orient2hud(M, (isliving(M) ? maxallowedscreensize : 7)) - M.client.screen |= boxes - M.client.screen |= closer - M.client.screen |= accessible_items() - M.active_storage = src - LAZYOR(is_using, M) - return TRUE - -/datum/component/storage/proc/hide_from(mob/M) - if(!M.client) - return TRUE - var/atom/real_location = real_location() - M.client.screen -= boxes - M.client.screen -= closer - M.client.screen -= real_location.contents - if(M.active_storage == src) - M.active_storage = null - LAZYREMOVE(is_using, M) - return TRUE /datum/component/storage/proc/close(mob/M) hide_from(M) @@ -427,24 +348,6 @@ var/datum/component/storage/concrete/master = master() master.emp_act(source, severity) -//This proc draws out the inventory and places the items on it. tx and ty are the upper left tile and mx, my are the bottm right. -//The numbers are calculated from the bottom-left The bottom-left slot being 1,1. -/datum/component/storage/proc/orient_objs(tx, ty, mx, my) - var/atom/real_location = real_location() - var/cx = tx - var/cy = ty - boxes.screen_loc = "[tx]:,[ty] to [mx],[my]" - for(var/obj/O in real_location) - if(QDELETED(O)) - continue - O.screen_loc = "[cx],[cy]" - O.layer = ABOVE_HUD_LAYER - O.plane = ABOVE_HUD_PLANE - cx++ - if(cx > mx) - cx = tx - cy-- - closer.screen_loc = "[mx+1],[my]" //Resets something that is being removed from storage. /datum/component/storage/proc/_removal_reset(atom/movable/thing) diff --git a/code/datums/components/storage/ui.dm b/code/datums/components/storage/ui.dm new file mode 100644 index 0000000000..f73aff43ec --- /dev/null +++ b/code/datums/components/storage/ui.dm @@ -0,0 +1,259 @@ +/** + * Generates a list of numbered_display datums for the numerical display system. + */ +/datum/component/storage/proc/_process_numerical_display() + . = list() + for(var/obj/item/I in accessible_items()) + if(QDELETED(I)) + continue + if(!.[I.type]) + .[I.type] = new /datum/numbered_display(I, 1) + else + var/datum/numbered_display/ND = .[I.type] + ND.number++ + . = sortTim(., /proc/cmp_numbered_displays_name_asc, associative = TRUE) + +/** + * Orients all objects in legacy mode, and returns the objects to show to the user. + */ +/datum/component/storage/proc/orient2hud_legacy(mob/user, maxcolumns) + . = list() + var/list/accessible_contents = accessible_items() + var/adjusted_contents = length(accessible_contents) + + //Numbered contents display + var/list/datum/numbered_display/numbered_contents + if(display_numerical_stacking) + numbered_contents = _process_numerical_display() + adjusted_contents = numbered_contents.len + + var/columns = CLAMP(max_items, 1, maxcolumns ? maxcolumns : screen_max_columns) + var/rows = CLAMP(CEILING(adjusted_contents / columns, 1), 1, screen_max_rows) + + // First, boxes. + ui_boxes.screen_loc = "[screen_start_x]:[screen_pixel_x],[screen_start_y]:[screen_pixel_y] to [screen_start_x+columns-1]:[screen_pixel_x],[screen_start_y+rows-1]:[screen_pixel_y]" + . += ui_boxes + // Then, closer. + closer.screen_loc = "[screen_start_x + columns]:[screen_pixel_x],[screen_start_y]:[screen_pixel_y]" + . += ui_closer + // Then orient the actual items. + var/cx = screen_start_x + var/cy = screen_start_y + if(islist(numerical_display_contents)) + for(var/type in numerical_display_contents) + var/datum/numbered_display/ND = numerical_display_contents[type] + ND.sample_object.mouse_opacity = MOUSE_OPACITY_OPAQUE + ND.sample_object.screen_loc = "[cx]:[screen_pixel_x],[cy]:[screen_pixel_y]" + ND.sample_object.maptext = "[(ND.number > 1)? "[ND.number]" : ""]" + ND.sample_object.layer = ABOVE_HUD_LAYER + ND.sample_object.plane = ABOVE_HUD_PLANE + . += ND.sample_object + cx++ + if(cx - screen_start_x >= columns) + cx = screen_start_x + cy++ + if(cy - screen_start_y >= rows) + break + else + for(var/obj/O in accessible_items()) + if(QDELETED(O)) + continue + O.mouse_opacity = MOUSE_OPACITY_OPAQUE //This is here so storage items that spawn with contents correctly have the "click around item to equip" + O.screen_loc = "[cx]:[screen_pixel_x],[cy]:[screen_pixel_y]" + O.maptext = "" + O.layer = ABOVE_HUD_LAYER + O.plane = ABOVE_HUD_PLANE + . += O + cx++ + if(cx - screen_start_x >= columns) + cx = screen_start_x + cy++ + if(cy - screen_start_y >= rows) + break + +/** + * Orients all objects in .. volumetric mode. + */ +/datum/component/storage/proc/orient2hud_volumetric(mob/user, maxcolumns) + . = list() + var/list/accessible_contents = accessible_items() + var/adjusted_contents = length(accessible_contents) + + //Numbered contents display + var/list/datum/numbered_display/numbered_contents + if(display_numerical_stacking) + numbered_contents = _process_numerical_display() + adjusted_contents = numbered_contents.len + + var/columns = CLAMP(max_items, 1, maxcolumns ? maxcolumns : screen_max_columns) + var/rows = CLAMP(CEILING(adjusted_contents / columns, 1), 1, screen_max_rows) + + // First, continuous section. + ui_continuous.screen_loc = "[screen_start_x]:[screen_pixel_x],[screen_start_y]:[screen_pixel_y] to [screen_start_x+columns-1]:[screen_pixel_x],[screen_start_y+rows-1]:[screen_pixel_y]" + . += ui_continuous + // Then, left and right. + ui_left.screen_loc = "[screen_start_x]:[screen_pixel_x - 2],[screen_start_y]:[screen_pixel_y] to [screen_start_x]:[screen_pixel_x - 2],[screen_start_y+rows-1]:[screen_pixel_y]" + . += ui_left + ui_right.screen_loc = "[screen_start_x+columns-1]:[screen_pixel_x + 2],[screen_start_y]:[screen_pixel_y] to [screen_start_x+columns-1]:[screen_pixel_x + 2],[screen_start_y+rows-1]:[screen_pixel_y]" + . += ui_right + // Then, closer. + closer.screen_loc = "[screen_start_x + columns]:[screen_pixel_x],[screen_start_y]:[screen_pixel_y]" + . += ui_closer + // Generate ui_item_blocks for missing ones. + + + + + + + var/cx = screen_start_x + var/cy = screen_start_y + if(islist(numerical_display_contents)) + for(var/type in numerical_display_contents) + var/datum/numbered_display/ND = numerical_display_contents[type] + ND.sample_object.mouse_opacity = MOUSE_OPACITY_OPAQUE + ND.sample_object.screen_loc = "[cx]:[screen_pixel_x],[cy]:[screen_pixel_y]" + ND.sample_object.maptext = "[(ND.number > 1)? "[ND.number]" : ""]" + ND.sample_object.layer = ABOVE_HUD_LAYER + ND.sample_object.plane = ABOVE_HUD_PLANE + . += ND.sample_object + cx++ + if(cx - screen_start_x >= columns) + cx = screen_start_x + cy++ + if(cy - screen_start_y >= rows) + break + else + for(var/obj/O in accessible_items()) + if(QDELETED(O)) + continue + O.mouse_opacity = MOUSE_OPACITY_OPAQUE //This is here so storage items that spawn with contents correctly have the "click around item to equip" + O.screen_loc = "[cx]:[screen_pixel_x],[cy]:[screen_pixel_y]" + O.maptext = "" + O.layer = ABOVE_HUD_LAYER + O.plane = ABOVE_HUD_PLANE + . += O + cx++ + if(cx - screen_start_x >= columns) + cx = screen_start_x + cy++ + if(cy - screen_start_y >= rows) + break + +/** + * Shows our UI to a mob. + */ +/datum/component/storage/proc/ui_show(mob/M, set_screen_size = TRUE) + if(!M.client) + return FALSE + var/list/cview = getviewsize(M.client.view) + // in tiles + var/maxallowedscreensize = cview[1]-8 + if(set_screen_size) + current_maxscreensize = maxallowedscreensize + else if(current_maxscreensize) + maxallowedscreensize = current_maxscreensize + // we got screen size, register signal + RegisterSignal(M, COMSIG_MOB_CLIENT_LOGOUT, .proc/on_logout) + if(M.active_storage) + M.active_storage.ui_hide(M) + M.active_storage = src + LAZOR(is_using, M) + if(volumetric_ui()) + //new volumetric ui bay-style + M.client.screen |= orient2hud_volumetric(M, maxallowedscreensize) + else + //old ui + M.client.screen |= orient2hud_legacy(M, maxallowedscreensize) + return TRUE + +/** + * VV hooked to ensure no lingering screen objects. + */ +/datum/component/storage/vv_edit_var(var_name, var_value) + var/list/old + if(var_name == NAMEOF(storage_flags)) + old = is_using.Copy() + for(var/i in is_using) + ui_hide(i) + . = ..() + if(old) + for(var/i in old) + ui_show(i) + +/** + * Proc triggered by signal to ensure logging out clients don't linger. + */ +/datum/component/storage/proc/on_logout(datum/source, client/C) + ui_hide(source) + +/** + * Hides our UI from a mob + */ +/datum/component/storage/proc/ui_hide(mob/M) + if(!M.client) + return TRUE + M.client.screen -= list(ui_boxes, ui_closer, ui_left, ui_right, ui_continuous, get_ui_item_objects_hide()) + if(M.active_storage == src) + M.active_storage = null + LAZYREMOVE(is_using, M) + return TRUE + +/** + * Returns TRUE if we are using volumetric UI instead of box UI + */ +/datum/component/storage/proc/volumetric_ui() + var/atom/real_location = real_location() + return (storage_flags & STORAGE_LIMIT_VOLUME) && (length(real_location.contents) <= MAXIMUM_VOLUMETRIC_OBJECTS) + +/** + * Gets the ui item objects to ui_hide. + */ +/datum/component/storage/proc/get_ui_item_objects_hide() + if(!volumetric_ui()) + var/atom/real_location = real_location() + return real_location.contents + else + . = list() + for(var/i in ui_item_blocks) + . += ui_item_blocks[i] //get the block not the item + +/** + * Gets our ui_boxes, making it if it doesn't exist. + */ +/datum/component/storage/proc/get_ui_boxes() + if(!ui_boxes) + ui_boxes = new(null, src) + return ui_boxes + +/** + * Gets our ui_left, making it if it doesn't exist. + */ +/datum/component/storage/proc/get_ui_left() + if(!ui_left) + ui_left = new(null, src) + return ui_left + +/** + * Gets our ui_right, making it if it doesn't exist. + */ +/datum/component/storage/proc/get_ui_right() + if(!ui_right) + ui_right = new(null, src) + return ui_right + +/** + * Gets our ui_close, making it if it doesn't exist. + */ +/datum/component/storage/proc/get_ui_close() + if(!ui_close) + ui_close = new(null, src) + return ui_close + +/** + * Gets our ui_continuous, making it if it doesn't exist. + */ +/datum/component/storage/proc/get_ui_continuous() + if(!ui_continuous) + ui_continuous = new(null, src) + return ui_continuous diff --git a/code/modules/mob/logout.dm b/code/modules/mob/logout.dm index e5aaa016bd..536eacca7d 100644 --- a/code/modules/mob/logout.dm +++ b/code/modules/mob/logout.dm @@ -1,4 +1,5 @@ /mob/Logout() + SEND_SIGNAL(src, COMSIG_MOB_CLIENT_LOGOUT, client) log_message("[key_name(src)] is no longer owning mob [src]([src.type])", LOG_OWNERSHIP) SStgui.on_logout(src) unset_machine() diff --git a/icons/mob/screen_gen.dmi b/icons/mob/screen_gen.dmi index ea946f60d9c31139c6e5d3e8aed79794e0294ff0..ffbffcab0dd1b8c809830e4544b548ad075c5ae5 100644 GIT binary patch delta 7900 zcmbVvc|4Tg`}aL#kX>3WAxkMF*&`#_lG0*HVJc+_QBwAMq=jrrlF*RKP7<;XQ6pq5 zO_Oy-$~KrmW5yVBKes-g-}C)F&+GZ)_j=~_x@XRPE${1`_qnd?%*n_Wtj`sEq>Mx< zrKl={WG6p`n>IW1_V>Ip6Xy?8vg+)8{9~;9&MPGvh4t1(6Frp?JZLV7vS~Juc-%S` z$Zp~=muu>^NSvh+uI%SuwdGEv-w!HR{OJC-NJVu8lR6KYfQ}lr&x#y_O>zFpC^-6kZ9CHM?63AixR_z$ec$db!PdOD9>RWuOKYxfs=ys7Z+-Q%7vZbup_1vkb|t!fek zEc-YpZEj!a%RPQObN0!5*1CUtEnO{Hzr;CLEm*M{QuuM-FLuRsa`nB!;_?>{2(O3{ z6QE&!bWl}MH_g&bD@lVjd*-6*K4Mf4Lw({q#Os z=@;~VGqiKLm>j7UpqN)-vv;q|N2lClN5&Ap?};{a-srx*!RfAk+wljsCtgMMO}>t1 zZBJzSC_Y*mQ9gHqf6r=@-jiR~6EAO)D6weW2X@BDo@yX&lrg$web9QU|LK+m{YA;v z`^{Ig2OiO@`nBKMYtVPbn<{iQhkw#GdUt-;&qG#5ZPrbMa7%aDTMo8(Ci4jA(CS-P zZZgGMHsziA=AhlbE{=7fcS;=lM4JvdTX507z16%i*j#>}{b+0QZu(f-?3hG)cAjdd zg=ZwV>QlPMrfCV}hORPM_F&=F?JL)Y;N^X8HxoUuHF&%9N2k2w_l!{LWWB`JCsz_g z+Y~)cJxJNPPqhz7#w1wo zu)6=2Jf{Y0$BiZhZ7cxe8zKt}9M^N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d6Bh3w&SwF@uSQK;Zi2D$-&1|;Ha4xE0aIQIv0#fk)5gLj4 zG-Ue_9#STF`zapC6iwW_KKXA+pGhLn8ksC8z>K|0JWDhV$lMS}J+B=t3}8~>M)3lX zZ1Spb;w7Xdtp_R#V9qN&Sao+NqkiP3HEpV>h(W+L!4FrZc^ z*>^q}h>V0AtE_F>yNzlgG==*ZrdkB_q5v6to=y9bp8fpDrZk&kkjJIBaf>8gi?DrY zCZi~>;7HdchH=L+0TtGI<+XMTxh(n70wRp2>E4n8QsKbiiO7-X1+o}%0-gGeQb5%- zyaLn~x&NifaM&UKWC6$^t^uweVNe0anU|jaF_U?E{2t#~n1T_3M-~79;Dj!WBF0cK zunm~Omnis!j)J)oGtrF%lT;1>Xq~;B)d#SSUz*ZUGbA7ZOg2Lq*7dRZE(TlgK1G28 z>xzVNvh*Fv3dr!;Vt~YVtWW^UTo@S!32+z#^9t%`8eXc_Kc6YB+h<&F^nZaz&47FU zRg8-OI-P;JpA-6UOu&{Nj3u+ux(gCWAWjknl70@HFGeID?vxOtm9wxfnfmNo4^{cZ z08B7UXQYhbJ&pkW^pla*;TT5BaVL3!%*Tdy-b8-d@vhT-gbb(z0qFaF_E{^p274~b zN_Z_;-Mniu-z2)Ax8JEDL!@iZ&#J)?u^Q%s!@3F=1cU5H!od6Aio~eG|FweuU#8;! bQ*{fvrhuQ-ZehW|h5#dd6TMPh$0z> Date: Wed, 8 Apr 2020 00:57:09 -0700 Subject: [PATCH 03/30] cancel --- code/__DEFINES/storage.dm | 4 +- code/_onclick/hud/screen_objects/storage.dm | 10 ++ code/datums/components/storage/storage.dm | 2 + code/datums/components/storage/ui.dm | 135 ++++++++++++-------- 4 files changed, 95 insertions(+), 56 deletions(-) diff --git a/code/__DEFINES/storage.dm b/code/__DEFINES/storage.dm index 27bf502252..56fa599dc3 100644 --- a/code/__DEFINES/storage.dm +++ b/code/__DEFINES/storage.dm @@ -29,6 +29,8 @@ // UI defines /// Minimum pixels an item must have in volumetric scaled storage UI -#define MINIMUM_PIXELS_PER_ITEM 5 +#define MINIMUM_PIXELS_PER_ITEM 4 +/// The size of the volumetric scaled storage UI's volumetric boxes that's rendered behind items. +#define VOLUMETRIC_STORAGE_BOX_SIZE 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 diff --git a/code/_onclick/hud/screen_objects/storage.dm b/code/_onclick/hud/screen_objects/storage.dm index 5e78ba45e0..56d921472c 100644 --- a/code/_onclick/hud/screen_objects/storage.dm +++ b/code/_onclick/hud/screen_objects/storage.dm @@ -39,3 +39,13 @@ var/datum/component/storage/S = master S.hide_from(usr) return TRUE + +/obj/screen/storage/volumetric_box + var/obj/item/our_item + +/obj/screen/storage/volumetric_box/Initialize(mapload, new_master, our_item) + src.our_item = our_item + return ..() + +/obj/screen/storage/volumetric_box/Click(location, control, params) + return our_item.Click(location, control, params) diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm index c3ac3c48a8..8f053961e5 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -360,6 +360,8 @@ /datum/component/storage/proc/_remove_and_refresh(datum/source, atom/movable/thing) _removal_reset(thing) + qdel(ui_item_blocks[thing]) + ui_item_blocks -= thing refresh_mob_views() //Call this proc to handle the removal of an item from the storage item. The item will be moved to the new_location target, if that is null it's being deleted diff --git a/code/datums/components/storage/ui.dm b/code/datums/components/storage/ui.dm index f73aff43ec..b014ef9dd1 100644 --- a/code/datums/components/storage/ui.dm +++ b/code/datums/components/storage/ui.dm @@ -72,73 +72,98 @@ break /** - * Orients all objects in .. volumetric mode. + * Orients all objects in .. volumetric mode. Does not support numerical display! */ /datum/component/storage/proc/orient2hud_volumetric(mob/user, maxcolumns) . = list() - var/list/accessible_contents = accessible_items() - var/adjusted_contents = length(accessible_contents) - //Numbered contents display - var/list/datum/numbered_display/numbered_contents - if(display_numerical_stacking) - numbered_contents = _process_numerical_display() - adjusted_contents = numbered_contents.len + // Generate ui_item_blocks for missing ones and render+orient. + var/list/atom/contents = accessible_items() - var/columns = CLAMP(max_items, 1, maxcolumns ? maxcolumns : screen_max_columns) - var/rows = CLAMP(CEILING(adjusted_contents / columns, 1), 1, screen_max_rows) + var/horizontal_pixels = maxcolumns * world.icon_size + // do the check for fallback for when someone has too much gamer gear + if((MINIMUM_PIXELS_PER_ITEMS * length(contents)) > horizontal_pixels) + to_chat(user, "[parent] was showed to you in legacy mode due to your items overrunning the three row limit! Consider not carrying too much or bugging a maintainer to raise this limit!") + return orient2hud_legacy(user, maxcolumns) + // after this point we are sure we can somehow fit all items with 8 pixels or more into our one row. - // First, continuous section. - ui_continuous.screen_loc = "[screen_start_x]:[screen_pixel_x],[screen_start_y]:[screen_pixel_y] to [screen_start_x+columns-1]:[screen_pixel_x],[screen_start_y+rows-1]:[screen_pixel_y]" + + // sigh. two loops. + var/total = max_volume + + var/used = 0 + + var/list/volume_by_item = list() + var/list/percentage_by_item = list() + var/list/percentages = list() + // define outside for less lag + var/obj/item/I + var/volume + for(var/obj/item/I in contents) + volume = I.get_volume() + used += volume_by_item[I] = volume + percentages += percentage_by_item[I] = volume + // ugh + var/min_percent = min(percentages) + + var/percentage_metric = max(min_percent, + + var/pixels_needed = (100 / min_percent) * MINIMUM_PIXELS_PER_ITEM + + var/overrunning = pixels_needed > maximum_horizontal_pixels + + var/row = 1 + var/pixel = 0 + + for(var/i in volume_by_item) + I = i + if(!ui_item_blocks[I]) + ui_item_blocks[I] = new /obj/screen/storage(null, src, I) + var/obj/screen/storage/volumetric_box/B = ui_item_blocks[I] + + . += B + var/pixels_to_use + if(!overrunning) + pixels_to_use = CEILING(min_percent / percentage_by_item[i], MINIMUM_PIXELS_PER_ITEM) + else + pixels_to_use = MINIMUM_PIXELS_PER_ITEM //not enough room to display everything ughh + + // now that we have pixels_to_use, place our thing and add it to the returned list. + + // uh oh, increment row or clamp. + if((horizontal_pixels - pixel) < pixels_to_use) + if(!pixels_to_use) + row++ + else + pixels_to_use = (horizontal_pixels - pixel) + // now, scale the thing + var/multiply = pixels_to_use / MINIMUM_PIXELS_PER_ITEM + B.transform = matrix(multiply, 0, 0, 0, 1, 0) + // unfortunately since scaling means expand-from-center.. ugh.. + var/px_add = 0 + if(multiply > 1) + px_add = (pixels_to_use - MINIMUM_PIXELS_PER_ITEM) * 0.5 + // not handling multiply < 1, that should never happen. + // now, screenloc the thing. + var/xshift = FLOOR(pixel / icon_size, 1) + var/px = pixel % world.icon_Size + B.screen_loc = "[screen_start_x + xshift]:[px],[screen_start_y+rows-1]:[screen_pixel_y]" + pixels += px + if(pixels >= horizontal_pixels) + row++ + . += B + + // Then, continuous section. + ui_continuous.screen_loc = "[screen_start_x]:[screen_pixel_x],[screen_start_y]:[screen_pixel_y] to [screen_start_x+maxcolumns-1]:[screen_pixel_x],[screen_start_y+rows-1]:[screen_pixel_y]" . += ui_continuous // Then, left and right. ui_left.screen_loc = "[screen_start_x]:[screen_pixel_x - 2],[screen_start_y]:[screen_pixel_y] to [screen_start_x]:[screen_pixel_x - 2],[screen_start_y+rows-1]:[screen_pixel_y]" . += ui_left - ui_right.screen_loc = "[screen_start_x+columns-1]:[screen_pixel_x + 2],[screen_start_y]:[screen_pixel_y] to [screen_start_x+columns-1]:[screen_pixel_x + 2],[screen_start_y+rows-1]:[screen_pixel_y]" + ui_right.screen_loc = "[screen_start_x+maxcolumns-1]:[screen_pixel_x + 2],[screen_start_y]:[screen_pixel_y] to [screen_start_x+maxcolumns-1]:[screen_pixel_x + 2],[screen_start_y+rows-1]:[screen_pixel_y]" . += ui_right // Then, closer. - closer.screen_loc = "[screen_start_x + columns]:[screen_pixel_x],[screen_start_y]:[screen_pixel_y]" + closer.screen_loc = "[screen_start_x + maxcolumns]:[screen_pixel_x],[screen_start_y]:[screen_pixel_y]" . += ui_closer - // Generate ui_item_blocks for missing ones. - - - - - - - var/cx = screen_start_x - var/cy = screen_start_y - if(islist(numerical_display_contents)) - for(var/type in numerical_display_contents) - var/datum/numbered_display/ND = numerical_display_contents[type] - ND.sample_object.mouse_opacity = MOUSE_OPACITY_OPAQUE - ND.sample_object.screen_loc = "[cx]:[screen_pixel_x],[cy]:[screen_pixel_y]" - ND.sample_object.maptext = "[(ND.number > 1)? "[ND.number]" : ""]" - ND.sample_object.layer = ABOVE_HUD_LAYER - ND.sample_object.plane = ABOVE_HUD_PLANE - . += ND.sample_object - cx++ - if(cx - screen_start_x >= columns) - cx = screen_start_x - cy++ - if(cy - screen_start_y >= rows) - break - else - for(var/obj/O in accessible_items()) - if(QDELETED(O)) - continue - O.mouse_opacity = MOUSE_OPACITY_OPAQUE //This is here so storage items that spawn with contents correctly have the "click around item to equip" - O.screen_loc = "[cx]:[screen_pixel_x],[cy]:[screen_pixel_y]" - O.maptext = "" - O.layer = ABOVE_HUD_LAYER - O.plane = ABOVE_HUD_PLANE - . += O - cx++ - if(cx - screen_start_x >= columns) - cx = screen_start_x - cy++ - if(cy - screen_start_y >= rows) - break /** * Shows our UI to a mob. @@ -204,7 +229,7 @@ */ /datum/component/storage/proc/volumetric_ui() var/atom/real_location = real_location() - return (storage_flags & STORAGE_LIMIT_VOLUME) && (length(real_location.contents) <= MAXIMUM_VOLUMETRIC_OBJECTS) + return (storage_flags & STORAGE_LIMIT_VOLUME) && (length(real_location.contents) <= MAXIMUM_VOLUMETRIC_OBJECTS) && !display_numeric_stacking /** * Gets the ui item objects to ui_hide. From 33aa16bfcf9fac832df86a43c66efa587f23d0ec Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Wed, 8 Apr 2020 01:04:56 -0700 Subject: [PATCH 04/30] ok --- code/datums/components/storage/ui.dm | 62 +++++++++++----------------- tgstation.dme | 2 + 2 files changed, 26 insertions(+), 38 deletions(-) diff --git a/code/datums/components/storage/ui.dm b/code/datums/components/storage/ui.dm index b014ef9dd1..65f3811e92 100644 --- a/code/datums/components/storage/ui.dm +++ b/code/datums/components/storage/ui.dm @@ -84,49 +84,35 @@ // do the check for fallback for when someone has too much gamer gear if((MINIMUM_PIXELS_PER_ITEMS * length(contents)) > horizontal_pixels) to_chat(user, "[parent] was showed to you in legacy mode due to your items overrunning the three row limit! Consider not carrying too much or bugging a maintainer to raise this limit!") - return orient2hud_legacy(user, maxcolumns) + return orient2hud_legacy(user, maxcolumns)VO // after this point we are sure we can somehow fit all items with 8 pixels or more into our one row. - - // sigh. two loops. - var/total = max_volume - + // sigh loopmania time var/used = 0 - + // define outside for performance + var/volume var/list/volume_by_item = list() var/list/percentage_by_item = list() - var/list/percentages = list() - // define outside for less lag - var/obj/item/I - var/volume for(var/obj/item/I in contents) - volume = I.get_volume() - used += volume_by_item[I] = volume - percentages += percentage_by_item[I] = volume - // ugh - var/min_percent = min(percentages) + volume = I.get_volume + used += volume + volume_by_item[I] = volume + percentage_by_item[I] = volume / max_volume + var/overrun = FALSE + if(used >= (horizontal_pixels + 4)) //2-4 pixel grace zone + // congratulations we are now in overrun mode. everything will be crammed to minimum storage pixels. + to_chat(user, "[parent] rendered in overrun mode due to more items inside than the maximum volume supports.") + overrun = TRUE - var/percentage_metric = max(min_percent, - - var/pixels_needed = (100 / min_percent) * MINIMUM_PIXELS_PER_ITEM - - var/overrunning = pixels_needed > maximum_horizontal_pixels - - var/row = 1 - var/pixel = 0 - - for(var/i in volume_by_item) + // define outside for marginal performance boost + var/obj/item/I + for(var/i in percentage_by_item) I = i + var/percent = percentage_by_item[I] if(!ui_item_blocks[I]) ui_item_blocks[I] = new /obj/screen/storage(null, src, I) var/obj/screen/storage/volumetric_box/B = ui_item_blocks[I] - - . += B - var/pixels_to_use - if(!overrunning) - pixels_to_use = CEILING(min_percent / percentage_by_item[i], MINIMUM_PIXELS_PER_ITEM) - else - pixels_to_use = MINIMUM_PIXELS_PER_ITEM //not enough room to display everything ughh + var/pixels_to_use = overrun? MINIMUM_PIXELS_PER_ITEM : max(MINIMUM_PIXELS_PER_ITEM, FLOOR(horizontal_pixels * percent, MINIMUM_PIXELS_PER_ITEM)) // now that we have pixels_to_use, place our thing and add it to the returned list. @@ -137,21 +123,21 @@ else pixels_to_use = (horizontal_pixels - pixel) // now, scale the thing - var/multiply = pixels_to_use / MINIMUM_PIXELS_PER_ITEM + var/multiply = pixels_to_use / VOLUMETRIC_STORAGE_BOX_SIZE B.transform = matrix(multiply, 0, 0, 0, 1, 0) // unfortunately since scaling means expand-from-center.. ugh.. - var/px_add = 0 - if(multiply > 1) - px_add = (pixels_to_use - MINIMUM_PIXELS_PER_ITEM) * 0.5 - // not handling multiply < 1, that should never happen. + var/px_add = (pixels_to_use - VOLUMETRIC_STORAGE_BOX_SIZE) * 0.5 // now, screenloc the thing. var/xshift = FLOOR(pixel / icon_size, 1) var/px = pixel % world.icon_Size - B.screen_loc = "[screen_start_x + xshift]:[px],[screen_start_y+rows-1]:[screen_pixel_y]" + B.screen_loc = I.screen_loc = "[screen_start_x + xshift]:[px + px_add],[screen_start_y+rows-1]:[screen_pixel_y]" pixels += px if(pixels >= horizontal_pixels) row++ + + // finally add our things. . += B + . += I // Then, continuous section. ui_continuous.screen_loc = "[screen_start_x]:[screen_pixel_x],[screen_start_y]:[screen_pixel_y] to [screen_start_x+maxcolumns-1]:[screen_pixel_x],[screen_start_y+rows-1]:[screen_pixel_y]" diff --git a/tgstation.dme b/tgstation.dme index fff2248a54..89a48a0344 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -225,6 +225,7 @@ #include "code\_onclick\hud\robot.dm" #include "code\_onclick\hud\screen_objects.dm" #include "code\_onclick\hud\swarmer.dm" +#include "code\_onclick\hud\screen_objects\storage.dm" #include "code\controllers\admin.dm" #include "code\controllers\configuration_citadel.dm" #include "code\controllers\controller.dm" @@ -433,6 +434,7 @@ #include "code\datums\components\fantasy\prefixes.dm" #include "code\datums\components\fantasy\suffixes.dm" #include "code\datums\components\storage\storage.dm" +#include "code\datums\components\storage\ui.dm" #include "code\datums\components\storage\concrete\_concrete.dm" #include "code\datums\components\storage\concrete\bag_of_holding.dm" #include "code\datums\components\storage\concrete\bluespace.dm" From a071a5f2f646c66bdd98a2916be1f4fe18b888ba Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Wed, 8 Apr 2020 01:05:09 -0700 Subject: [PATCH 05/30] ok --- code/datums/components/storage/ui.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/datums/components/storage/ui.dm b/code/datums/components/storage/ui.dm index 65f3811e92..7b7f39e1e7 100644 --- a/code/datums/components/storage/ui.dm +++ b/code/datums/components/storage/ui.dm @@ -84,7 +84,7 @@ // do the check for fallback for when someone has too much gamer gear if((MINIMUM_PIXELS_PER_ITEMS * length(contents)) > horizontal_pixels) to_chat(user, "[parent] was showed to you in legacy mode due to your items overrunning the three row limit! Consider not carrying too much or bugging a maintainer to raise this limit!") - return orient2hud_legacy(user, maxcolumns)VO + return orient2hud_legacy(user, maxcolumns) // after this point we are sure we can somehow fit all items with 8 pixels or more into our one row. // sigh loopmania time @@ -183,7 +183,7 @@ */ /datum/component/storage/vv_edit_var(var_name, var_value) var/list/old - if(var_name == NAMEOF(storage_flags)) + if(var_name == NAMEOF(src, storage_flags)) old = is_using.Copy() for(var/i in is_using) ui_hide(i) From a888c7c29afbf12349c088de757e8165a4b4b7ea Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Thu, 9 Apr 2020 02:52:32 -0700 Subject: [PATCH 06/30] continue --- code/_onclick/hud/screen_objects/storage.dm | 10 ++++++++++ code/datums/components/storage/storage.dm | 13 ++++++------- code/datums/components/storage/ui.dm | 9 +++------ code/game/objects/items.dm | 6 +++--- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/code/_onclick/hud/screen_objects/storage.dm b/code/_onclick/hud/screen_objects/storage.dm index 56d921472c..04436a3b5a 100644 --- a/code/_onclick/hud/screen_objects/storage.dm +++ b/code/_onclick/hud/screen_objects/storage.dm @@ -40,7 +40,17 @@ S.hide_from(usr) return TRUE +/obj/screen/storage/left + icon_state = "storage_start" + +/obj/screen/storage/right + icon_state = "storage_end" + +/obj/screen/storage/continuous + icon_state = "storage_continue" + /obj/screen/storage/volumetric_box + icon_state = "stored_8px" var/obj/item/our_item /obj/screen/storage/volumetric_box/Initialize(mapload, new_master, our_item) diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm index 8f053961e5..5fe5543f38 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -55,7 +55,7 @@ /// New volumetric storage display mode's center 'blocks' var/obj/screen/storage/continuous/ui_continuous /// The close button, used in all modes. - var/obj/screen/storage/close/ui_closer + var/obj/screen/storage/close/ui_close /// Associative list of list(item = screen object) for volumetric storage item screen blocks var/list/ui_item_blocks @@ -132,7 +132,7 @@ /datum/component/storage/Destroy() close_all() QDEL_NULL(ui_boxes) - QDEL_NULL(ui_closer) + QDEL_NULL(ui_close) QDEL_NULL(ui_continuous) QDEL_NULL(ui_left) QDEL_NULL(ui_right) @@ -327,8 +327,7 @@ if(check_locked()) close_all() - -/datum/component/storage/proc/close(mob/M) +/datui_um/component/storage/proc/close(mob/M) hide_from(M) /datum/component/storage/proc/close_all() @@ -376,7 +375,7 @@ /datum/component/storage/proc/refresh_mob_views() var/list/seeing = can_see_contents() for(var/i in seeing) - show_to(i) + ui_show_to(i) return TRUE /datum/component/storage/proc/can_see_contents() @@ -473,7 +472,7 @@ A.add_fingerprint(M) if(!force && (check_locked(null, M) || !M.CanReach(parent, view_only = TRUE))) return FALSE - show_to(M, !ghost) + ui_show_to(M, !ghost) /datum/component/storage/proc/mousedrop_receive(datum/source, atom/movable/O, mob/M) if(isitem(O)) @@ -656,7 +655,7 @@ if(A.loc == user) . = COMPONENT_NO_ATTACK_HAND if(!check_locked(source, user, TRUE)) - show_to(user) + ui_show_to(user) A.do_jiggle() /datum/component/storage/proc/signal_on_pickup(datum/source, mob/user) diff --git a/code/datums/components/storage/ui.dm b/code/datums/components/storage/ui.dm index 7b7f39e1e7..c062922700 100644 --- a/code/datums/components/storage/ui.dm +++ b/code/datums/components/storage/ui.dm @@ -131,21 +131,18 @@ var/xshift = FLOOR(pixel / icon_size, 1) var/px = pixel % world.icon_Size B.screen_loc = I.screen_loc = "[screen_start_x + xshift]:[px + px_add],[screen_start_y+rows-1]:[screen_pixel_y]" - pixels += px - if(pixels >= horizontal_pixels) - row++ // finally add our things. . += B . += I // Then, continuous section. - ui_continuous.screen_loc = "[screen_start_x]:[screen_pixel_x],[screen_start_y]:[screen_pixel_y] to [screen_start_x+maxcolumns-1]:[screen_pixel_x],[screen_start_y+rows-1]:[screen_pixel_y]" + ui_continuous.screen_loc = "[screen_start_x]:[screen_pixel_x],[screen_start_y]:[screen_pixel_y] to [screen_start_x+maxcolumns-1]:[screen_pixel_x],[screen_start_y]:[screen_pixel_y]" . += ui_continuous // Then, left and right. - ui_left.screen_loc = "[screen_start_x]:[screen_pixel_x - 2],[screen_start_y]:[screen_pixel_y] to [screen_start_x]:[screen_pixel_x - 2],[screen_start_y+rows-1]:[screen_pixel_y]" + ui_left.screen_loc = "[screen_start_x]:[screen_pixel_x - 2],[screen_start_y]:[screen_pixel_y] to [screen_start_x]:[screen_pixel_x - 2],[screen_start_y]:[screen_pixel_y]" . += ui_left - ui_right.screen_loc = "[screen_start_x+maxcolumns-1]:[screen_pixel_x + 2],[screen_start_y]:[screen_pixel_y] to [screen_start_x+maxcolumns-1]:[screen_pixel_x + 2],[screen_start_y+rows-1]:[screen_pixel_y]" + ui_right.screen_loc = "[screen_start_x+maxcolumns-1]:[screen_pixel_x + 2],[screen_start_y]:[screen_pixel_y] to [screen_start_x+maxcolumns-1]:[screen_pixel_x + 2],[screen_start_y]:[screen_pixel_y]" . += ui_right // Then, closer. closer.screen_loc = "[screen_start_x + maxcolumns]:[screen_pixel_x],[screen_start_y]:[screen_pixel_y]" diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 6c16cb4060..112595cf19 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -38,7 +38,7 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE) /// 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/w_volume /// The amount of stamina it takes to swing an item in a normal melee attack do not lie to me and say it's for realism because it ain't. If null it will autocalculate from w_class. 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. @@ -862,8 +862,8 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE) 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 +/obj/item/proc/get_w_volume() + return isnull(volume)? AUTOSCALE_VOLUME(w_class) : w_volume /obj/item/proc/embedded(mob/living/carbon/human/embedded_mob) return From e3c6ebb81e295e08a1eac58a68733ea2ea151143 Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Thu, 9 Apr 2020 02:54:29 -0700 Subject: [PATCH 07/30] compile --- code/datums/components/storage/storage.dm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm index 5fe5543f38..81a52770bc 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -313,7 +313,7 @@ if(!_target) _target = get_turf(parent) if(usr) - hide_from(usr) + ui_hide(usr) var/list/contents = contents() var/atom/real_location = real_location() for(var/obj/item/I in contents) @@ -328,7 +328,7 @@ close_all() /datui_um/component/storage/proc/close(mob/M) - hide_from(M) + ui_hide(M) /datum/component/storage/proc/close_all() . = FALSE @@ -375,7 +375,7 @@ /datum/component/storage/proc/refresh_mob_views() var/list/seeing = can_see_contents() for(var/i in seeing) - ui_show_to(i) + ui_show(i) return TRUE /datum/component/storage/proc/can_see_contents() @@ -472,7 +472,7 @@ A.add_fingerprint(M) if(!force && (check_locked(null, M) || !M.CanReach(parent, view_only = TRUE))) return FALSE - ui_show_to(M, !ghost) + ui_show(M, !ghost) /datum/component/storage/proc/mousedrop_receive(datum/source, atom/movable/O, mob/M) if(isitem(O)) @@ -655,7 +655,7 @@ if(A.loc == user) . = COMPONENT_NO_ATTACK_HAND if(!check_locked(source, user, TRUE)) - ui_show_to(user) + ui_show(user) A.do_jiggle() /datum/component/storage/proc/signal_on_pickup(datum/source, mob/user) @@ -674,7 +674,7 @@ return do_quick_empty(loctarget) /datum/component/storage/proc/signal_hide_attempt(datum/source, mob/target) - return hide_from(target) + return ui_hide(target) /datum/component/storage/proc/on_alt_click(datum/source, mob/user) if(!isliving(user) || !user.CanReach(parent)) From e6f98fa270b91c43a48b5f5b0e032073fb25f2be Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Thu, 9 Apr 2020 09:16:46 -0700 Subject: [PATCH 08/30] compile --- code/datums/components/storage/storage.dm | 2 +- code/datums/components/storage/ui.dm | 3 +++ code/game/atoms.dm | 5 +---- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm index 81a52770bc..fd5451e65a 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -327,7 +327,7 @@ if(check_locked()) close_all() -/datui_um/component/storage/proc/close(mob/M) +/datum/component/storage/proc/close(mob/M) ui_hide(M) /datum/component/storage/proc/close_all() diff --git a/code/datums/components/storage/ui.dm b/code/datums/components/storage/ui.dm index c062922700..a5c2a787f5 100644 --- a/code/datums/components/storage/ui.dm +++ b/code/datums/components/storage/ui.dm @@ -106,6 +106,7 @@ // define outside for marginal performance boost var/obj/item/I + var/pixel = 0 for(var/i in percentage_by_item) I = i var/percent = percentage_by_item[I] @@ -131,6 +132,8 @@ var/xshift = FLOOR(pixel / icon_size, 1) var/px = pixel % world.icon_Size B.screen_loc = I.screen_loc = "[screen_start_x + xshift]:[px + px_add],[screen_start_y+rows-1]:[screen_pixel_y]" + // add the used pixels to pixel after we place the object + pixel += pixels_to_use // finally add our things. . += B diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 266d5b5bb5..44a891e24a 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -584,11 +584,8 @@ stoplag(1) qdel(progress) to_chat(user, "You dump as much of [src_object.parent]'s contents into [STR.insert_preposition]to [src] as you can.") - STR.orient2hud(user) - src_object.orient2hud(user) if(user.active_storage) //refresh the HUD to show the transfered contents - user.active_storage.close(user) - user.active_storage.show_to(user) + user.active_storage.ui_show(user) return TRUE /atom/proc/get_dumping_location(obj/item/storage/source,mob/user) From 857716c473da6b0156f1aa27d6268b6d87086613 Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Thu, 9 Apr 2020 09:30:28 -0700 Subject: [PATCH 09/30] k --- code/_onclick/hud/screen_objects/storage.dm | 2 +- .../components/storage/concrete/_concrete.dm | 2 +- .../components/storage/concrete/emergency.dm | 2 +- code/datums/components/storage/storage.dm | 3 --- code/datums/components/storage/ui.dm | 22 +++++++------------ code/game/objects/items.dm | 2 +- 6 files changed, 12 insertions(+), 21 deletions(-) diff --git a/code/_onclick/hud/screen_objects/storage.dm b/code/_onclick/hud/screen_objects/storage.dm index 04436a3b5a..a50554787a 100644 --- a/code/_onclick/hud/screen_objects/storage.dm +++ b/code/_onclick/hud/screen_objects/storage.dm @@ -37,7 +37,7 @@ /obj/screen/storage/close/Click() var/datum/component/storage/S = master - S.hide_from(usr) + S.ui_hide(usr) return TRUE /obj/screen/storage/left diff --git a/code/datums/components/storage/concrete/_concrete.dm b/code/datums/components/storage/concrete/_concrete.dm index 4c8f1b4c97..e044a59668 100644 --- a/code/datums/components/storage/concrete/_concrete.dm +++ b/code/datums/components/storage/concrete/_concrete.dm @@ -60,7 +60,7 @@ _contents_limbo = null if(_user_limbo) for(var/i in _user_limbo) - show_to(i) + ui_show(i) _user_limbo = null /datum/component/storage/concrete/_insert_physical_item(obj/item/I, override = FALSE) diff --git a/code/datums/components/storage/concrete/emergency.dm b/code/datums/components/storage/concrete/emergency.dm index 348821a913..faaeada13d 100644 --- a/code/datums/components/storage/concrete/emergency.dm +++ b/code/datums/components/storage/concrete/emergency.dm @@ -18,7 +18,7 @@ return . = COMPONENT_NO_ATTACK_HAND if(!check_locked(source, user, TRUE)) - show_to(user) + ui_show(user) A.do_jiggle() if(rustle_sound) playsound(A, "rustle", 50, 1, -5) diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm index fd5451e65a..581798c904 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -88,9 +88,6 @@ max_volume = AUTO_SCALE_STORAGE_VOLUME(max_w_class, max_items) if(master) change_master(master) - boxes = new(null, src) - closer = new(null, src) - orient2hud() RegisterSignal(parent, COMSIG_CONTAINS_STORAGE, .proc/on_check) RegisterSignal(parent, COMSIG_IS_STORAGE_LOCKED, .proc/check_locked) diff --git a/code/datums/components/storage/ui.dm b/code/datums/components/storage/ui.dm index a5c2a787f5..a2c9e31386 100644 --- a/code/datums/components/storage/ui.dm +++ b/code/datums/components/storage/ui.dm @@ -39,9 +39,9 @@ // Then orient the actual items. var/cx = screen_start_x var/cy = screen_start_y - if(islist(numerical_display_contents)) - for(var/type in numerical_display_contents) - var/datum/numbered_display/ND = numerical_display_contents[type] + if(islist(numbered_contents)) + for(var/type in numbered_contents) + var/datum/numbered_display/ND = numbered_contents[type] ND.sample_object.mouse_opacity = MOUSE_OPACITY_OPAQUE ND.sample_object.screen_loc = "[cx]:[screen_pixel_x],[cy]:[screen_pixel_y]" ND.sample_object.maptext = "[(ND.number > 1)? "[ND.number]" : ""]" @@ -82,7 +82,7 @@ var/horizontal_pixels = maxcolumns * world.icon_size // do the check for fallback for when someone has too much gamer gear - if((MINIMUM_PIXELS_PER_ITEMS * length(contents)) > horizontal_pixels) + if((MINIMUM_PIXELS_PER_ITEM * length(contents)) > horizontal_pixels) to_chat(user, "[parent] was showed to you in legacy mode due to your items overrunning the three row limit! Consider not carrying too much or bugging a maintainer to raise this limit!") return orient2hud_legacy(user, maxcolumns) // after this point we are sure we can somehow fit all items with 8 pixels or more into our one row. @@ -94,7 +94,7 @@ var/list/volume_by_item = list() var/list/percentage_by_item = list() for(var/obj/item/I in contents) - volume = I.get_volume + volume = I.get_w_volume() used += volume volume_by_item[I] = volume percentage_by_item[I] = volume / max_volume @@ -117,20 +117,14 @@ // now that we have pixels_to_use, place our thing and add it to the returned list. - // uh oh, increment row or clamp. - if((horizontal_pixels - pixel) < pixels_to_use) - if(!pixels_to_use) - row++ - else - pixels_to_use = (horizontal_pixels - pixel) // now, scale the thing var/multiply = pixels_to_use / VOLUMETRIC_STORAGE_BOX_SIZE B.transform = matrix(multiply, 0, 0, 0, 1, 0) // unfortunately since scaling means expand-from-center.. ugh.. var/px_add = (pixels_to_use - VOLUMETRIC_STORAGE_BOX_SIZE) * 0.5 // now, screenloc the thing. - var/xshift = FLOOR(pixel / icon_size, 1) - var/px = pixel % world.icon_Size + var/xshift = FLOOR(pixel / world.icon_size, 1) + var/px = pixel % world.icon_size B.screen_loc = I.screen_loc = "[screen_start_x + xshift]:[px + px_add],[screen_start_y+rows-1]:[screen_pixel_y]" // add the used pixels to pixel after we place the object pixel += pixels_to_use @@ -215,7 +209,7 @@ */ /datum/component/storage/proc/volumetric_ui() var/atom/real_location = real_location() - return (storage_flags & STORAGE_LIMIT_VOLUME) && (length(real_location.contents) <= MAXIMUM_VOLUMETRIC_OBJECTS) && !display_numeric_stacking + return (storage_flags & STORAGE_LIMIT_VOLUME) && (length(real_location.contents) <= MAXIMUM_VOLUMETRIC_ITEMS) && !display_numerical_stacking /** * Gets the ui item objects to ui_hide. diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 112595cf19..19ffb78e52 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -863,7 +863,7 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE) /// Get an item's volume that it uses when being stored. /obj/item/proc/get_w_volume() - return isnull(volume)? AUTOSCALE_VOLUME(w_class) : w_volume + return isnull(volume)? AUTO_SCALE_VOLUME(w_class) : w_volume /obj/item/proc/embedded(mob/living/carbon/human/embedded_mob) return From 2e9e38cd89ba02e4a600218f0c9dfa67f27a16ae Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Thu, 9 Apr 2020 09:30:34 -0700 Subject: [PATCH 10/30] close --- code/_onclick/hud/screen_objects/storage.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/_onclick/hud/screen_objects/storage.dm b/code/_onclick/hud/screen_objects/storage.dm index a50554787a..84f8408cb0 100644 --- a/code/_onclick/hud/screen_objects/storage.dm +++ b/code/_onclick/hud/screen_objects/storage.dm @@ -37,7 +37,7 @@ /obj/screen/storage/close/Click() var/datum/component/storage/S = master - S.ui_hide(usr) + S.close(usr) return TRUE /obj/screen/storage/left From 0a67f5c6ea39b20680f9f2ff376e1911743f1fdc Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Thu, 9 Apr 2020 21:30:42 -0700 Subject: [PATCH 11/30] compile --- code/datums/components/storage/ui.dm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/code/datums/components/storage/ui.dm b/code/datums/components/storage/ui.dm index a2c9e31386..18e9fed595 100644 --- a/code/datums/components/storage/ui.dm +++ b/code/datums/components/storage/ui.dm @@ -34,8 +34,8 @@ ui_boxes.screen_loc = "[screen_start_x]:[screen_pixel_x],[screen_start_y]:[screen_pixel_y] to [screen_start_x+columns-1]:[screen_pixel_x],[screen_start_y+rows-1]:[screen_pixel_y]" . += ui_boxes // Then, closer. - closer.screen_loc = "[screen_start_x + columns]:[screen_pixel_x],[screen_start_y]:[screen_pixel_y]" - . += ui_closer + ui_close.screen_loc = "[screen_start_x + columns]:[screen_pixel_x],[screen_start_y]:[screen_pixel_y]" + . += ui_close // Then orient the actual items. var/cx = screen_start_x var/cy = screen_start_y @@ -125,7 +125,7 @@ // now, screenloc the thing. var/xshift = FLOOR(pixel / world.icon_size, 1) var/px = pixel % world.icon_size - B.screen_loc = I.screen_loc = "[screen_start_x + xshift]:[px + px_add],[screen_start_y+rows-1]:[screen_pixel_y]" + B.screen_loc = I.screen_loc = "[screen_start_x + xshift]:[px + px_add],[screen_start_y]:[screen_pixel_y]" // add the used pixels to pixel after we place the object pixel += pixels_to_use @@ -142,8 +142,8 @@ ui_right.screen_loc = "[screen_start_x+maxcolumns-1]:[screen_pixel_x + 2],[screen_start_y]:[screen_pixel_y] to [screen_start_x+maxcolumns-1]:[screen_pixel_x + 2],[screen_start_y]:[screen_pixel_y]" . += ui_right // Then, closer. - closer.screen_loc = "[screen_start_x + maxcolumns]:[screen_pixel_x],[screen_start_y]:[screen_pixel_y]" - . += ui_closer + ui_close.screen_loc = "[screen_start_x + maxcolumns]:[screen_pixel_x],[screen_start_y]:[screen_pixel_y]" + . += ui_close /** * Shows our UI to a mob. @@ -163,7 +163,7 @@ if(M.active_storage) M.active_storage.ui_hide(M) M.active_storage = src - LAZOR(is_using, M) + LAZYOR(is_using, M) if(volumetric_ui()) //new volumetric ui bay-style M.client.screen |= orient2hud_volumetric(M, maxallowedscreensize) @@ -198,7 +198,7 @@ /datum/component/storage/proc/ui_hide(mob/M) if(!M.client) return TRUE - M.client.screen -= list(ui_boxes, ui_closer, ui_left, ui_right, ui_continuous, get_ui_item_objects_hide()) + M.client.screen -= list(ui_boxes, ui_close, ui_left, ui_right, ui_continuous, get_ui_item_objects_hide()) if(M.active_storage == src) M.active_storage = null LAZYREMOVE(is_using, M) From d149ce47a618f07d4ce54efdd4baaa324964d363 Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Thu, 9 Apr 2020 21:31:35 -0700 Subject: [PATCH 12/30] ok --- code/game/objects/items.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 19ffb78e52..e6b9618ba3 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -863,7 +863,8 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE) /// Get an item's volume that it uses when being stored. /obj/item/proc/get_w_volume() - return isnull(volume)? AUTO_SCALE_VOLUME(w_class) : w_volume + // if w_volume is 0 you fucked up anyways lol + return w_volume || AUTO_SCALE_VOLUME(w_class) /obj/item/proc/embedded(mob/living/carbon/human/embedded_mob) return From a559fef230784c63563e4248e6d04d207dcf99b2 Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Thu, 9 Apr 2020 22:12:39 -0700 Subject: [PATCH 13/30] runtime --- code/datums/components/storage/storage.dm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm index 581798c904..1ee0a5f15c 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -136,7 +136,6 @@ // DO NOT USE QDEL_LIST_ASSOC. for(var/i in ui_item_blocks) qdel(ui_item_blocks[i]) //qdel the screen object not the item - ui_item_blocks.Cut() LAZYCLEARLIST(is_using) return ..() @@ -344,7 +343,6 @@ var/datum/component/storage/concrete/master = master() master.emp_act(source, severity) - //Resets something that is being removed from storage. /datum/component/storage/proc/_removal_reset(atom/movable/thing) if(!istype(thing)) @@ -356,8 +354,9 @@ /datum/component/storage/proc/_remove_and_refresh(datum/source, atom/movable/thing) _removal_reset(thing) - qdel(ui_item_blocks[thing]) - ui_item_blocks -= thing + if(LAZYACCESS(ui_item_blocks, thing)) + qdel(ui_item_blocks[thing]) + ui_item_blocks -= thing refresh_mob_views() //Call this proc to handle the removal of an item from the storage item. The item will be moved to the new_location target, if that is null it's being deleted From 00ebd842b87c22c80e0bac8ce5a64c5835e5c108 Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Thu, 9 Apr 2020 22:17:42 -0700 Subject: [PATCH 14/30] k --- code/datums/components/storage/storage.dm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm index 1ee0a5f15c..0f98ab26cb 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -134,8 +134,10 @@ QDEL_NULL(ui_left) QDEL_NULL(ui_right) // DO NOT USE QDEL_LIST_ASSOC. - for(var/i in ui_item_blocks) - qdel(ui_item_blocks[i]) //qdel the screen object not the item + if(ui_item_blocks) + for(var/i in ui_item_blocks) + qdel(ui_item_blocks[i]) //qdel the screen object not the item + ui_item_blocks.Cut() LAZYCLEARLIST(is_using) return ..() From ffe206f3e18a725661233632da23374f14fb09ec Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Thu, 9 Apr 2020 22:33:54 -0700 Subject: [PATCH 15/30] k --- code/datums/components/storage/ui.dm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/code/datums/components/storage/ui.dm b/code/datums/components/storage/ui.dm index 18e9fed595..f4472508b7 100644 --- a/code/datums/components/storage/ui.dm +++ b/code/datums/components/storage/ui.dm @@ -31,9 +31,11 @@ var/rows = CLAMP(CEILING(adjusted_contents / columns, 1), 1, screen_max_rows) // First, boxes. + ui_boxes = get_ui_boxes() ui_boxes.screen_loc = "[screen_start_x]:[screen_pixel_x],[screen_start_y]:[screen_pixel_y] to [screen_start_x+columns-1]:[screen_pixel_x],[screen_start_y+rows-1]:[screen_pixel_y]" . += ui_boxes // Then, closer. + ui_close = get_ui_close() ui_close.screen_loc = "[screen_start_x + columns]:[screen_pixel_x],[screen_start_y]:[screen_pixel_y]" . += ui_close // Then orient the actual items. @@ -107,6 +109,8 @@ // define outside for marginal performance boost var/obj/item/I var/pixel = 0 + + LAZYINITLIST(ui_item_blocks) for(var/i in percentage_by_item) I = i var/percent = percentage_by_item[I] @@ -134,14 +138,18 @@ . += I // Then, continuous section. + ui_continuous = get_ui_continuous() ui_continuous.screen_loc = "[screen_start_x]:[screen_pixel_x],[screen_start_y]:[screen_pixel_y] to [screen_start_x+maxcolumns-1]:[screen_pixel_x],[screen_start_y]:[screen_pixel_y]" . += ui_continuous // Then, left and right. + ui_left = get_ui_left() ui_left.screen_loc = "[screen_start_x]:[screen_pixel_x - 2],[screen_start_y]:[screen_pixel_y] to [screen_start_x]:[screen_pixel_x - 2],[screen_start_y]:[screen_pixel_y]" . += ui_left + ui_right = get_ui_right() ui_right.screen_loc = "[screen_start_x+maxcolumns-1]:[screen_pixel_x + 2],[screen_start_y]:[screen_pixel_y] to [screen_start_x+maxcolumns-1]:[screen_pixel_x + 2],[screen_start_y]:[screen_pixel_y]" . += ui_right // Then, closer. + ui_close = get_ui_close() ui_close.screen_loc = "[screen_start_x + maxcolumns]:[screen_pixel_x],[screen_start_y]:[screen_pixel_y]" . += ui_close From 9b13f009fe9c10292f331b70c08cb75feca7aea6 Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Thu, 9 Apr 2020 23:12:37 -0700 Subject: [PATCH 16/30] k --- code/__DEFINES/{layers.dm => layers_planes.dm} | 17 +++++++++++++---- code/datums/components/storage/ui.dm | 14 +++++++++++++- tgstation.dme | 2 +- 3 files changed, 27 insertions(+), 6 deletions(-) rename code/__DEFINES/{layers.dm => layers_planes.dm} (90%) diff --git a/code/__DEFINES/layers.dm b/code/__DEFINES/layers_planes.dm similarity index 90% rename from code/__DEFINES/layers.dm rename to code/__DEFINES/layers_planes.dm index 35947b320e..d0f9f8bc28 100644 --- a/code/__DEFINES/layers.dm +++ b/code/__DEFINES/layers_planes.dm @@ -129,11 +129,20 @@ #define HUD_PLANE 21 #define HUD_LAYER 21 #define HUD_RENDER_TARGET "HUD_PLANE" -#define ABOVE_HUD_PLANE 22 -#define ABOVE_HUD_LAYER 22 + +#define VOLUMETRIC_STORAGE_BOX_PLANE 23 +#define VOLUMETRIC_STORAGE_BOX_LAYER 23 +#define VOLUMETRIC_STORAGE_BOX_RENDER_TARGET "VOLUME_STORAGE_BOX_PLANE" + +#define VOLUMETRIC_STORAGE_ITEM_PLANE 24 +#define VOLUMETRIC_STORAGE_ITEM_LAYER 24 +#define VOLUMETRIC_STORAGE_ITEM_RENDER_TARGET "VOLUME_STORAGE_ITEM_PLANE" + +#define ABOVE_HUD_PLANE 25 +#define ABOVE_HUD_LAYER 25 #define ABOVE_HUD_RENDER_TARGET "ABOVE_HUD_PLANE" -#define SPLASHSCREEN_LAYER 23 -#define SPLASHSCREEN_PLANE 23 +#define SPLASHSCREEN_LAYER 30 +#define SPLASHSCREEN_PLANE 30 #define SPLASHSCREEN_RENDER_TARGET "SPLASHSCREEN_PLANE" diff --git a/code/datums/components/storage/ui.dm b/code/datums/components/storage/ui.dm index f4472508b7..89084f70e8 100644 --- a/code/datums/components/storage/ui.dm +++ b/code/datums/components/storage/ui.dm @@ -115,7 +115,7 @@ I = i var/percent = percentage_by_item[I] if(!ui_item_blocks[I]) - ui_item_blocks[I] = new /obj/screen/storage(null, src, I) + ui_item_blocks[I] = new /obj/screen/storage/volumetric_box(null, src, I) var/obj/screen/storage/volumetric_box/B = ui_item_blocks[I] var/pixels_to_use = overrun? MINIMUM_PIXELS_PER_ITEM : max(MINIMUM_PIXELS_PER_ITEM, FLOOR(horizontal_pixels * percent, MINIMUM_PIXELS_PER_ITEM)) @@ -133,6 +133,17 @@ // add the used pixels to pixel after we place the object pixel += pixels_to_use + // set various things + B.layer = VOLUMETRIC_STORAGE_BOX_LAYER + B.plane = VOLUMETRIC_STORAGE_BOX_PLANE + B.name = I.name + + + I.mouse_opacity = MOUSE_OPACITY_ICON + I.maptext = "" + I.layer = VOLUMETRIC_STORAGE_ITEM_LAYER + I.plane = VOLUMETRIC_STORAGE_ITEM_PLANE + // finally add our things. . += B . += I @@ -230,6 +241,7 @@ . = list() for(var/i in ui_item_blocks) . += ui_item_blocks[i] //get the block not the item + . += i /** * Gets our ui_boxes, making it if it doesn't exist. diff --git a/tgstation.dme b/tgstation.dme index 89a48a0344..8ba903dd86 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -57,7 +57,7 @@ #include "code\__DEFINES\is_helpers.dm" #include "code\__DEFINES\jobs.dm" #include "code\__DEFINES\language.dm" -#include "code\__DEFINES\layers.dm" +#include "code\__DEFINES\layers_planes.dm" #include "code\__DEFINES\lighting.dm" #include "code\__DEFINES\logging.dm" #include "code\__DEFINES\machines.dm" From a9e738b8b1602e728a5c621f9bcd214fde2dbc33 Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Thu, 9 Apr 2020 23:14:07 -0700 Subject: [PATCH 17/30] k --- code/datums/components/storage/ui.dm | 1 + 1 file changed, 1 insertion(+) diff --git a/code/datums/components/storage/ui.dm b/code/datums/components/storage/ui.dm index 89084f70e8..68bb12b303 100644 --- a/code/datums/components/storage/ui.dm +++ b/code/datums/components/storage/ui.dm @@ -220,6 +220,7 @@ M.client.screen -= list(ui_boxes, ui_close, ui_left, ui_right, ui_continuous, get_ui_item_objects_hide()) if(M.active_storage == src) M.active_storage = null + UnregisterSignal(M, COMSIG_MOB_CLIENT_LOGOUT) LAZYREMOVE(is_using, M) return TRUE From be398004b792fc669f4f675dec08d852d716bb3f Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Fri, 10 Apr 2020 00:16:43 -0700 Subject: [PATCH 18/30] groan --- code/datums/components/storage/ui.dm | 16 ++++++++++------ icons/mob/screen_gen.dmi | Bin 118971 -> 119011 bytes 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/code/datums/components/storage/ui.dm b/code/datums/components/storage/ui.dm index 68bb12b303..b904d44392 100644 --- a/code/datums/components/storage/ui.dm +++ b/code/datums/components/storage/ui.dm @@ -100,6 +100,7 @@ used += volume volume_by_item[I] = volume percentage_by_item[I] = volume / max_volume + to_chat(world, "DEBUG: [I] volume [volume] percent [percentage_by_item[I]]") var/overrun = FALSE if(used >= (horizontal_pixels + 4)) //2-4 pixel grace zone // congratulations we are now in overrun mode. everything will be crammed to minimum storage pixels. @@ -108,7 +109,8 @@ // define outside for marginal performance boost var/obj/item/I - var/pixel = 0 + // start at this pixel from screen_start_x. + var/pixel = -((world.icon_size - VOLUMETRIC_BOX_SIZE) * 0.5) LAZYINITLIST(ui_item_blocks) for(var/i in percentage_by_item) @@ -118,12 +120,14 @@ ui_item_blocks[I] = new /obj/screen/storage/volumetric_box(null, src, I) var/obj/screen/storage/volumetric_box/B = ui_item_blocks[I] var/pixels_to_use = overrun? MINIMUM_PIXELS_PER_ITEM : max(MINIMUM_PIXELS_PER_ITEM, FLOOR(horizontal_pixels * percent, MINIMUM_PIXELS_PER_ITEM)) + to_chat(world, "DEBUG: [I] using [pixels_to_use] pixels out of [horizontal_pixels]") // now that we have pixels_to_use, place our thing and add it to the returned list. // now, scale the thing var/multiply = pixels_to_use / VOLUMETRIC_STORAGE_BOX_SIZE B.transform = matrix(multiply, 0, 0, 0, 1, 0) + // unfortunately since scaling means expand-from-center.. ugh.. var/px_add = (pixels_to_use - VOLUMETRIC_STORAGE_BOX_SIZE) * 0.5 // now, screenloc the thing. @@ -138,7 +142,6 @@ B.plane = VOLUMETRIC_STORAGE_BOX_PLANE B.name = I.name - I.mouse_opacity = MOUSE_OPACITY_ICON I.maptext = "" I.layer = VOLUMETRIC_STORAGE_ITEM_LAYER @@ -178,7 +181,7 @@ else if(current_maxscreensize) maxallowedscreensize = current_maxscreensize // we got screen size, register signal - RegisterSignal(M, COMSIG_MOB_CLIENT_LOGOUT, .proc/on_logout) + RegisterSignal(M, COMSIG_MOB_CLIENT_LOGOUT, .proc/on_logout, override = TRUE) if(M.active_storage) M.active_storage.ui_hide(M) M.active_storage = src @@ -217,10 +220,10 @@ /datum/component/storage/proc/ui_hide(mob/M) if(!M.client) return TRUE - M.client.screen -= list(ui_boxes, ui_close, ui_left, ui_right, ui_continuous, get_ui_item_objects_hide()) + UnregisterSignal(M, COMSIG_MOB_CLIENT_LOGOUT) + M.client.screen -= list(ui_boxes, ui_close, ui_left, ui_right, ui_continuous) + get_ui_item_objects_hide() if(M.active_storage == src) M.active_storage = null - UnregisterSignal(M, COMSIG_MOB_CLIENT_LOGOUT) LAZYREMOVE(is_using, M) return TRUE @@ -241,7 +244,8 @@ else . = list() for(var/i in ui_item_blocks) - . += ui_item_blocks[i] //get the block not the item + // get both the box and the item + . += ui_item_blocks[i] . += i /** diff --git a/icons/mob/screen_gen.dmi b/icons/mob/screen_gen.dmi index ffbffcab0dd1b8c809830e4544b548ad075c5ae5..d00d0b079c8b1ea8d1409111656a000ad6aca300 100644 GIT binary patch delta 6784 zcmZu#3p~^N-~Y{ALqz7dWX>oR+9@ITB|=A0LawWbgeXVk_FL3Jh2%)cr4A+6a!r{{ z<#OC6xhEScG7K|jw*8*pI_Lj?p8xYad%d=O_qlyPm-pxM{eAc5vDoxuF+wfkem$rX z6QC|}&CzT#lo4VYw%E<;&eIEP%VyYA$20P>^*qJcyttW&UQ^lhDS3o6m-Hg+_!m~# zLi>HiJn@S((xqvq^kLS^FVoh9gcbz_dwd}azmYBL{uLOJ5(ENKK4ZKLT!7%b z5e?cL(rXswgMsEGi=mPK#9TpR8;^n%_gF9*jG8 z;7#QOt;6Y2=C(ho8Sg!OC7z%YxP%Tn zfo<`6F>4@L_Fgqv|80lG-_&Vrte;x~)Ejn8x)PzDa$16r)KPhE+L6S|3@!J+u04=v zGPDnLlxcrjcWJuKGWB?1*X$hpMPCkEY=&d@iE!m#$raI}fcITg2?S z`4bqry6yVq*`KwYBP;l6LEbgomSBzC;WN1+eRI%*N$2O3(F0ALV>$#E$i`;VsX)&d z9196X;mV-gqoPg)H37bTKbV^hy~XCwK>DMYi%`_)T91GEU1|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 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/components/storage/ui.dm b/code/datums/components/storage/ui.dm index b904d44392..ce1db703c5 100644 --- a/code/datums/components/storage/ui.dm +++ b/code/datums/components/storage/ui.dm @@ -110,7 +110,7 @@ // define outside for marginal performance boost var/obj/item/I // start at this pixel from screen_start_x. - var/pixel = -((world.icon_size - VOLUMETRIC_BOX_SIZE) * 0.5) + var/pixel = -((world.icon_size - VOLUMETRIC_STORAGE_BOX_SIZE) * 0.5) LAZYINITLIST(ui_item_blocks) for(var/i in percentage_by_item) From e2440034f58be3c48ccf2f6d66351983456deaf1 Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Fri, 10 Apr 2020 01:07:53 -0700 Subject: [PATCH 20/30] matrices.. --- code/__DEFINES/storage.dm | 10 +++--- code/_onclick/hud/screen_objects/storage.dm | 34 ++++++++++++++++++++- code/datums/components/storage/storage.dm | 8 +++-- code/datums/components/storage/ui.dm | 20 ++++-------- 4 files changed, 49 insertions(+), 23 deletions(-) diff --git a/code/__DEFINES/storage.dm b/code/__DEFINES/storage.dm index 56fa599dc3..3ec3e06961 100644 --- a/code/__DEFINES/storage.dm +++ b/code/__DEFINES/storage.dm @@ -23,14 +23,12 @@ #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) +#define AUTO_SCALE_VOLUME(w_class) (2 ** 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)) // UI defines /// Minimum pixels an item must have in volumetric scaled storage UI -#define MINIMUM_PIXELS_PER_ITEM 4 -/// The size of the volumetric scaled storage UI's volumetric boxes that's rendered behind items. -#define VOLUMETRIC_STORAGE_BOX_SIZE 8 +#define MINIMUM_PIXELS_PER_ITEM 2 /// 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 diff --git a/code/_onclick/hud/screen_objects/storage.dm b/code/_onclick/hud/screen_objects/storage.dm index 84f8408cb0..627893df1f 100644 --- a/code/_onclick/hud/screen_objects/storage.dm +++ b/code/_onclick/hud/screen_objects/storage.dm @@ -42,20 +42,52 @@ /obj/screen/storage/left icon_state = "storage_start" + insertion_click = TRUE /obj/screen/storage/right icon_state = "storage_end" + insertion_click = TRUE /obj/screen/storage/continuous icon_state = "storage_continue" + insertion_click = TRUE /obj/screen/storage/volumetric_box - icon_state = "stored_8px" + icon_state = "stored_continue" var/obj/item/our_item + var/obj/screen/storage/stored_left/left + var/obj/screen/storage/stored_right/right + +/obj/screen/storage/volumetric_box/Destroy() + QDEL_NULL(left) + QDEL_NULL(right) + our_item = null + return ..() /obj/screen/storage/volumetric_box/Initialize(mapload, new_master, our_item) src.our_item = our_item + left = new(null, src, our_item) + right = new(null, src, our_item) return ..() /obj/screen/storage/volumetric_box/Click(location, control, params) return our_item.Click(location, control, params) + +/obj/screen/storage/volumetric_box/proc/on_screen_objects() + return list(src, left, right) + +/obj/screen/storage/volumetric_box/proc/set_pixel_size(pixels) + cut_overlays() + //our icon size is 32 pixels. + transform = matrix(32 / pixels, 0, 0, 0, 1, 0) + left.pixel_x = -(pixels * 0.5) - 4 + right.pixel_x = (pixels * 0.5) + 4 + add_overlay(left) + add_overlay(right) + pixel_x = (pixels - 32) * 0.5 + +/obj/screen/storage/stored_left + icon_state = "stored_start" + +/obj/screen/storage/stored_right + icon_state = "stored_end" diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm index 0f98ab26cb..25646598d3 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -84,8 +84,6 @@ /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) @@ -714,3 +712,9 @@ to_chat(user, "[parent] now picks up all items in a tile at once.") if(COLLECT_ONE) to_chat(user, "[parent] now picks up one item at a time.") + +/** + * Gets our max volume + */ +/datum/component/storage/proc/get_max_volume() + return max_volume || AUTO_SCALE_STORAGE_VOLUME(max_w_class, max_combined_w_class) diff --git a/code/datums/components/storage/ui.dm b/code/datums/components/storage/ui.dm index ce1db703c5..da3094a2c9 100644 --- a/code/datums/components/storage/ui.dm +++ b/code/datums/components/storage/ui.dm @@ -99,7 +99,7 @@ volume = I.get_w_volume() used += volume volume_by_item[I] = volume - percentage_by_item[I] = volume / max_volume + percentage_by_item[I] = volume / get_max_volume() to_chat(world, "DEBUG: [I] volume [volume] percent [percentage_by_item[I]]") var/overrun = FALSE if(used >= (horizontal_pixels + 4)) //2-4 pixel grace zone @@ -110,7 +110,7 @@ // define outside for marginal performance boost var/obj/item/I // start at this pixel from screen_start_x. - var/pixel = -((world.icon_size - VOLUMETRIC_STORAGE_BOX_SIZE) * 0.5) + var/current_pixel = 0 LAZYINITLIST(ui_item_blocks) for(var/i in percentage_by_item) @@ -124,20 +124,12 @@ // now that we have pixels_to_use, place our thing and add it to the returned list. - // now, scale the thing - var/multiply = pixels_to_use / VOLUMETRIC_STORAGE_BOX_SIZE - B.transform = matrix(multiply, 0, 0, 0, 1, 0) - - // unfortunately since scaling means expand-from-center.. ugh.. - var/px_add = (pixels_to_use - VOLUMETRIC_STORAGE_BOX_SIZE) * 0.5 - // now, screenloc the thing. - var/xshift = FLOOR(pixel / world.icon_size, 1) - var/px = pixel % world.icon_size - B.screen_loc = I.screen_loc = "[screen_start_x + xshift]:[px + px_add],[screen_start_y]:[screen_pixel_y]" + B.screen_loc = I.screen_loc = "[screen_start_x]:[current_pixel],[screen_start_y]:[screen_pixel_y]" // add the used pixels to pixel after we place the object - pixel += pixels_to_use + current_pixel += pixels_to_use // set various things + B.set_pixel_size(pixels_to_use) B.layer = VOLUMETRIC_STORAGE_BOX_LAYER B.plane = VOLUMETRIC_STORAGE_BOX_PLANE B.name = I.name @@ -148,7 +140,7 @@ I.plane = VOLUMETRIC_STORAGE_ITEM_PLANE // finally add our things. - . += B + . += B.on_screen_objects() . += I // Then, continuous section. From 36cd3b4c3540ea7692dc5c7afc45028374b21630 Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Fri, 10 Apr 2020 01:23:36 -0700 Subject: [PATCH 21/30] i should have just ported from baystation instead of reinventing the fricking wheel --- code/_onclick/hud/screen_objects/storage.dm | 9 +++++---- code/datums/components/storage/ui.dm | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/code/_onclick/hud/screen_objects/storage.dm b/code/_onclick/hud/screen_objects/storage.dm index 627893df1f..bf560841bb 100644 --- a/code/_onclick/hud/screen_objects/storage.dm +++ b/code/_onclick/hud/screen_objects/storage.dm @@ -76,15 +76,16 @@ /obj/screen/storage/volumetric_box/proc/on_screen_objects() return list(src, left, right) +#define BOX_ICON_PIXELS 32 /obj/screen/storage/volumetric_box/proc/set_pixel_size(pixels) cut_overlays() //our icon size is 32 pixels. - transform = matrix(32 / pixels, 0, 0, 0, 1, 0) - left.pixel_x = -(pixels * 0.5) - 4 - right.pixel_x = (pixels * 0.5) + 4 + transform = matrix(pixels / BOX_ICON_PIXELS, 0, 0, 0, 1, 0) + left.pixel_x = -((BOX_ICON_PIXELS - pixels) * 0.5) - 4 + right.pixel_x = ((BOX_ICON_PIXELS - pixels) * 0.5) + 4 add_overlay(left) add_overlay(right) - pixel_x = (pixels - 32) * 0.5 +#undef BOX_ICON_PIXELS /obj/screen/storage/stored_left icon_state = "stored_start" diff --git a/code/datums/components/storage/ui.dm b/code/datums/components/storage/ui.dm index da3094a2c9..0d606a2f84 100644 --- a/code/datums/components/storage/ui.dm +++ b/code/datums/components/storage/ui.dm @@ -124,7 +124,7 @@ // now that we have pixels_to_use, place our thing and add it to the returned list. - B.screen_loc = I.screen_loc = "[screen_start_x]:[current_pixel],[screen_start_y]:[screen_pixel_y]" + B.screen_loc = I.screen_loc = "[screen_start_x]:[current_pixel + (pixels_to_use * 0.5)],[screen_start_y]:[screen_pixel_y]" // add the used pixels to pixel after we place the object current_pixel += pixels_to_use @@ -149,14 +149,14 @@ . += ui_continuous // Then, left and right. ui_left = get_ui_left() - ui_left.screen_loc = "[screen_start_x]:[screen_pixel_x - 2],[screen_start_y]:[screen_pixel_y] to [screen_start_x]:[screen_pixel_x - 2],[screen_start_y]:[screen_pixel_y]" + ui_left.screen_loc = "[screen_start_x]:[screen_pixel_x - 2],[screen_start_y]:[screen_pixel_y]" . += ui_left ui_right = get_ui_right() - ui_right.screen_loc = "[screen_start_x+maxcolumns-1]:[screen_pixel_x + 2],[screen_start_y]:[screen_pixel_y] to [screen_start_x+maxcolumns-1]:[screen_pixel_x + 2],[screen_start_y]:[screen_pixel_y]" + ui_right.screen_loc = "[screen_start_x + maxcolumns]:[screen_pixel_x],[screen_start_y]:[screen_pixel_y]" . += ui_right // Then, closer. ui_close = get_ui_close() - ui_close.screen_loc = "[screen_start_x + maxcolumns]:[screen_pixel_x],[screen_start_y]:[screen_pixel_y]" + ui_close.screen_loc = "[screen_start_x + maxcolumns]:[screen_pixel_x + 2],[screen_start_y]:[screen_pixel_y]" . += ui_close /** From 165379c0b8062a010d3eb4981c74155f7dc73d0e Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Fri, 10 Apr 2020 02:19:19 -0700 Subject: [PATCH 22/30] storage --- code/__DEFINES/storage.dm | 17 ++++++-- code/_onclick/hud/screen_objects/storage.dm | 46 ++++++++++++-------- code/datums/components/storage/storage.dm | 45 ++++++++++++------- icons/mob/screen_gen.dmi | Bin 119011 -> 119019 bytes 4 files changed, 71 insertions(+), 37 deletions(-) diff --git a/code/__DEFINES/storage.dm b/code/__DEFINES/storage.dm index 3ec3e06961..bdcb638666 100644 --- a/code/__DEFINES/storage.dm +++ b/code/__DEFINES/storage.dm @@ -1,12 +1,17 @@ // 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) +// 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 w_class and max_combined_w_class, aka legacy behavior if you combine it with [STORAGE_LIMIT_MAX_ITEMS]. +/// Check max_combined_w_class. #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. +/// 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_MAX_ITEMS | STORAGE_LIMIT_VOLUME | STORAGE_LIMIT_MAX_W_CLASS) //ITEM INVENTORY WEIGHT, FOR w_class /// Usually items smaller then a human hand, ex: Playing Cards, Lighter, Scalpel, Coins/Money @@ -28,7 +33,11 @@ #define AUTO_SCALE_STORAGE_VOLUME(w_class, max_combined_w_class) (AUTO_SCALE_VOLUME(w_class) * (max_combined_w_class / 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 2 +#define 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 MAXIMUM_VOLUMETRIC_ITEMS 256 diff --git a/code/_onclick/hud/screen_objects/storage.dm b/code/_onclick/hud/screen_objects/storage.dm index bf560841bb..5b73d8721a 100644 --- a/code/_onclick/hud/screen_objects/storage.dm +++ b/code/_onclick/hud/screen_objects/storage.dm @@ -55,40 +55,52 @@ /obj/screen/storage/volumetric_box icon_state = "stored_continue" var/obj/item/our_item - var/obj/screen/storage/stored_left/left - var/obj/screen/storage/stored_right/right - -/obj/screen/storage/volumetric_box/Destroy() - QDEL_NULL(left) - QDEL_NULL(right) - our_item = null - return ..() /obj/screen/storage/volumetric_box/Initialize(mapload, new_master, our_item) src.our_item = our_item - left = new(null, src, our_item) - right = new(null, src, our_item) + return ..() + +/obj/screen/storage/volumetric_box/Destroy() + our_item = null return ..() /obj/screen/storage/volumetric_box/Click(location, control, params) return our_item.Click(location, control, params) -/obj/screen/storage/volumetric_box/proc/on_screen_objects() +/obj/screen/storage/volumetric_box/center + icon_state = "stored_continue" + var/obj/screen/storage/stored_left/left + var/obj/screen/storage/stored_right/right + +/obj/screen/storage/volumetric_box/center/Initialize(mapload, new_master, our_item) + left = new(null, src, our_item) + right = new(null, src, our_item) + return ..() + +/obj/screen/storage/volumetric_box/center/Destroy() + QDEL_NULL(lefT) + QDEL_NULL(right) + return ..() + +/obj/screen/storage/volumetric_box/center/proc/on_screen_objects() return list(src, left, right) -#define BOX_ICON_PIXELS 32 -/obj/screen/storage/volumetric_box/proc/set_pixel_size(pixels) +/** + * Sets the size of this box screen object and regenerates its left/right borders. This includes the actual border's size! + */ +/obj/screen/storage/volumetric_box/center/proc/set_pixel_size(pixels) cut_overlays() //our icon size is 32 pixels. - transform = matrix(pixels / BOX_ICON_PIXELS, 0, 0, 0, 1, 0) - left.pixel_x = -((BOX_ICON_PIXELS - pixels) * 0.5) - 4 - right.pixel_x = ((BOX_ICON_PIXELS - pixels) * 0.5) + 4 + transform = matrix((pixels - (VOLUMETRIC_STORAGE_BOX_BORDER_SIZE * 2)) / VOLUMETRIC_STORAGE_BOX_ICON_SIZE, 0, 0, 0, 1, 0) + left.pixel_x = -((pixels - VOLUMETRIC_STORAGE_BOX_ICON_SIZE) * 0.5) - VOLUMETRIC_STORAGE_BOX_BORDER_SIZE + right.pixel_x = ((pixels - VOLUMETRIC_STORAGE_BOX_ICON_SIZE) * 0.5) + VOLUMETRIC_STORAGE_BOX_BORDER_SIZE add_overlay(left) add_overlay(right) -#undef BOX_ICON_PIXELS /obj/screen/storage/stored_left icon_state = "stored_start" + appearance_flags = APPEARANCE_UI | KEEP_APART | RESET_TRANSFORM // Yes I know RESET_TRANSFORM is in APPEARANCE_UI but we're hard-asserting this incase someone changes it. /obj/screen/storage/stored_right icon_state = "stored_end" + appearance_flags = APPEARANCE_UI | KEEP_APART | RESET_TRANSFORM diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm index 25646598d3..7cf820239c 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -22,7 +22,7 @@ var/locked = FALSE //when locked nothing can see inside or use it. /// Storage flags, including what kinds of limiters we use for how many items we can hold - var/storage_flags = STORAGE_LIMIT_VOLUME + var/storage_flags = STORAGE_FLAGS_VOLUME_DEFAULT /// 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] @@ -496,10 +496,6 @@ if(M && !stop_messages) host.add_fingerprint(M) return FALSE - if(real_location.contents.len >= max_items) - if(!stop_messages) - to_chat(M, "[host] is full, make some space!") - return FALSE //Storage item is full if(length(can_hold)) if(!is_type_in_typecache(I, can_hold)) if(!stop_messages) @@ -509,17 +505,34 @@ if(!stop_messages) to_chat(M, "[host] cannot hold [I]!") return FALSE - if(I.w_class > max_w_class) - if(!stop_messages) - to_chat(M, "[I] is too big for [host]!") - return FALSE - var/sum_w_class = I.w_class - for(var/obj/item/_I in real_location) - sum_w_class += _I.w_class //Adds up the combined w_classes which will be in the storage item if the item is added to it. - if(sum_w_class > max_combined_w_class) - if(!stop_messages) - to_chat(M, "[I] won't fit in [host], make some space!") - return FALSE + // STORAGE LIMITS + if(storage_flags & STORAGE_LIMIT_MAX_ITEMS) + if(real_location.contents.len >= max_items) + if(!stop_messages) + to_chat(M, "[host] has too many things in it, make some space!") + return FALSE //Storage item is full + if(storage_flags & STORAGE_LIMIT_MAX_W_CLASS) + if(I.w_class > max_w_class) + if(!stop_messages) + to_chat(M, "[I] is too long for [host]!") + return FALSE + if(storage_flags & STORAGE_LIMIT_COMBINED_W_CLASS) + var/sum_w_class = I.w_class + for(var/obj/item/_I in real_location) + sum_w_class += _I.w_class //Adds up the combined w_classes which will be in the storage item if the item is added to it. + if(sum_w_class > max_combined_w_class) + if(!stop_messages) + to_chat(M, "[I] won't fit in [host], make some space!") + return FALSE + if(storage_flags & STORAGE_LIMIT_VOLUME) + var/sum_volume = I.get_w_volume() + for(var/obj/item/_I in real_location) + sum_volume += _I.get_w_volume() + if(sum_volume > get_max_volume()) + if(!stop_messages) + to_chat(M, "[I] is too spacious to fit in [host], make some space!") + return FALSE + ///////////////// if(isitem(host)) var/obj/item/IP = host var/datum/component/storage/STR_I = I.GetComponent(/datum/component/storage) diff --git a/icons/mob/screen_gen.dmi b/icons/mob/screen_gen.dmi index d00d0b079c8b1ea8d1409111656a000ad6aca300..60c413c372a7e495568a68b51cdbab64048acd42 100644 GIT binary patch delta 6455 zcmZv92|SeR-}gNXs<9L&j@?02(p1QnMy0aFR3z)@D7%Ox%gjA;I+1K`wk)kg$dc?s zWy><6i6X|5iJ=+Gm@#JNes9is-uHR`&oiITJ)i6PUEkmJ+rHQDy6?%yV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3Czfdwc8o%sb2O z3;b-_%bDU4HFn*ub|mm(5;GdwaEY=NgUwYBeYlbP=JZI%8oc7#d%KVq@6z+|svBH`{(0CX`e z{C2yv0NCUm>+=Go6UCbE*1r1~rvU&jU@3V1fc}nDKL$Kl8DrVq2iIkP%>Vw%GK+n! zoMAR>O*aEx?2`hDm(C!{A1iB_l9?BTUilX-tcjX>@I-`a3iH(eSRF^hy*rn_obWF1}n8_78{$T%6>r}z6#0JI0?Fry(S|)VB5uW;y0jLb!`v; z_q@sXp=SY;nkez1dJILlf_N_RF$UYH8T+{@`c*Z1BtI%z zD^g#`jT!4Hw3uAJ=>hhM7T`^PhsWQ&g`bpfZ0_;=*7oYB)obja?IZh8hOU!pCf} zjJ4`yIG41-MFzqk24r4A=E1YECvQ1

eHmaPT9!R7X=YKZc|C=eayPJG`l6FDLcn u+dd8FtPL>GbmYu%*=rglkJ5|yX+vwjKjs2Q9-cb@aCSIkU$yr{@_zwI9EN28 From bc16600070f707679818774d5fa0ff6a6c5fbd6c Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Fri, 10 Apr 2020 04:00:59 -0700 Subject: [PATCH 23/30] alternative way --- code/__DEFINES/storage.dm | 4 ++ code/_onclick/hud/screen_objects/storage.dm | 6 ++- code/datums/components/storage/ui.dm | 44 +++++++++++---------- 3 files changed, 33 insertions(+), 21 deletions(-) diff --git a/code/__DEFINES/storage.dm b/code/__DEFINES/storage.dm index bdcb638666..b4240455fe 100644 --- a/code/__DEFINES/storage.dm +++ b/code/__DEFINES/storage.dm @@ -41,3 +41,7 @@ #define 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 MAXIMUM_VOLUMETRIC_ITEMS 256 +/// 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 1 diff --git a/code/_onclick/hud/screen_objects/storage.dm b/code/_onclick/hud/screen_objects/storage.dm index 5b73d8721a..db287565f2 100644 --- a/code/_onclick/hud/screen_objects/storage.dm +++ b/code/_onclick/hud/screen_objects/storage.dm @@ -71,6 +71,7 @@ icon_state = "stored_continue" var/obj/screen/storage/stored_left/left var/obj/screen/storage/stored_right/right + var/pixel_size /obj/screen/storage/volumetric_box/center/Initialize(mapload, new_master, our_item) left = new(null, src, our_item) @@ -78,7 +79,7 @@ return ..() /obj/screen/storage/volumetric_box/center/Destroy() - QDEL_NULL(lefT) + QDEL_NULL(left) QDEL_NULL(right) return ..() @@ -89,6 +90,9 @@ * Sets the size of this box screen object and regenerates its left/right borders. This includes the actual border's size! */ /obj/screen/storage/volumetric_box/center/proc/set_pixel_size(pixels) + if(pixel_size == pixels) + return + pixel_size = pixels cut_overlays() //our icon size is 32 pixels. transform = matrix((pixels - (VOLUMETRIC_STORAGE_BOX_BORDER_SIZE * 2)) / VOLUMETRIC_STORAGE_BOX_ICON_SIZE, 0, 0, 0, 1, 0) diff --git a/code/datums/components/storage/ui.dm b/code/datums/components/storage/ui.dm index 0d606a2f84..aa778c0054 100644 --- a/code/datums/components/storage/ui.dm +++ b/code/datums/components/storage/ui.dm @@ -81,14 +81,9 @@ // Generate ui_item_blocks for missing ones and render+orient. var/list/atom/contents = accessible_items() - - var/horizontal_pixels = maxcolumns * world.icon_size - // do the check for fallback for when someone has too much gamer gear - if((MINIMUM_PIXELS_PER_ITEM * length(contents)) > horizontal_pixels) - to_chat(user, "[parent] was showed to you in legacy mode due to your items overrunning the three row limit! Consider not carrying too much or bugging a maintainer to raise this limit!") - return orient2hud_legacy(user, maxcolumns) - // after this point we are sure we can somehow fit all items with 8 pixels or more into our one row. - + // our volume + var/our_volume = get_max_volume() + var/horizontal_pixels = (maxcolumns * world.icon_size) - (VOLUMETRIC_STORAGE_EDGE_PADDING * 2) // sigh loopmania time var/used = 0 // define outside for performance @@ -100,33 +95,41 @@ used += volume volume_by_item[I] = volume percentage_by_item[I] = volume / get_max_volume() - to_chat(world, "DEBUG: [I] volume [volume] percent [percentage_by_item[I]]") var/overrun = FALSE - if(used >= (horizontal_pixels + 4)) //2-4 pixel grace zone + if(used > our_volume) // congratulations we are now in overrun mode. everything will be crammed to minimum storage pixels. to_chat(user, "[parent] rendered in overrun mode due to more items inside than the maximum volume supports.") overrun = TRUE + // item padding + horizontal_pixels -= ((length(percentage_by_item) - 1) * VOLUMETRIC_STORAGE_ITEM_PADDING) + + // do the check for fallback for when someone has too much gamer gear + if((MINIMUM_PIXELS_PER_ITEM * length(percentage_by_item)) > horizontal_pixels) + to_chat(user, "[parent] was showed to you in legacy mode due to your items overrunning the three row limit! Consider not carrying too much or bugging a maintainer to raise this limit!") + return orient2hud_legacy(user, maxcolumns) + // after this point we are sure we can somehow fit all items with 8 pixels or more into our one row. + // define outside for marginal performance boost var/obj/item/I // start at this pixel from screen_start_x. - var/current_pixel = 0 + var/current_pixel = VOLUMETRIC_STORAGE_EDGE_PADDING LAZYINITLIST(ui_item_blocks) + for(var/i in percentage_by_item) I = i var/percent = percentage_by_item[I] if(!ui_item_blocks[I]) - ui_item_blocks[I] = new /obj/screen/storage/volumetric_box(null, src, I) - var/obj/screen/storage/volumetric_box/B = ui_item_blocks[I] - var/pixels_to_use = overrun? MINIMUM_PIXELS_PER_ITEM : max(MINIMUM_PIXELS_PER_ITEM, FLOOR(horizontal_pixels * percent, MINIMUM_PIXELS_PER_ITEM)) - to_chat(world, "DEBUG: [I] using [pixels_to_use] pixels out of [horizontal_pixels]") + ui_item_blocks[I] = new /obj/screen/storage/volumetric_box/center(null, src, I) + var/obj/screen/storage/volumetric_box/center/B = ui_item_blocks[I] + var/pixels_to_use = overrun? MINIMUM_PIXELS_PER_ITEM : max(MINIMUM_PIXELS_PER_ITEM, round(horizontal_pixels * percent, 1)) // now that we have pixels_to_use, place our thing and add it to the returned list. - B.screen_loc = I.screen_loc = "[screen_start_x]:[current_pixel + (pixels_to_use * 0.5)],[screen_start_y]:[screen_pixel_y]" + B.screen_loc = I.screen_loc = "[screen_start_x]:[current_pixel + (pixels_to_use * 0.5) + VOLUMETRIC_STORAGE_ITEM_PADDING],[screen_start_y]:[screen_pixel_y]" // add the used pixels to pixel after we place the object - current_pixel += pixels_to_use + current_pixel += pixels_to_use + VOLUMETRIC_STORAGE_ITEM_PADDING // set various things B.set_pixel_size(pixels_to_use) @@ -174,9 +177,10 @@ maxallowedscreensize = current_maxscreensize // we got screen size, register signal RegisterSignal(M, COMSIG_MOB_CLIENT_LOGOUT, .proc/on_logout, override = TRUE) - if(M.active_storage) - M.active_storage.ui_hide(M) - M.active_storage = src + if(M.active_storage != src) + if(M.active_storage) + M.active_storage.ui_hide(M) + M.active_storage = src LAZYOR(is_using, M) if(volumetric_ui()) //new volumetric ui bay-style From 84c8183ccb1f5ab09674872cd846d0da54c1c8ec Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Fri, 10 Apr 2020 04:42:34 -0700 Subject: [PATCH 24/30] k --- code/datums/components/storage/ui.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/datums/components/storage/ui.dm b/code/datums/components/storage/ui.dm index aa778c0054..7e9355a665 100644 --- a/code/datums/components/storage/ui.dm +++ b/code/datums/components/storage/ui.dm @@ -123,11 +123,11 @@ if(!ui_item_blocks[I]) ui_item_blocks[I] = new /obj/screen/storage/volumetric_box/center(null, src, I) var/obj/screen/storage/volumetric_box/center/B = ui_item_blocks[I] - var/pixels_to_use = overrun? MINIMUM_PIXELS_PER_ITEM : max(MINIMUM_PIXELS_PER_ITEM, round(horizontal_pixels * percent, 1)) + var/pixels_to_use = overrun? MINIMUM_PIXELS_PER_ITEM : max(MINIMUM_PIXELS_PER_ITEM, horizontal_pixels * percent) // now that we have pixels_to_use, place our thing and add it to the returned list. - B.screen_loc = I.screen_loc = "[screen_start_x]:[current_pixel + (pixels_to_use * 0.5) + VOLUMETRIC_STORAGE_ITEM_PADDING],[screen_start_y]:[screen_pixel_y]" + B.screen_loc = I.screen_loc = "[screen_start_x]:[round(current_pixel + (pixels_to_use * 0.5) + VOLUMETRIC_STORAGE_ITEM_PADDING, 1)],[screen_start_y]:[screen_pixel_y]" // add the used pixels to pixel after we place the object current_pixel += pixels_to_use + VOLUMETRIC_STORAGE_ITEM_PADDING From a9f6ac4131c2bf10cee14d971efbb7d6a85dc6fa Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Fri, 10 Apr 2020 04:42:51 -0700 Subject: [PATCH 25/30] default to legacy --- code/datums/components/storage/storage.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm index 7cf820239c..0efdc96600 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -22,7 +22,7 @@ var/locked = FALSE //when locked nothing can see inside or use it. /// Storage flags, including what kinds of limiters we use for how many items we can hold - var/storage_flags = STORAGE_FLAGS_VOLUME_DEFAULT + var/storage_flags = STORAGE_FLAGS_LEGACY_DEFAULT /// 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] From 6705fc97247fce0e775f84907dc19fded29a77b4 Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Fri, 10 Apr 2020 04:45:19 -0700 Subject: [PATCH 26/30] Update rped.dm --- code/datums/components/storage/concrete/rped.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/components/storage/concrete/rped.dm b/code/datums/components/storage/concrete/rped.dm index 1e609c4107..d919828e8e 100644 --- a/code/datums/components/storage/concrete/rped.dm +++ b/code/datums/components/storage/concrete/rped.dm @@ -3,7 +3,7 @@ allow_quick_gather = TRUE allow_quick_empty = TRUE click_gather = TRUE - storage_flags = STORAGE_LIMIT_MAX_ITEMS | STORAGE_LIMIT_COMBINED_W_CLASS + storage_flags = STORAGE_FLAGS_LEGACY_DEFAULT max_w_class = WEIGHT_CLASS_NORMAL max_combined_w_class = 100 max_items = 100 From a02bad15eaccf3d539bc58476d32c765a68af6bd Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Fri, 10 Apr 2020 04:45:28 -0700 Subject: [PATCH 27/30] Update stack.dm --- code/datums/components/storage/concrete/stack.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/components/storage/concrete/stack.dm b/code/datums/components/storage/concrete/stack.dm index 76c7bc2af5..a3f1e526a0 100644 --- a/code/datums/components/storage/concrete/stack.dm +++ b/code/datums/components/storage/concrete/stack.dm @@ -1,7 +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 + storage_flags = STORAGE_FLAGS_LEGACY_DEFAULT var/max_combined_stack_amount = 300 max_w_class = WEIGHT_CLASS_NORMAL max_combined_w_class = WEIGHT_CLASS_NORMAL * 14 From 37884962049e7d61514cc2d14030d791acd999bc Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Fri, 10 Apr 2020 12:42:50 -0700 Subject: [PATCH 28/30] multiline support --- code/_globalvars/bitfields.dm | 6 +++ code/datums/components/storage/storage.dm | 5 +- code/datums/components/storage/ui.dm | 60 +++++++++++++---------- 3 files changed, 41 insertions(+), 30 deletions(-) diff --git a/code/_globalvars/bitfields.dm b/code/_globalvars/bitfields.dm index 5367322d8e..488926e078 100644 --- a/code/_globalvars/bitfields.dm +++ b/code/_globalvars/bitfields.dm @@ -249,5 +249,11 @@ GLOBAL_LIST_INIT(bitfields, list( "COMBAT_FLAG_SOFT_STAMCRIT" = COMBAT_FLAG_SOFT_STAMCRIT, "COMBAT_FLAG_INTENTIONALLY_RESTING" = COMBAT_FLAG_INTENTIONALLY_RESTING, "COMBAT_FLAG_RESISTING_REST" = COMBAT_FLAG_RESISTING_REST + ), + "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 ) )) diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm index 0efdc96600..7cd43ccece 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -50,11 +50,9 @@ var/obj/screen/storage/boxes/ui_boxes /// New volumetric storage display mode's left side var/obj/screen/storage/left/ui_left - /// New volumetric storage display mode's right side - var/obj/screen/storage/right/ui_right /// New volumetric storage display mode's center 'blocks' var/obj/screen/storage/continuous/ui_continuous - /// The close button, used in all modes. + /// The close button, used in all modes. Frames right side in volumetric mode. var/obj/screen/storage/close/ui_close /// Associative list of list(item = screen object) for volumetric storage item screen blocks var/list/ui_item_blocks @@ -130,7 +128,6 @@ QDEL_NULL(ui_close) QDEL_NULL(ui_continuous) QDEL_NULL(ui_left) - QDEL_NULL(ui_right) // DO NOT USE QDEL_LIST_ASSOC. if(ui_item_blocks) for(var/i in ui_item_blocks) diff --git a/code/datums/components/storage/ui.dm b/code/datums/components/storage/ui.dm index 7e9355a665..23fabf76e8 100644 --- a/code/datums/components/storage/ui.dm +++ b/code/datums/components/storage/ui.dm @@ -84,6 +84,7 @@ // our volume var/our_volume = get_max_volume() var/horizontal_pixels = (maxcolumns * world.icon_size) - (VOLUMETRIC_STORAGE_EDGE_PADDING * 2) + var/max_horizontal_pixels = horizontal_pixels * screen_max_rows // sigh loopmania time var/used = 0 // define outside for performance @@ -95,25 +96,34 @@ used += volume volume_by_item[I] = volume percentage_by_item[I] = volume / get_max_volume() + var/padding_pixels = ((length(percentage_by_item) - 1) * VOLUMETRIC_STORAGE_ITEM_PADDING) + VOLUMETRIC_STORAGE_EDGE_PADDING * 2 + var/min_pixels = (MINIMUM_PIXELS_PER_ITEM * length(percentage_by_item)) + padding_pixels + // do the check for fallback for when someone has too much gamer gear + if((min_pixels) > (max_horizontal_pixels + 4)) // 4 pixel grace zone + to_chat(user, "[parent] was showed to you in legacy mode due to your items overrunning the three row limit! Consider not carrying too much or bugging a maintainer to raise this limit!") + return orient2hud_legacy(user, maxcolumns) + // after this point we are sure we can somehow fit all items into our max number of rows. + + // determine rows + var/rows = CLAMP(CEILING(min_pixels / horizontal_pixels, 1), 1, screen_max_rows) + var/overrun = FALSE if(used > our_volume) // congratulations we are now in overrun mode. everything will be crammed to minimum storage pixels. to_chat(user, "[parent] rendered in overrun mode due to more items inside than the maximum volume supports.") overrun = TRUE - // item padding - horizontal_pixels -= ((length(percentage_by_item) - 1) * VOLUMETRIC_STORAGE_ITEM_PADDING) + // how much we are using + var/using_horizontal_pixels = horizontal_pixels * rows - // do the check for fallback for when someone has too much gamer gear - if((MINIMUM_PIXELS_PER_ITEM * length(percentage_by_item)) > horizontal_pixels) - to_chat(user, "[parent] was showed to you in legacy mode due to your items overrunning the three row limit! Consider not carrying too much or bugging a maintainer to raise this limit!") - return orient2hud_legacy(user, maxcolumns) - // after this point we are sure we can somehow fit all items with 8 pixels or more into our one row. + // item padding + using_horizontal_pixels -= padding_pixels // define outside for marginal performance boost var/obj/item/I // start at this pixel from screen_start_x. var/current_pixel = VOLUMETRIC_STORAGE_EDGE_PADDING + var/row = 1 LAZYINITLIST(ui_item_blocks) @@ -123,11 +133,15 @@ if(!ui_item_blocks[I]) ui_item_blocks[I] = new /obj/screen/storage/volumetric_box/center(null, src, I) var/obj/screen/storage/volumetric_box/center/B = ui_item_blocks[I] - var/pixels_to_use = overrun? MINIMUM_PIXELS_PER_ITEM : max(MINIMUM_PIXELS_PER_ITEM, horizontal_pixels * percent) + var/pixels_to_use = overrun? MINIMUM_PIXELS_PER_ITEM : max(using_horizontal_pixels * percent, MINIMUM_PIXELS_PER_ITEM) + var/addrow = FALSE + if(CEILING(pixels_to_use, 1) >= FLOOR(horizontal_pixels - current_pixel - VOLUMETRIC_STORAGE_EDGE_PADDING, 1)) + pixels_to_use = horizontal_pixels - current_pixel - VOLUMETRIC_STORAGE_EDGE_PADDING + addrow = TRUE // now that we have pixels_to_use, place our thing and add it to the returned list. - B.screen_loc = I.screen_loc = "[screen_start_x]:[round(current_pixel + (pixels_to_use * 0.5) + VOLUMETRIC_STORAGE_ITEM_PADDING, 1)],[screen_start_y]:[screen_pixel_y]" + B.screen_loc = I.screen_loc = "[screen_start_x]:[round(current_pixel + (pixels_to_use * 0.5) + VOLUMETRIC_STORAGE_ITEM_PADDING, 1)],[screen_start_y+row-1]:[screen_pixel_y]" // add the used pixels to pixel after we place the object current_pixel += pixels_to_use + VOLUMETRIC_STORAGE_ITEM_PADDING @@ -146,20 +160,22 @@ . += B.on_screen_objects() . += I + // go up a row if needed + if(addrow) + row++ + current_pixel = VOLUMETRIC_STORAGE_EDGE_PADDING + // Then, continuous section. ui_continuous = get_ui_continuous() - ui_continuous.screen_loc = "[screen_start_x]:[screen_pixel_x],[screen_start_y]:[screen_pixel_y] to [screen_start_x+maxcolumns-1]:[screen_pixel_x],[screen_start_y]:[screen_pixel_y]" + ui_continuous.screen_loc = "[screen_start_x]:[screen_pixel_x],[screen_start_y]:[screen_pixel_y] to [screen_start_x+maxcolumns-1]:[screen_pixel_x],[screen_start_y+rows-1]:[screen_pixel_y]" . += ui_continuous - // Then, left and right. + // Then, left. ui_left = get_ui_left() - ui_left.screen_loc = "[screen_start_x]:[screen_pixel_x - 2],[screen_start_y]:[screen_pixel_y]" + ui_left.screen_loc = "[screen_start_x]:[screen_pixel_x - 2],[screen_start_y]:[screen_pixel_y] to [screen_start_x]:[screen_pixel_x - 2],[screen_start_y+rows-1]:[screen_pixel_y]" . += ui_left - ui_right = get_ui_right() - ui_right.screen_loc = "[screen_start_x + maxcolumns]:[screen_pixel_x],[screen_start_y]:[screen_pixel_y]" - . += ui_right - // Then, closer. + // Then, closer, which is also our right element. ui_close = get_ui_close() - ui_close.screen_loc = "[screen_start_x + maxcolumns]:[screen_pixel_x + 2],[screen_start_y]:[screen_pixel_y]" + ui_close.screen_loc = "[screen_start_x + maxcolumns]:[screen_pixel_x],[screen_start_y + row - 1]:[screen_pixel_y]" . += ui_close /** @@ -217,7 +233,7 @@ if(!M.client) return TRUE UnregisterSignal(M, COMSIG_MOB_CLIENT_LOGOUT) - M.client.screen -= list(ui_boxes, ui_close, ui_left, ui_right, ui_continuous) + get_ui_item_objects_hide() + M.client.screen -= list(ui_boxes, ui_close, ui_left, ui_continuous) + get_ui_item_objects_hide() if(M.active_storage == src) M.active_storage = null LAZYREMOVE(is_using, M) @@ -260,14 +276,6 @@ ui_left = new(null, src) return ui_left -/** - * Gets our ui_right, making it if it doesn't exist. - */ -/datum/component/storage/proc/get_ui_right() - if(!ui_right) - ui_right = new(null, src) - return ui_right - /** * Gets our ui_close, making it if it doesn't exist. */ From b21598a441be800275cb1c65b68cfe6adc8a3c81 Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Fri, 10 Apr 2020 12:47:16 -0700 Subject: [PATCH 29/30] fix --- code/datums/components/storage/ui.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/components/storage/ui.dm b/code/datums/components/storage/ui.dm index 23fabf76e8..c1c049dfd3 100644 --- a/code/datums/components/storage/ui.dm +++ b/code/datums/components/storage/ui.dm @@ -175,7 +175,7 @@ . += ui_left // Then, closer, which is also our right element. ui_close = get_ui_close() - ui_close.screen_loc = "[screen_start_x + maxcolumns]:[screen_pixel_x],[screen_start_y + row - 1]:[screen_pixel_y]" + ui_close.screen_loc = "[screen_start_x + maxcolumns]:[screen_pixel_x],[screen_start_y]:[screen_pixel_y] to [screen_start_x + maxcolumns]:[screen_pixel_x],[screen_start_y + row - 1]:[screen_pixel_y]" . += ui_close /** From f652a612e54b6dac227adf20d51fd7d2e03143cc Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Fri, 10 Apr 2020 22:18:53 -0700 Subject: [PATCH 30/30] missing comma --- code/_globalvars/bitfields.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/_globalvars/bitfields.dm b/code/_globalvars/bitfields.dm index 488926e078..f0c854c398 100644 --- a/code/_globalvars/bitfields.dm +++ b/code/_globalvars/bitfields.dm @@ -253,7 +253,7 @@ GLOBAL_LIST_INIT(bitfields, list( "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_COMBINED_W_CLASS" = STORAGE_LIMIT_COMBINED_W_CLASS, "STORAGE_LIMIT_VOLUME" = STORAGE_LIMIT_VOLUME ) ))