Minor storage & SSair init fixes (#3049)

changes:

Storage objects can now defer shrinkwrapping of contents until the next stackframe if things are being put in them without using fill() (such as autodrobes & BSTs)
SSair init properly yells at the admins when it's done.
This commit is contained in:
Lohikar
2017-07-15 18:06:00 -05:00
committed by skull132
parent 8f5ee87e48
commit 4e0057daa0
4 changed files with 13 additions and 6 deletions
@@ -521,7 +521,7 @@
/obj/item/weapon/storage/proc/fill()
return
/obj/item/weapon/storage/Initialize(mapload)
/obj/item/weapon/storage/Initialize(mapload, defer_shrinkwrap = FALSE)
. = ..()
if (max_storage_space > STORAGE_SPACE_CAP)
@@ -561,6 +561,13 @@
closer.master = src
orient2hud(null, mapload)
if (defer_shrinkwrap) // Caller wants to defer shrinkwrapping until after the current callstack; probably putting something in.
addtimer(CALLBACK(src, .proc/shrinkwrap), 0)
else
shrinkwrap()
// Adjusts this storage object's max capacity to exactly the storage required by its contents. Will not decrease max storage capacity, only increase it.
/obj/item/weapon/storage/proc/shrinkwrap()
var/total_storage_space = 0
for(var/obj/item/I in contents)
total_storage_space += I.get_storage_cost()