Skip to content

Commit 54865cb

Browse files
committed
Merge branch 'master' into hitby_refactor
2 parents 154739c + 13082e7 commit 54865cb

File tree

105 files changed

+751
-312
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+751
-312
lines changed

aurorastation.dme

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@
8282
#include "code\__DEFINES\lighting.dm"
8383
#include "code\__DEFINES\logging.dm"
8484
#include "code\__DEFINES\machinery.dm"
85+
#include "code\__DEFINES\mapping.dm"
86+
#include "code\__DEFINES\maps.dm"
8587
#include "code\__DEFINES\materials.dm"
8688
#include "code\__DEFINES\math_physics.dm"
8789
#include "code\__DEFINES\maths.dm"
@@ -94,6 +96,7 @@
9496
#include "code\__DEFINES\modular_guns.dm"
9597
#include "code\__DEFINES\move_force.dm"
9698
#include "code\__DEFINES\movement.dm"
99+
#include "code\__DEFINES\multiz.dm"
97100
#include "code\__DEFINES\obj.dm"
98101
#include "code\__DEFINES\organs.dm"
99102
#include "code\__DEFINES\origin_traits.dm"
@@ -2399,25 +2402,30 @@
23992402
#include "code\modules\lock\lock.dm"
24002403
#include "code\modules\lock\lock_construct.dm"
24012404
#include "code\modules\makeshift\makeshift_reagents.dm"
2402-
#include "code\modules\maps\dmm_suite.dm"
2403-
#include "code\modules\maps\helper_landmarks.dm"
2404-
#include "code\modules\maps\map_template.dm"
2405-
#include "code\modules\maps\reader.dm"
2406-
#include "code\modules\maps\ruins.dm"
2407-
#include "code\modules\maps\swapmaps.dm"
2408-
#include "code\modules\maps\planet_types\asteroid.dm"
2409-
#include "code\modules\maps\planet_types\barren.dm"
2410-
#include "code\modules\maps\planet_types\crystal.dm"
2411-
#include "code\modules\maps\planet_types\desert.dm"
2412-
#include "code\modules\maps\planet_types\grass.dm"
2413-
#include "code\modules\maps\planet_types\jungle.dm"
2414-
#include "code\modules\maps\planet_types\lava.dm"
2415-
#include "code\modules\maps\planet_types\snow.dm"
2416-
#include "code\modules\maps\planet_types\lore\burzsia.dm"
2417-
#include "code\modules\maps\planet_types\lore\konyang.dm"
2418-
#include "code\modules\maps\planet_types\lore\srandmarr.dm"
2419-
#include "code\modules\maps\planet_types\lore\tauceti.dm"
2420-
#include "code\modules\maps\planet_types\lore\uueoaesa.dm"
2405+
#include "code\modules\mapping\dmm_suite.dm"
2406+
#include "code\modules\mapping\helper_landmarks.dm"
2407+
#include "code\modules\mapping\map_template.dm"
2408+
#include "code\modules\mapping\reader.dm"
2409+
#include "code\modules\mapping\ruins.dm"
2410+
#include "code\modules\mapping\swapmaps.dm"
2411+
#include "code\modules\mapping\planet_types\asteroid.dm"
2412+
#include "code\modules\mapping\planet_types\barren.dm"
2413+
#include "code\modules\mapping\planet_types\crystal.dm"
2414+
#include "code\modules\mapping\planet_types\desert.dm"
2415+
#include "code\modules\mapping\planet_types\grass.dm"
2416+
#include "code\modules\mapping\planet_types\jungle.dm"
2417+
#include "code\modules\mapping\planet_types\lava.dm"
2418+
#include "code\modules\mapping\planet_types\snow.dm"
2419+
#include "code\modules\mapping\planet_types\lore\burzsia.dm"
2420+
#include "code\modules\mapping\planet_types\lore\konyang.dm"
2421+
#include "code\modules\mapping\planet_types\lore\srandmarr.dm"
2422+
#include "code\modules\mapping\planet_types\lore\tauceti.dm"
2423+
#include "code\modules\mapping\planet_types\lore\uueoaesa.dm"
2424+
#include "code\modules\mapping\space_management\space_level.dm"
2425+
#include "code\modules\mapping\space_management\space_reservation.dm"
2426+
#include "code\modules\mapping\space_management\space_transition.dm"
2427+
#include "code\modules\mapping\space_management\traits.dm"
2428+
#include "code\modules\mapping\space_management\zlevel_manager.dm"
24212429
#include "code\modules\martial_arts\gunkata.dm"
24222430
#include "code\modules\martial_arts\martial.dm"
24232431
#include "code\modules\martial_arts\plasma_fist.dm"

