Unusual Container Fixes (#13969)

This commit is contained in:
Doxxmedearly
2022-05-16 12:40:42 +02:00
committed by GitHub
parent cf3839d527
commit 05d908103d
3 changed files with 19 additions and 9 deletions
@@ -73,10 +73,11 @@
if(content_size > storage_capacity-5)
storage_capacity = content_size + 5
/obj/structure/closet/Initialize(mapload)
/obj/structure/closet/Initialize(mapload, var/no_fill)
. = ..()
update_icon()
fill()
if(!no_fill)
fill()
if(secure)
verbs += /obj/structure/closet/proc/verb_togglelock
return mapload ? INITIALIZE_HINT_LATELOAD : INITIALIZE_HINT_NORMAL
@@ -539,20 +539,24 @@
"3" = (100 - ((STOCK_RARE_PROB * rarity) + (STOCK_UNCOMMON_PROB * rarity)))
)
var/list/valid_loot = typesof(/obj/structure/closet/crate) - typesof(/obj/structure/closet/crate/secure/gear_loadout)
valid_loot -= typesof(/obj/structure/closet/crate/loot)
var/icontype = pick(valid_loot)
var/obj/structure/closet/crate/C = new icontype(get_turf(src))
var/list/crates_to_use = typesof(/obj/structure/closet/crate) - typesof(/obj/structure/closet/crate/secure/gear_loadout)
var/icontype = pick(crates_to_use)
var/obj/structure/closet/crate/C = new icontype(get_turf(src), TRUE) //TRUE as we do not want the crate to fill(), we will fill it ourselves.
C.name = "unusual container"
C.desc = "A mysterious container of unknown origins. What mysteries lie within?"
if(C.secure)
C.secure = FALSE
C.update_icon()
for(var/i in 1 to quantity)
var/newtype = get_spawntype()
call(newtype)(C)
if(C.secure || C.locked) //These should always be accessible
C.secure = FALSE
C.locked = FALSE
C.secure_lights = FALSE
C.req_access = null
C.update_icon()
qdel(src)
/obj/structure/closet/crate/loot/proc/get_spawntype()