This commit is contained in:
silicons
2020-09-16 00:07:33 -07:00
parent 15b705dd37
commit 17b21d29f3
4 changed files with 91 additions and 1 deletions
+2 -1
View File
@@ -43,6 +43,7 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
outdoors = TRUE
ambientsounds = SPACE
blob_allowed = FALSE //Eating up space doesn't count for victory as a blob.
considered_hull_exterior = TRUE
/area/space/nearstation
icon_state = "space_near"
@@ -1592,4 +1593,4 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
valid_territory = FALSE
outdoors = TRUE
ambientsounds = SPACE
blob_allowed = FALSE //While part of the station, what good will it do you?
blob_allowed = FALSE //While part of the station, what good will it do you?
+3
View File
@@ -34,6 +34,9 @@
/// If megafauna can be spawned by natural random generation
var/megafauna_spawn_allowed = FALSE
/// Considered space for hull shielding
var/considered_hull_exterior = FALSE
var/fire = null
var/atmos = TRUE
var/atmosalm = FALSE
+85
View File
@@ -0,0 +1,85 @@
//////// HELPER FILE FOR SHIELDING /////////
// HULL SHIELD GENERATION HELPERS
/**
* Gets hull exterior adjacent tiles of a certain area
* Area method.
* EXPENSIVE.
* If the area itself is already considered exterior, it'll find all tiles inside it that's next to an interior area.
*/
/proc/hull_shielding_get_tiles_around_area(area/instance, check_tick = FALSE)
var/list/cache = list()
var/area/A
if(instance.considered_hull_exterior)
for(var/turf/potential in instance)
for(var/turf/looking in orange(1, potential))
A = looking.loc
if(!A.considered_hull_exterior)
cache[potential] = TRUE // we're the exterior area, grab the one that's reaching out
if(check_tick)
CHECK_TICK
else
for(var/turf/potential in instance)
for(var/turf/looking in orange(1, potential))
A = looking.loc
if(A.considered_hull_exterior)
cache[looking] = TRUE // we're not the exterior area, grab the one that's being reached to
if(check_tick)
CHECK_TICK
. = list()
for(var/i in cache)
. += i // strip assoc value
/**
* Gets hull adjacent exterior tiles of an entire zlevel
* EXPENSIVE.
* Gets the tiles in the exterior area touching to a non-exterior area
*/
/proc/hull_shielding_get_tiles_in_z(zlevel, check_tick = FALSE, recurse = FALSE, list/outlist = list(), list/scanned_zlevels = list())
. = outlist
if(zlevel in scanned_zlevels)
return
scanned_zlevels |= zlevel
if(recurse)
var/up = SSmapping.level_trait(zlevel, ZTRAIT_UP)
var/down = SSmapping.level_trait(zlevel, ZTRAIT_DOWN)
if(isnum(up) && (up != 0))
hull_shielding_get_tiles_in_z(up, check_tick, recurse, outlist, scanned_zlevels)
if(isnum(down) && (down != 0))
hull_shielding_get_tiles_in_z(down, check_tick, recurse, outlist, scanned_zlevels)
// sigh. why.
var/turf/potential
var/area/p_area
var/area/l_area
for(var/x in 1 to world.maxx)
for(var/y in 1 to world.maxy)
if(check_tick)
CHECK_TICK
potential = locate(x, y)
p_area = potential.loc
if(!p_area.considered_hull_exterior)
continue
for(var/turf/looking in orange(1, potential))
l_area = looking.loc
if(!l_area.considered_hull_exterior)
outlist += potential
/proc/debug1(area/A)
for(var/turf/T in hull_shielding_get_tiles_around_area(A, FALSE))
T.maptext = "Found"
T.plane = 50
T.layer = 50
spawn(100)
T.maptext = null
T.plane = initial(T.plane)
T.layer = initial(T.layer)
/proc/debug2(z)
for(var/turf/T in hull_shielding_get_tiles_in_z(z, FALSE, TRUE))
T.maptext = "Found"
T.plane = 50
T.layer = 50
spawn(100)
T.maptext = null
T.plane = initial(T.plane)
T.layer = initial(T.layer)
+1
View File
@@ -3287,6 +3287,7 @@
#include "code\modules\ruins\spaceruin_code\whiteshipruin_box.dm"
#include "code\modules\security_levels\keycard_authentication.dm"
#include "code\modules\security_levels\security_levels.dm"
#include "code\modules\shielding\helpers.dm"
#include "code\modules\shuttle\arrivals.dm"
#include "code\modules\shuttle\assault_pod.dm"
#include "code\modules\shuttle\computer.dm"