Adds new helpers for area calculation

Fixes champagne
This commit is contained in:
C.L
2022-09-30 00:59:37 -04:00
parent 74fecd3358
commit 100e62f4f2
2 changed files with 27 additions and 1 deletions
+26
View File
@@ -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
+1 -1
View File
@@ -47,7 +47,7 @@
to_chat(user, "<span class='warning'>[comp] is already in a shuttle.</span>")
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, "<span class='warning'>The new shuttle area is too large.</span>")
return