From 1211cf43e914a6e0eb8126ec2c0d55d1a8c0048e Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Sun, 27 Oct 2019 20:25:07 -0700 Subject: [PATCH 1/4] Update storage.dm --- code/datums/components/storage/storage.dm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm index 9f6ca0ffbb..308096f8db 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -146,6 +146,9 @@ var/datum/component/storage/concrete/master = master() return master? master.real_location() : null +/datum/component/storage/proc/accessible_items() + return contents() + /datum/component/storage/proc/canreach_react(datum/source, list/next) var/datum/component/storage/concrete/master = master() if(!master) From d390dc30fd5a0ff7ac4d5e5c371c1a1336d23a3c Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Sun, 27 Oct 2019 20:35:27 -0700 Subject: [PATCH 2/4] Update storage.dm --- code/datums/components/storage/storage.dm | 29 +++++++++++++++++------ 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm index 308096f8db..526f24e15d 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -57,6 +57,10 @@ var/screen_start_x = 4 //These two are where the storage starts being rendered, screen_loc wise. var/screen_start_y = 2 //End + + var/limited_random_access = FALSE //Quick if statement in accessible_items to determine if we care at all about what people can access at once. + var/limited_random_access_stack_position = 0 //If >0, can only access top items + var/limited_random_access_stack_bottom_up = FALSE //If TRUE, above becomes bottom items /datum/component/storage/Initialize(datum/component/storage/concrete/master) if(!isatom(parent)) @@ -146,8 +150,18 @@ var/datum/component/storage/concrete/master = master() return master? master.real_location() : null -/datum/component/storage/proc/accessible_items() - return contents() +//What players can access +//this proc can probably eat a refactor at some point. +/datum/component/storage/proc/accessible_items(random_access = TRUE) + var/list/contents = contents() + if(contents) + if(limited_random_access && random_access) + if(limited_radnom_access_stack_position && (length(contents) > limited_random_access_stack_position)) + if(limited_random_acccess_stack_bottom_up) + contents.Cut(1, limited_random_access_stack_position + 1) + else + contents.Cut(1, length(contents) - limited_random_access_stack_position + 1) + return contents /datum/component/storage/proc/canreach_react(datum/source, list/next) var/datum/component/storage/concrete/master = master() @@ -288,7 +302,7 @@ /datum/component/storage/proc/_process_numerical_display() . = list() var/atom/real_location = real_location() - for(var/obj/item/I in real_location.contents) + for(var/obj/item/I in accessible_items()) if(QDELETED(I)) continue if(!.[I.type]) @@ -300,7 +314,8 @@ //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/atom/real_location = real_location() - var/adjusted_contents = real_location.contents.len + var/accessible_contents = accessible_items() + var/adjusted_contents = accessible_contents.len //Numbered contents display var/list/datum/numbered_display/numbered_contents @@ -333,7 +348,7 @@ break else var/atom/real_location = real_location() - for(var/obj/O in real_location) + 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" @@ -356,7 +371,7 @@ var/maxallowedscreensize = cview[1]-8 var/atom/real_location = real_location() if(M.active_storage != src && (M.stat == CONSCIOUS)) - for(var/obj/item/I in real_location) + for(var/obj/item/I in accessible_items()) if(I.on_found(M)) return FALSE if(M.active_storage) @@ -364,7 +379,7 @@ orient2hud(M, (isliving(M) ? maxallowedscreensize : 7)) M.client.screen |= boxes M.client.screen |= closer - M.client.screen |= real_location.contents + M.client.screen |= accessible_items() M.active_storage = src LAZYOR(is_using, M) return TRUE From d7e8b5209f01a4ee0288e50bc940a09ebcc5988d Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Sun, 27 Oct 2019 20:36:32 -0700 Subject: [PATCH 3/4] Update bags.dm --- code/game/objects/items/storage/bags.dm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/game/objects/items/storage/bags.dm b/code/game/objects/items/storage/bags.dm index 13efe72686..eafa79798e 100644 --- a/code/game/objects/items/storage/bags.dm +++ b/code/game/objects/items/storage/bags.dm @@ -49,6 +49,8 @@ STR.max_combined_w_class = 30 STR.max_items = 30 STR.cant_hold = typecacheof(list(/obj/item/disk/nuclear)) + STR.limited_random_access = TRUE + STR.limited_random_access_stack_position = 3 /obj/item/storage/bag/trash/suicide_act(mob/user) user.visible_message("[user] puts [src] over [user.p_their()] head and starts chomping at the insides! Disgusting!") @@ -88,6 +90,7 @@ var/datum/component/storage/STR = GetComponent(/datum/component/storage) STR.max_combined_w_class = 60 STR.max_items = 60 + STR.limited_random_access_stack_position = 5 /obj/item/storage/bag/trash/bluespace/cyborg insertable = FALSE From 46dabe25bb7999f0adec3cb995a778cac10da648 Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Sun, 27 Oct 2019 21:35:37 -0700 Subject: [PATCH 4/4] Update storage.dm --- code/datums/components/storage/storage.dm | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm index 526f24e15d..a92ae9e629 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -156,8 +156,8 @@ var/list/contents = contents() if(contents) if(limited_random_access && random_access) - if(limited_radnom_access_stack_position && (length(contents) > limited_random_access_stack_position)) - if(limited_random_acccess_stack_bottom_up) + if(limited_random_access_stack_position && (length(contents) > limited_random_access_stack_position)) + if(limited_random_access_stack_bottom_up) contents.Cut(1, limited_random_access_stack_position + 1) else contents.Cut(1, length(contents) - limited_random_access_stack_position + 1) @@ -301,7 +301,6 @@ /datum/component/storage/proc/_process_numerical_display() . = list() - var/atom/real_location = real_location() for(var/obj/item/I in accessible_items()) if(QDELETED(I)) continue @@ -313,9 +312,8 @@ //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/atom/real_location = real_location() - var/accessible_contents = accessible_items() - var/adjusted_contents = accessible_contents.len + var/list/accessible_contents = accessible_items() + var/adjusted_contents = length(accessible_contents) //Numbered contents display var/list/datum/numbered_display/numbered_contents @@ -347,7 +345,6 @@ if(cy - screen_start_y >= rows) break else - var/atom/real_location = real_location() for(var/obj/O in accessible_items()) if(QDELETED(O)) continue @@ -369,7 +366,6 @@ return FALSE var/list/cview = getviewsize(M.client.view) var/maxallowedscreensize = cview[1]-8 - var/atom/real_location = real_location() if(M.active_storage != src && (M.stat == CONSCIOUS)) for(var/obj/item/I in accessible_items()) if(I.on_found(M))