Minor refactor to storage items (#31324)
They now do not call the on exit storage hook when items are being deleted, as well as do not bother to reset a bunch of values we now cache the see contents list for a very small speed boost the fancy storage specific update icon is moved to the fancy storage equivalent proc
This commit is contained in:
committed by
CitadelStationBot
parent
c222fa42f9
commit
bf7f4e6e69
@@ -58,7 +58,9 @@
|
|||||||
|
|
||||||
/obj/item/storage/fancy/remove_from_storage(obj/item/W, atom/new_location, burn = 0)
|
/obj/item/storage/fancy/remove_from_storage(obj/item/W, atom/new_location, burn = 0)
|
||||||
fancy_open = TRUE
|
fancy_open = TRUE
|
||||||
return ..()
|
. = ..()
|
||||||
|
//Recall update icon with the fancy item snowflake arg (ugh)
|
||||||
|
update_icon(1)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Donut Box
|
* Donut Box
|
||||||
|
|||||||
@@ -359,35 +359,43 @@
|
|||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|
||||||
//Call this proc to handle the removal of an item from the storage item. The item will be moved to the atom sent as new_target
|
//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
|
||||||
/obj/item/storage/proc/remove_from_storage(obj/item/W, atom/new_location)
|
/obj/item/storage/proc/remove_from_storage(obj/item/W, atom/new_location)
|
||||||
if(!istype(W))
|
if(!istype(W))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if(istype(src, /obj/item/storage/fancy))
|
//Cache this as it should be reusable down the bottom, will not apply if anyone adds a sleep to dropped
|
||||||
var/obj/item/storage/fancy/F = src
|
//or moving objects, things that should never happen
|
||||||
F.update_icon(1)
|
var/list/seeing_mobs = can_see_contents()
|
||||||
|
for(var/mob/M in seeing_mobs)
|
||||||
for(var/mob/M in can_see_contents())
|
M.client.screen -= W
|
||||||
if(M.client)
|
|
||||||
M.client.screen -= W
|
|
||||||
|
|
||||||
if(ismob(loc))
|
if(ismob(loc))
|
||||||
var/mob/M = loc
|
var/mob/M = loc
|
||||||
W.dropped(M)
|
W.dropped(M)
|
||||||
W.layer = initial(W.layer)
|
|
||||||
W.plane = initial(W.plane)
|
|
||||||
W.forceMove(new_location)
|
|
||||||
|
|
||||||
for(var/mob/M in can_see_contents())
|
if(new_location)
|
||||||
|
W.forceMove(new_location)
|
||||||
|
//Reset the items values
|
||||||
|
W.layer = initial(W.layer)
|
||||||
|
W.plane = initial(W.plane)
|
||||||
|
W.mouse_opacity = initial(W.mouse_opacity)
|
||||||
|
if(W.maptext)
|
||||||
|
W.maptext = ""
|
||||||
|
//We don't want to call this if the item is being destroyed
|
||||||
|
W.on_exit_storage(src)
|
||||||
|
|
||||||
|
else
|
||||||
|
//Being destroyed, just move to nullspace now (so it's not in contents for the icon update)
|
||||||
|
W.moveToNullspace()
|
||||||
|
|
||||||
|
|
||||||
|
for(var/mob/M in seeing_mobs)
|
||||||
orient2hud(M)
|
orient2hud(M)
|
||||||
show_to(M)
|
show_to(M)
|
||||||
|
|
||||||
if(W.maptext)
|
|
||||||
W.maptext = ""
|
|
||||||
W.on_exit_storage(src)
|
|
||||||
update_icon()
|
update_icon()
|
||||||
W.mouse_opacity = initial(W.mouse_opacity)
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
/obj/item/storage/deconstruct(disassembled = TRUE)
|
/obj/item/storage/deconstruct(disassembled = TRUE)
|
||||||
|
|||||||
Reference in New Issue
Block a user