bapi.dll

45.7 KB
Binary file not shown.

code/__DEFINES/_flags.dm

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,16 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204
5050
#define PASSDOORHATCH (1<<15)
5151
#define PASSTRACE (1<<16) //Used by turrets in the check_trajectory proc to target mobs hiding behind certain things (such as closets)
5252
#define PASSRAILING (1<<17)
53+
54+
//TURF FLAGS
55+
/// If a turf is an usused reservation turf awaiting assignment
56+
#define UNUSED_RESERVATION_TURF BITFLAG(1)
57+
/// If a turf is a reserved turf
58+
#define RESERVATION_TURF BITFLAG(2)
59+
60+
// Turf-only flags.
61+
///Blocks the jaunting spell from accessing the turf
62+
#define TURF_FLAG_NOJAUNT BITFLAG(3)
63+
64+
///Used by shuttle movement to determine if it should be ignored by turf translation
65+
#define TURF_FLAG_BACKGROUND BITFLAG(4)

code/__DEFINES/mapping.dm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Defines for SSmapping's multiz_levels
2+
/// TRUE if we're ok with going up
3+
#define Z_LEVEL_UP 1
4+
/// TRUE if we're ok with going down
5+
#define Z_LEVEL_DOWN 2
6+
#define LARGEST_Z_LEVEL_INDEX Z_LEVEL_DOWN

code/__DEFINES/maps.dm

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// traits
2+
// boolean - marks a level as having that property if present
3+
#define ZTRAIT_CENTCOM "CentCom"
4+
#define ZTRAIT_STATION "Station"
5+
#define ZTRAIT_RESERVED "Transit/Reserved"
6+
#define ZTRAIT_AWAY "Away Mission"
7+
/* Aurora Snowflake */
8+
#define ZTRAIT_OVERMAP "Overmap"
9+
#define ZTRAIT_EXPLANET "Exoplanet"
10+
11+
12+
// Whether this z level is linked up/down. Bool.
13+
#define ZTRAIT_UP "Up"
14+
#define ZTRAIT_DOWN "Down"
15+
16+
// enum - how space transitions should affect this level
17+
#define ZTRAIT_LINKAGE "Linkage"
18+
// UNAFFECTED if absent - no space transitions
19+
#define UNAFFECTED null
20+
// SELFLOOPING - space transitions always self-loop
21+
#define SELFLOOPING "Self"
22+
// CROSSLINKED - mixed in with the cross-linked space pool
23+
#define CROSSLINKED "Cross"
24+
25+
// default trait definitions, used by SSmapping
26+
///Z level traits for CentCom
27+
#define ZTRAITS_CENTCOM list(ZTRAIT_CENTCOM = TRUE, ZTRAIT_NOPHASE = TRUE)
28+
///Z level traits for Space Station 13
29+
#define ZTRAITS_STATION list(ZTRAIT_LINKAGE = CROSSLINKED, ZTRAIT_STATION = TRUE)
30+
///Z level traits for Away Missions
31+
#define ZTRAITS_AWAY list(ZTRAIT_AWAY = TRUE)
32+
///Z level traits for Overmap
33+
#define ZTRAITS_OVERMAP list(ZTRAIT_OVERMAP = TRUE, ZTRAIT_LINKAGE = SELFLOOPING)
34+
///Z level traits for Exoplanets
35+
#define ZTRAITS_EXPLANET list(ZTRAIT_EXPLANET = TRUE, ZTRAIT_LINKAGE = SELFLOOPING)
36+
37+
#define DL_NAME "name"
38+
#define DL_TRAITS "traits"
39+
#define DECLARE_LEVEL(NAME, TRAITS) list(DL_NAME = NAME, DL_TRAITS = TRAITS)
40+
41+
// must correspond to _basemap.dm for things to work correctly
42+
#define DEFAULT_MAP_TRAITS list(\
43+
DECLARE_LEVEL("CentCom", ZTRAITS_CENTCOM),\
44+
)

code/__DEFINES/multiz.dm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/// Attempt to get the turf below the provided one according to Z traits
2+
#define GET_TURF_BELOW(turf) ( \
3+
(turf.turf_flags & RESERVATION_TURF) ? SSmapping.get_reservation_from_turf(turf)?.get_turf_below(turf) : \
4+
(!(turf) || !length(SSmapping.multiz_levels) || !SSmapping.multiz_levels[(turf).z][Z_LEVEL_DOWN]) ? null : get_step((turf), DOWN))
5+
/// Attempt to get the turf above the provided one according to Z traits
6+
#define GET_TURF_ABOVE(turf) ( \
7+
(turf.turf_flags & RESERVATION_TURF) ? SSmapping.get_reservation_from_turf(turf)?.get_turf_above(turf) : \
8+
(!(turf) || !length(SSmapping.multiz_levels) || !SSmapping.multiz_levels[(turf).z][Z_LEVEL_UP]) ? null : get_step((turf), UP))

