Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 23 additions & 9 deletions yogstation/code/controllers/subsystem/bluespace_locker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,30 @@ SUBSYSTEM_DEF(bluespace_locker)
if(external_locker)
return
// basically any normal-looking locker that isn't a secure one
var/list/valid_lockers = typecacheof(typesof(/obj/structure/closet) - typesof(/obj/structure/closet/body_bag)\
- typesof(/obj/structure/closet/secure_closet) - typesof(/obj/structure/closet/cabinet)\
- typesof(/obj/structure/closet/cardboard) - typesof(/obj/structure/closet/crate)\
- typesof(/obj/structure/closet/supplypod) - typesof(/obj/structure/closet/stasis)\
- typesof(/obj/structure/closet/abductor) - typesof(/obj/structure/closet/bluespace), only_root_path = TRUE)
var/list/valid_lockers = typecacheof(typesof(/obj/structure/closet) - typesof(/obj/structure/closet/body_bag) \
- typesof(/obj/structure/closet/secure_closet) - typesof(/obj/structure/closet/cabinet) \
- typesof(/obj/structure/closet/cardboard) - typesof(/obj/structure/closet/crate) \
- typesof(/obj/structure/closet/supplypod) - typesof(/obj/structure/closet/stasis) \
- typesof(/obj/structure/closet/abductor) - typesof(/obj/structure/closet/bluespace), only_root_path = TRUE)
var/list/invalid_areas = typecacheof(list(/area/bridge, /area/crew_quarters/heads, /area/comms, /area/server, \
/area/engine/engine_smes, /area/engine/gravity_generator, /area/teleporter, /area/gateway, /area/medical/virology, \
/area/security, /area/quartermaster/qm, /area/storage/eva, /area/ai_monitored, /area/tcommsat))

var/list/lockers_list = list()
for(var/obj/structure/closet/L in GLOB.lockers)
if(is_station_level(L.z) && is_type_in_typecache(L, valid_lockers))
lockers_list += L
if (!is_station_level(L.z))
continue
if (!is_type_in_typecache(L, valid_lockers))
continue
var/area/A = get_area(L)
if (is_type_in_typecache(A, invalid_areas))
continue
if (L.secure || L.welded || L.wall_mounted)
continue
var/score = 1
if (L.locked)
score -= 0.25
lockers_list[L] = score
if(!lockers_list.len)
// Congratulations, you managed to destroy all the lockers somehow.
// Now let's make a new one.
Expand All @@ -33,8 +47,8 @@ SUBSYSTEM_DEF(bluespace_locker)
targetturf = get_turf(pick(GLOB.blobstart))
else
CRASH("Unable to find a blobstart landmark")
lockers_list += new /obj/structure/closet(targetturf)
var/obj/structure/closet/L = pick(lockers_list)
lockers_list[new /obj/structure/closet(targetturf)] = 1
var/obj/structure/closet/L = pickweight(lockers_list)

var/obj/structure/closet/bluespace/external/E = new(L.loc)
E.contents = L.contents
Expand Down