storage gets LateInitializeName

LateInitializeName allows storage items to set their name flexibly
after normal initialization is completed, allowing it to be based on
holder, contents, location, etc.

Also hoisted storage/internal/Destroy to its rightful place.
This commit is contained in:
spookerton
2022-11-14 11:36:22 +00:00
parent d0ca6c36b8
commit be93f20599
2 changed files with 24 additions and 8 deletions
@@ -4,18 +4,24 @@
preserve_item = 1
var/atom/movable/master_atom
/obj/item/storage/internal/Initialize()
. = ..()
master_atom = loc
if(!istype(master_atom))
return INITIALIZE_HINT_QDEL
loc = master_atom
name = master_atom.name
verbs -= /obj/item/verb/verb_pickup //make sure this is never picked up.
/obj/item/storage/internal/Destroy()
master_atom = null
return ..()
/obj/item/storage/internal/Initialize()
. = ..()
master_atom = loc
if (!istype(master_atom))
return INITIALIZE_HINT_QDEL
loc = master_atom
verbs -= /obj/item/verb/verb_pickup
/obj/item/storage/internal/LateInitializeName()
name = master_atom.name
/obj/item/storage/internal/attack_hand()
return //make sure this is never picked up
@@ -96,6 +96,11 @@
new newtype (src)
starts_with = null
calibrate_size()
return INITIALIZE_HINT_LATELOAD
/obj/item/storage/LateInitialize()
LateInitializeName()
/obj/item/storage/MouseDrop(obj/over_object as obj)
@@ -666,6 +671,11 @@
max_w_class = max(I.w_class, max_w_class)
max_storage_space += I.get_storage_cost()
/obj/item/storage/proc/LateInitializeName()
return
/*
* Trinket Box - READDING SOON
*/