code/__DEFINES/turfs.dm

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -106,32 +106,6 @@
106106
AURORA SHIT
107107
################################*/
108108

109-
// Turf-only flags.
110-
///Blocks the jaunting spell from accessing the turf
111-
#define TURF_FLAG_NOJAUNT BITFLAG(1)
112-
113-
///Used by shuttle movement to determine if it should be ignored by turf translation
114-
#define TURF_FLAG_BACKGROUND BITFLAG(2)
115-
116-
117-
/**
118-
* Get the turf above the current atom, if any
119-
*
120-
* Returns a `/turf` if there's a turf on the Z-level above, `null` otherwise
121-
*
122-
* * atom - The `/atom` you want to know the above turf of
123-
*/
124-
#define GET_ABOVE(atom) (HasAbove(atom.z) ? get_step(atom, UP) : null)
125-
126-
/**
127-
* Get the turf below the current atom, if any
128-
*
129-
* Returns a `/turf` if there's a turf on the Z-level below, `null` otherwise
130-
*
131-
* * atom - The `/atom` you want to know the below turf of
132-
*/
133-
#define GET_BELOW(atom) (HasBelow(atom.z) ? get_step(atom, DOWN) : null)
134-
135109
#define NORTH_OF_TURF(T) locate(T.x, T.y + 1, T.z)
136110
#define EAST_OF_TURF(T) locate(T.x + 1, T.y, T.z)
137111
#define SOUTH_OF_TURF(T) locate(T.x, T.y - 1, T.z)

code/_onclick/hud/screen_objects.dm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@
347347
for(var/turf/T in view(usr.client.view + 3, usr)) // slightly extra to account for moving while looking for openness
348348
if(T.density)
349349
continue
350-
var/turf/above_turf = GetAbove(T)
350+
var/turf/above_turf = GET_TURF_ABOVE(T)
351351
if(!isopenspace(above_turf))
352352
continue
353353
var/image/up_image = image(icon = 'icons/mob/screen/generic.dmi', icon_state = "arrow_up", loc = T)
@@ -356,7 +356,8 @@
356356
usr << up_image
357357
QDEL_IN(up_image, 12)
358358
return
359-
var/turf/T = GetAbove(usr)
359+
var/turf/T1 = get_turf(usr)
360+
var/turf/T = GET_TURF_ABOVE(T1)
360361
if (!T)
361362
to_chat(usr, SPAN_NOTICE("There is nothing above you!"))
362363
else if (T.is_hole)

code/controllers/subsystems/explosives.dm

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ SUBSYSTEM_DEF(explosives)
7373

7474
// Handles recursive propagation of explosions.
7575
if(devastation_range > 2 || heavy_impact_range > 2)
76-
if(HasAbove(epicenter.z) && z_transfer & UP)
77-
global.explosion(GetAbove(epicenter), max(0, devastation_range - 2), max(0, heavy_impact_range - 2), max(0, light_impact_range - 2), max(0, flash_range - 2), 0, UP, spreading = FALSE)
78-
if(HasBelow(epicenter.z) && z_transfer & DOWN)
79-
global.explosion(GetBelow(epicenter), max(0, devastation_range - 2), max(0, heavy_impact_range - 2), max(0, light_impact_range - 2), max(0, flash_range - 2), 0, DOWN, spreading = FALSE)
76+
if(GET_TURF_ABOVE(epicenter) && z_transfer & UP)
77+
global.explosion(GET_TURF_ABOVE(epicenter), max(0, devastation_range - 2), max(0, heavy_impact_range - 2), max(0, light_impact_range - 2), max(0, flash_range - 2), 0, UP, spreading = FALSE)
78+
if(GET_TURF_BELOW(epicenter) && z_transfer & DOWN)
79+
global.explosion(GET_TURF_BELOW(epicenter), max(0, devastation_range - 2), max(0, heavy_impact_range - 2), max(0, light_impact_range - 2), max(0, flash_range - 2), 0, DOWN, spreading = FALSE)
8080

8181
var/max_range = max(devastation_range, heavy_impact_range, light_impact_range, flash_range)
8282

@@ -258,17 +258,17 @@ SUBSYSTEM_DEF(explosives)
258258
power -= O.explosion_resistance
259259

