mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Improves Bluespace Lockers event (#11892)
Co-authored-by: Cameron Lennox <killer65311@gmail.com>
This commit is contained in:
@@ -8,42 +8,45 @@
|
||||
/area/rnd/test_area,
|
||||
/area/solar
|
||||
)
|
||||
var/list/area/pickable_areas
|
||||
|
||||
/datum/event/bluespace_locker/setup()
|
||||
var/list/area/pickable_areas = get_station_areas(excluded)
|
||||
pickable_areas = get_station_areas(excluded)
|
||||
|
||||
for(var/i in 1 to 10)
|
||||
var/area/picked_area = pick(pickable_areas)
|
||||
var/list/obj/structure/closet/entry_points = list()
|
||||
var/list/obj/structure/closet/exit_points = list()
|
||||
for(var/i in 1 to 15)
|
||||
if(entry_point)
|
||||
continue
|
||||
entry_point = pick_locker(pickable_areas)
|
||||
for(var/i in 1 to 15)
|
||||
if(exit_point)
|
||||
continue
|
||||
exit_point = pick_locker(pickable_areas, TRUE, TRUE)
|
||||
|
||||
for(var/obj/structure/closet/closet in picked_area)
|
||||
// Only the standing lockers
|
||||
if(istype(closet, /obj/structure/closet/crate) || istype(closet, /obj/structure/closet/walllocker))
|
||||
continue
|
||||
if(!closet.can_open()) // Skip locked/welded ones
|
||||
continue
|
||||
entry_points.Add(closet)
|
||||
pickable_areas.Remove(picked_area)
|
||||
|
||||
// After that, choose another area
|
||||
picked_area = pick(pickable_areas)
|
||||
|
||||
// And for the fun of it, pick any locker or crate. Locked or not.
|
||||
for(var/obj/structure/closet/closet in picked_area)
|
||||
exit_points.Add(closet)
|
||||
|
||||
if(length(entry_points) && length(exit_points))
|
||||
entry_point = pick(entry_points)
|
||||
exit_point = pick(exit_points)
|
||||
announceWhen = rand(10 SECONDS, 2 MINUTES)
|
||||
endWhen = announceWhen + 1
|
||||
return
|
||||
if(entry_point && exit_point)
|
||||
announceWhen = rand(10 SECONDS, 2 MINUTES)
|
||||
endWhen = announceWhen + 1
|
||||
return TRUE
|
||||
|
||||
log_game("Bluespace Locker Event: Giving up after too many failures to pick valid candidates.")
|
||||
kill()
|
||||
return
|
||||
|
||||
/datum/event/bluespace_locker/proc/pick_locker(var/list/areas, var/crates = FALSE, var/sealed = FALSE)
|
||||
var/area/picked_area = pick(areas)
|
||||
var/list/obj/structure/closet/valid_lockers = list()
|
||||
|
||||
for(var/obj/structure/closet/closet in picked_area)
|
||||
if((istype(closet, /obj/structure/closet/crate) && crates) || (istype(closet, /obj/structure/closet/walllocker) && crates))
|
||||
continue
|
||||
if(!closet.can_open() && sealed)
|
||||
continue
|
||||
valid_lockers.Add(closet)
|
||||
pickable_areas.Remove(picked_area)
|
||||
|
||||
if(!isemptylist(valid_lockers))
|
||||
return pick(valid_lockers)
|
||||
return FALSE
|
||||
|
||||
/datum/event/bluespace_locker/start()
|
||||
if(!entry_point || !exit_point)
|
||||
return
|
||||
@@ -51,7 +54,7 @@
|
||||
entry_point.AddComponent(/datum/component/bluespace_connection, list(exit_point))
|
||||
exit_point.AddComponent(/datum/component/bluespace_connection, list(entry_point))
|
||||
|
||||
log_and_message_admins("Bluespace lockers linked. Entry: [get_area(exit_point)] Exit: [get_area(entry_point)]")
|
||||
log_and_message_admins("Bluespace lockers linked. Entry: [get_area(entry_point)] Exit: [get_area(exit_point)]")
|
||||
|
||||
/datum/event/bluespace_locker/announce()
|
||||
command_announcement.Announce("Bluespace anomaly detected near [station_name()]. Monitor sensitive equipment for malfunctions.", "Anomaly Alert")
|
||||
command_announcement.Announce("Bluespace anomaly detected near [station_name()]. Possible location, [get_area(pick(entry_point, exit_point))].", "Anomaly Alert")
|
||||
|
||||
Reference in New Issue
Block a user