|
|
|
@@ -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 <x> items
|
|
|
|
|
var/limited_random_access_stack_bottom_up = FALSE //If TRUE, above becomes bottom <x> items
|
|
|
|
|
|
|
|
|
|
/datum/component/storage/Initialize(datum/component/storage/concrete/master)
|
|
|
|
|
if(!isatom(parent))
|
|
|
|
@@ -96,6 +100,7 @@
|
|
|
|
|
RegisterSignal(parent, COMSIG_ITEM_PICKUP, .proc/signal_on_pickup)
|
|
|
|
|
|
|
|
|
|
RegisterSignal(parent, COMSIG_MOVABLE_POST_THROW, .proc/close_all)
|
|
|
|
|
RegisterSignal(parent, COMSIG_MOVABLE_MOVED, .proc/check_views)
|
|
|
|
|
|
|
|
|
|
RegisterSignal(parent, COMSIG_CLICK_ALT, .proc/on_alt_click)
|
|
|
|
|
RegisterSignal(parent, COMSIG_MOUSEDROP_ONTO, .proc/mousedrop_onto)
|
|
|
|
@@ -145,6 +150,19 @@
|
|
|
|
|
var/datum/component/storage/concrete/master = master()
|
|
|
|
|
return master? master.real_location() : null
|
|
|
|
|
|
|
|
|
|
//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_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)
|
|
|
|
|
return contents
|
|
|
|
|
|
|
|
|
|
/datum/component/storage/proc/canreach_react(datum/source, list/next)
|
|
|
|
|
var/datum/component/storage/concrete/master = master()
|
|
|
|
|
if(!master)
|
|
|
|
@@ -283,8 +301,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])
|
|
|
|
@@ -296,8 +313,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/list/accessible_contents = accessible_items()
|
|
|
|
|
var/adjusted_contents = length(accessible_contents)
|
|
|
|
|
|
|
|
|
|
//Numbered contents display
|
|
|
|
|
var/list/datum/numbered_display/numbered_contents
|
|
|
|
@@ -329,8 +346,7 @@
|
|
|
|
|
if(cy - screen_start_y >= rows)
|
|
|
|
|
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"
|
|
|
|
@@ -351,9 +367,8 @@
|
|
|
|
|
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 real_location)
|
|
|
|
|
for(var/obj/item/I in accessible_items())
|
|
|
|
|
if(I.on_found(M))
|
|
|
|
|
return FALSE
|
|
|
|
|
if(M.active_storage)
|
|
|
|
@@ -361,7 +376,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
|
|
|
|
@@ -387,6 +402,11 @@
|
|
|
|
|
close(M)
|
|
|
|
|
. = TRUE //returns TRUE if any mobs actually got a close(M) call
|
|
|
|
|
|
|
|
|
|
/datum/component/storage/proc/check_views()
|
|
|
|
|
for(var/mob/M in can_see_contents())
|
|
|
|
|
if(!isobserver(M) && !M.CanReach(src, view_only = TRUE))
|
|
|
|
|
close(M)
|
|
|
|
|
|
|
|
|
|
/datum/component/storage/proc/emp_act(datum/source, severity)
|
|
|
|
|
if(emp_shielded)
|
|
|
|
|
return
|
|
|
|
@@ -588,7 +608,7 @@
|
|
|
|
|
return FALSE
|
|
|
|
|
if(isitem(host))
|
|
|
|
|
var/obj/item/IP = host
|
|
|
|
|
GET_COMPONENT_FROM(STR_I, /datum/component/storage, I)
|
|
|
|
|
var/datum/component/storage/STR_I = I.GetComponent(/datum/component/storage)
|
|
|
|
|
if((I.w_class >= IP.w_class) && STR_I && !allow_big_nesting)
|
|
|
|
|
if(!stop_messages)
|
|
|
|
|
to_chat(M, "<span class='warning'>[IP] cannot hold [I] as it's a storage item of the same size!</span>")
|
|
|
|
|