260260
if (power >= GLOB.config.iterative_explosives_z_threshold)
261-
if ((z_transfer & UP) && HasAbove(epicenter.z))
261+
if ((z_transfer & UP) && GET_TURF_ABOVE(epicenter))
262262
var/datum/explosiondata/data = new
263-
data.epicenter = GetAbove(epicenter)
263+
data.epicenter = GET_TURF_ABOVE(epicenter)
264264
data.rec_pow = (power * GLOB.config.iterative_explosives_z_multiplier) - GLOB.config.iterative_explosives_z_subtraction
265265
data.z_transfer = UP
266266
data.spreading = TRUE
267267
queue(data)
268268

269-
if ((z_transfer & DOWN) && HasBelow(epicenter.z))
269+
if ((z_transfer & DOWN) && GET_TURF_BELOW(epicenter))
270270
var/datum/explosiondata/data = new
271-
data.epicenter = GetBelow(epicenter)
271+
data.epicenter = GET_TURF_BELOW(epicenter)
272272
data.rec_pow = (power * GLOB.config.iterative_explosives_z_multiplier) - GLOB.config.iterative_explosives_z_subtraction
273273
data.z_transfer = DOWN
274274
data.spreading = TRUE

code/controllers/subsystems/falling.dm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ SUBSYSTEM_DEF(falling)
3939
REMOVE_AND_CONTINUE
4040

4141
// Get the below turf.
42-
var/turf/below = GetBelow(victim)
42+
var/turf/T = get_turf(victim)
43+
var/turf/below = GET_TURF_BELOW(T)
4344
if (!below)
4445
REMOVE_AND_CONTINUE
4546

code/controllers/subsystems/initialization/atlas.dm

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ SUBSYSTEM_DEF(atlas)
137137
)
138138

139139
/datum/controller/subsystem/atlas/stat_entry(msg)
140-
msg = "W:{X:[world.maxx] Y:[world.maxy] Z:[world.maxz]} ZL:[GLOB.z_levels]"
140+
msg = "W:{X:[world.maxx] Y:[world.maxy] Z:[world.maxz]} ZL:[length(SSmapping.z_list)]"
141141
return ..()
142142

143143
/datum/controller/subsystem/atlas/Initialize(timeofday)
@@ -223,30 +223,57 @@ SUBSYSTEM_DEF(atlas)
223223
var/static/regex/mapregex = new(".+\\.dmm$")
224224
var/list/files = flist(directory)
225225
sortTim(files, GLOBAL_PROC_REF(cmp_text_asc))
226+
var/list/filemaps_to_load
227+
for(var/file in files)
228+
if(mapregex.Find(file))
229+
filemaps_to_load += list(file)
230+
226231
var/mfile
227232
var/first_dmm = TRUE
228233
var/time
229-
for (var/i in 1 to files.len)
230-
mfile = files[i]
231-
if (!mapregex.Find(mfile))
232-
continue
234+
235+
var/is_first = TRUE
236+
for(var/i in 1 to length(filemaps_to_load))
237+
mfile = filemaps_to_load[i]
233238

234239
log_subsystem_atlas("Loading '[mfile]'.")
235240
time = world.time
236241

237242
mfile = "[directory][mfile]"
238243

239-
var/target_z = 0
240244
if (overwrite_default_z && first_dmm)
241-
target_z = 1
242245
first_dmm = FALSE
243246
log_subsystem_atlas("Overwriting first Z.")
244247

245-
if (!maploader.load_map(file(mfile), 0, 0, target_z, no_changeturf = TRUE))
248+
var/list/trait = ZTRAITS_STATION
249+
250+
//We're NOT loading the first level
251+
if(!is_first)
252+
//Last level is centcomm, noone goes in or out
253+
if(i == length(filemaps_to_load))
254+
trait += list(ZTRAIT_UP = FALSE, ZTRAIT_DOWN = FALSE)
255+
//Last level in the actual stack, can only go down
256+
else if(i == (length(filemaps_to_load) - 1))
257+
trait += list(ZTRAIT_UP = FALSE, ZTRAIT_DOWN = TRUE)
258+
//Bidirectional movement
259+
else
260+
trait += list(ZTRAIT_UP = TRUE, ZTRAIT_DOWN = TRUE)
261+
262+
//We're loading the first level, usually it has something above it
263+
else if(length(filemaps_to_load) >= 2)
264+
trait += list(ZTRAIT_UP = TRUE, ZTRAIT_DOWN = FALSE)
265+
else //Special case for single-level maps
266+
trait += list(ZTRAIT_UP = FALSE, ZTRAIT_DOWN = FALSE)
267+
268+
var/datum/space_level/level = SSmapping.add_new_zlevel(name, trait, contain_turfs = FALSE)
269+
270+
if (!maploader.load_map(file(mfile), 0, 0, level.z_value, no_changeturf = TRUE))
246271
log_subsystem_atlas("Failed to load '[mfile]'!")
247272
else
248273
log_subsystem_atlas("Loaded level in [(world.time - time)/10] seconds.")
249274

