From 100e62f4f2ea63f62983c3b7fe879916c4672e46 Mon Sep 17 00:00:00 2001 From: "C.L" Date: Fri, 30 Sep 2022 00:59:37 -0400 Subject: [PATCH] Adds new helpers for area calculation Fixes champagne --- code/_helpers/unsorted.dm | 26 ++++++++++++++++++++++++++ code/modules/overmap/champagne.dm | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/code/_helpers/unsorted.dm b/code/_helpers/unsorted.dm index 84844936c4..d0a7bff2e0 100644 --- a/code/_helpers/unsorted.dm +++ b/code/_helpers/unsorted.dm @@ -643,6 +643,20 @@ Turf and target are seperate in case you want to teleport some distance from a t for(var/turf/T in N) turfs += T return turfs + +//Takes: An instance of the area. +//Returns: A list of all turfs in that area. +//Side note: I don't know why this was never a thing. Did everyone just ignore the Blueprint item?! - C.L. +/proc/get_current_area_turfs(var/area/checked_area) + if(!checked_area) + return null + + var/list/turfs = new/list() + for(var/turf/counted_turfs in checked_area.contents) //Cheap. Efficient. Lovely. + turfs += counted_turfs + return turfs + + //Takes: Area type as text string or as typepath OR an instance of the area. //Returns: A list of all atoms (objs, turfs, mobs) in areas of that type of that type in the world. /proc/get_area_all_atoms(var/areatype) @@ -659,6 +673,18 @@ Turf and target are seperate in case you want to teleport some distance from a t atoms += A return atoms + +//Takes: Area as an instance of the area. +//Returns: A list of all atoms (objs, turfs, mobs) in the selected area. +/proc/get_current_area_atoms(var/area/checked_area) + if(!checked_area) + return null + + var/list/atoms = new/list() + for(var/atom/A in checked_area.contents) + atoms += A + return atoms + /datum/coords //Simple datum for storing coordinates. var/x_pos = null var/y_pos = null diff --git a/code/modules/overmap/champagne.dm b/code/modules/overmap/champagne.dm index 0d36766535..593be7f2a6 100644 --- a/code/modules/overmap/champagne.dm +++ b/code/modules/overmap/champagne.dm @@ -47,7 +47,7 @@ to_chat(user, "[comp] is already in a shuttle.") return // Count turfs in the area - var/list/turfs = get_area_turfs(my_area) + var/list/turfs = get_current_area_turfs(my_area) if(turfs.len > max_area_turfs) to_chat(user, "The new shuttle area is too large.") return