275+
is_first = FALSE
276+
250277
.++
251278
CHECK_TICK
252279

code/controllers/subsystems/mapping.dm

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,25 @@ SUBSYSTEM_DEF(mapping)
1010
var/list/submaps = list()
1111
var/list/submap_archetypes = list()
1212

13+
var/list/used_turfs = list() //list of turf = datum/turf_reservation -- Currently unused
14+
15+
/// List of z level (as number) -> list of all z levels vertically connected to ours
16+
/// Useful for fast grouping lookups and such
17+
var/list/z_level_to_stack = list()
18+
19+
///list of all z level datums in the order of their z (z level 1 is at index 1, etc.)
20+
var/list/datum/space_level/z_list = list()
21+
22+
///list of all z level indices that form multiz connections and whether theyre linked up or down.
23+
///list of lists, inner lists are of the form: list("up or down link direction" = TRUE)
24+
var/list/multiz_levels = list()
25+
26+
/// list of traits and their associated z leves
27+
var/list/z_trait_levels = list()
28+
29+
/// True when in the process of adding a new Z-level, global locking
30+
var/adding_new_zlevel = FALSE
31+
1332
/datum/controller/subsystem/mapping/Initialize(timeofday)
1433
// Load templates and build away sites.
1534
preloadTemplates()
@@ -72,6 +91,40 @@ SUBSYSTEM_DEF(mapping)
7291
else if(istype(MT, /datum/map_template/ruin/away_site))
7392
away_sites_templates[MT.id] = MT
7493

94+
/datum/controller/subsystem/mapping/proc/generate_linkages_for_z_level(z_level)
95+
if(!isnum(z_level) || z_level <= 0)
96+
return FALSE
97+
98+
if(multiz_levels.len < z_level)
99+
multiz_levels.len = z_level
100+
101+
var/z_above = level_trait(z_level, ZTRAIT_UP)
102+
var/z_below = level_trait(z_level, ZTRAIT_DOWN)
103+
if(!(z_above == TRUE || z_above == FALSE || z_above == null) || !(z_below == TRUE || z_below == FALSE || z_below == null))
104+
stack_trace("Warning, numeric mapping offsets are deprecated. Instead, mark z level connections by setting UP/DOWN to true if the connection is allowed")
105+
multiz_levels[z_level] = new /list(LARGEST_Z_LEVEL_INDEX)
106+
multiz_levels[z_level][Z_LEVEL_UP] = !!z_above
107+
multiz_levels[z_level][Z_LEVEL_DOWN] = !!z_below
108+
109+
/// Takes a z level datum, and tells the mapping subsystem to manage it
110+
/// Also handles things like plane offset generation, and other things that happen on a z level to z level basis
111+
/datum/controller/subsystem/mapping/proc/manage_z_level(datum/space_level/new_z, filled_with_space, contain_turfs = TRUE)
112+
// First, add the z
113+
z_list += new_z
114+
115+
// Then we build our lookup lists
116+
var/z_value = new_z.z_value
117+
118+
z_level_to_stack.len += 1
119+
// Bare minimum we have ourselves
120+
z_level_to_stack[z_value] = list(z_value)
121+
122+
//Placeholder for now
123+
/datum/controller/subsystem/mapping/proc/get_reservation_from_turf(turf/T)
124+
RETURN_TYPE(/datum/turf_reservation)
125+
return used_turfs[T]
126+
127+
75128
/proc/generateMapList(filename)
76129
var/list/potentialMaps = list()
77130
var/list/Lines = world.file2list(filename)

code/controllers/subsystems/zcopy.dm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ SUBSYSTEM_DEF(zcopy)
115115
zlev_maximums = new(world.maxz)
116116
var/start_zlev = 1
117117
for (var/z in 1 to world.maxz)
118-
if (!HasAbove(z))
118+
if (!SSmapping.multiz_levels[z][Z_LEVEL_UP])
119119
for (var/member_zlev in start_zlev to z)
120120
zlev_maximums[member_zlev] = z
121121
if (z - start_zlev > OPENTURF_MAX_DEPTH)

0 commit comments

Comments
 (0)