Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime maploading 2/3: multiz update #6145

Merged
merged 55 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
f9ddefa
stub in struct helpers
Nov 14, 2023
948590f
Merge remote-tracking branch 'citrp/master' into multiz
Nov 14, 2023
3317776
helpers
Nov 14, 2023
dd44fca
move things
Nov 14, 2023
f83c50a
out with level datA
Nov 14, 2023
0dd5a75
out with map data
Nov 14, 2023
5057f77
organize things
Nov 14, 2023
8fe7e91
helper updates
Nov 14, 2023
01132f2
helper updates
Nov 14, 2023
622a0da
toss in borders
Nov 14, 2023
74088a6
agony!
Nov 14, 2023
71bb858
fix
Nov 14, 2023
8a191a3
fix
Nov 14, 2023
78b7d81
fixes
Nov 14, 2023
d5e5959
fix that
Nov 15, 2023
ac0ff3b
fixes
Nov 15, 2023
b6bcd59
Fixes
Nov 15, 2023
9489065
fixes
Nov 15, 2023
75aa4e1
fixes
Nov 16, 2023
9dd8529
oh right
Nov 16, 2023
d5b1639
lookups
Nov 16, 2023
d2ebf3f
lookups
Nov 16, 2023
41c1ed3
visuals
Nov 17, 2023
0fa312f
fixes
Nov 17, 2023
6d970f1
fix
Nov 17, 2023
bee57f8
map updates
Nov 17, 2023
2b55b57
fix
Nov 17, 2023
44897a8
fix
Nov 17, 2023
9fcf990
boost range
Nov 17, 2023
4b11207
a
Nov 17, 2023
8b3f9cf
abuse zmimic lmao
Nov 17, 2023
848d3bd
fix atmos
Nov 17, 2023
0cfd80f
lighting
Nov 17, 2023
f63de9c
don't trample shit that isn't even there
Nov 18, 2023
2b9a4ae
don't trample shit that isn't even there
Nov 18, 2023
cd94abf
align
Nov 18, 2023
8801776
align
Nov 18, 2023
b77d87b
have sectors work
Nov 18, 2023
545a9f1
Fix
Nov 18, 2023
9b416ff
fix
Nov 18, 2023
e68e6de
merge
Nov 18, 2023
cbb3e19
fixes
Nov 18, 2023
bc1165c
fix
Nov 18, 2023
28602f5
fix
Nov 18, 2023
51805dc
fix
Nov 18, 2023
2164895
Merge remote-tracking branch 'citrp/master' into multiz
Nov 20, 2023
1f165dd
fix bp
Nov 20, 2023
3f6fea4
hologram fixed
Nov 20, 2023
6152e07
underground levels restore
Nov 20, 2023
a215cf0
level
Nov 20, 2023
e9a376a
level
Nov 20, 2023
5b966d6
level
Nov 20, 2023
a53dc35
fix factoring
Nov 20, 2023
4ab90e6
nerf windows
Nov 20, 2023
25911d3
map data
Nov 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 17 additions & 13 deletions citadel.dme
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@
#include "code\__DEFINES\vote.dm"
#include "code\__DEFINES\vv.dm"
#include "code\__DEFINES\wires.dm"
#include "code\__DEFINES\z_levels.dm"
#include "code\__DEFINES\_flags\_flags.dm"
#include "code\__DEFINES\_flags\area_flags.dm"
#include "code\__DEFINES\_flags\atom_flags.dm"
Expand Down Expand Up @@ -579,6 +578,13 @@
#include "code\controllers\subsystem\mapping\level_helpers\linkage.dm"
#include "code\controllers\subsystem\mapping\level_helpers\lookup.dm"
#include "code\controllers\subsystem\mapping\level_helpers\traits.dm"
#include "code\controllers\subsystem\mapping\level_helpers\virtualization.dm"
#include "code\controllers\subsystem\mapping\spatial_helpers\angle.dm"
#include "code\controllers\subsystem\mapping\spatial_helpers\dir.dm"
#include "code\controllers\subsystem\mapping\spatial_helpers\distance.dm"
#include "code\controllers\subsystem\mapping\spatial_helpers\loc.dm"
#include "code\controllers\subsystem\mapping\spatial_helpers\stack.dm"
#include "code\controllers\subsystem\mapping\spatial_helpers\step.dm"
#include "code\controllers\subsystem\networks\_networks.dm"
#include "code\controllers\subsystem\networks\simple.dm"
#include "code\controllers\subsystem\persistence\_persistence.dm"
Expand Down Expand Up @@ -723,6 +729,7 @@
#include "code\datums\components\riding\mob\robot.dm"
#include "code\datums\components\riding\simple\_simple.dm"
#include "code\datums\components\riding\vehicle\_vehicle.dm"
#include "code\datums\components\turfs\transition_border.dm"
#include "code\datums\design\design.dm"
#include "code\datums\design\design_holder.dm"
#include "code\datums\design\designs\sheets.dm"
Expand Down Expand Up @@ -3086,8 +3093,6 @@
#include "code\modules\mapping\map_level.dm"
#include "code\modules\mapping\map_template.dm"
#include "code\modules\mapping\minimaps.dm"
#include "code\modules\mapping\multiz_helpers.dm"
#include "code\modules\mapping\paint.dm"
#include "code\modules\mapping\shuttle.dm"
#include "code\modules\mapping\submap.dm"
#include "code\modules\mapping\submaps_legacy.dm"
Expand All @@ -3101,6 +3106,7 @@
#include "code\modules\mapping\map_helpers\baseturf.dm"
#include "code\modules\mapping\map_helpers\component_injector.dm"
#include "code\modules\mapping\map_helpers\engine_loader.dm"
#include "code\modules\mapping\map_helpers\paint.dm"
#include "code\modules\mapping\map_helpers\network_builder\_network_builder.dm"
#include "code\modules\mapping\map_helpers\network_builder\power_cable.dm"
#include "code\modules\mapping\spawner\_spawner.dm"
Expand Down Expand Up @@ -3872,19 +3878,17 @@
#include "code\modules\movespeed\modifiers\misc.dm"
#include "code\modules\movespeed\modifiers\mob.dm"
#include "code\modules\multiz\atoms.dm"
#include "code\modules\multiz\basic.dm"
#include "code\modules\multiz\basic_legacy.dm"
#include "code\modules\multiz\core.dm"
#include "code\modules\multiz\falling.dm"
#include "code\modules\multiz\hoist.dm"
#include "code\modules\multiz\ladder.dm"
#include "code\modules\multiz\ladder_assembly_vr.dm"
#include "code\modules\multiz\level_data.dm"
#include "code\modules\multiz\map_data.dm"
#include "code\modules\multiz\movement.dm"
#include "code\modules\multiz\open_turf.dm"
#include "code\modules\multiz\pipes.dm"
#include "code\modules\multiz\structures.dm"
#include "code\modules\multiz\structures_vr.dm"
#include "code\modules\multiz\turf.dm"
#include "code\modules\multiz\structures\hoist.dm"
#include "code\modules\multiz\structures\ladder.dm"
#include "code\modules\multiz\structures\pipes.dm"
#include "code\modules\multiz\structures\stairs.dm"
#include "code\modules\multiz\structures\vorestation_portals.dm"
#include "code\modules\multiz\turfs\open.dm"
#include "code\modules\multiz\zmimic\_mimic_docs.dm"
#include "code\modules\multiz\zmimic\mimic_common.dm"
#include "code\modules\multiz\zmimic\mimic_movable.dm"
Expand Down
8 changes: 7 additions & 1 deletion code/__DEFINES/_flags/atom_flags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@
/// Atom queued to SSoverlay for compile_overlays
#define ATOM_OVERLAY_QUEUED (1<<3)
/// Atom is absolute-abstract - should not be interactable or movable in any way shape or form
/// This is for stuff like lighting.
#define ATOM_ABSTRACT (1<<4)
/// Atom is not considered a game world object.
/// This means semantic "wipe game world state" things like turf.empty(), saving, loading, etc, should ignore it,
/// but the atom is not abstract.
#define ATOM_NONWORLD (1<<5)
/// uses integrity, and is broken
#define ATOM_BROKEN (1<<5)
#define ATOM_BROKEN (1<<6)
/// Used for items if they don't want to get a blood overlay.
#define NOBLOODY (1<<7) // TODO: item flag
/// Reagents don't react inside this container.
Expand Down Expand Up @@ -50,6 +55,7 @@ DEFINE_BITFIELD(atom_flags, list(
BITFIELD(ATOM_HEAR),
BITFIELD(ATOM_OVERLAY_QUEUED),
BITFIELD(ATOM_ABSTRACT),
BITFIELD(ATOM_NONWORLD),
BITFIELD(ATOM_BROKEN),
BITFIELD(NOBLOODY),
BITFIELD(NOREACT),
Expand Down
6 changes: 4 additions & 2 deletions code/__DEFINES/mapping/levels.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
/// Default - don't preprocess for unlinked sides, just leave them empty
#define Z_LINKAGE_NORMAL "normal"
/// Crosslinked - crosslink with other crosslinked zlevels at random using some semblence of continuity
#define Z_LINKAGE_CROSSLINKED "crosslink"
// todo: crosslink support
// #define Z_LINKAGE_CROSSLINKED "crosslink"
/// Selflooping - automatically link to itself for unlinked sides
#define Z_LINKAGE_SELFLOOP "selfloop"
// todo: selfloop support
// #define Z_LINKAGE_SELFLOOP "selfloop"

//? "transition"

Expand Down
16 changes: 16 additions & 0 deletions code/__DEFINES/mapping/multiz.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,19 @@

/// these flags mean a fall should stop
#define FALL_FLAGS_STOP (FALL_BLOCKED | FALL_RECOVERED | FALL_TERMINATED)

/// there's a level above
#define Z_HAS_ABOVE(z) (!isnull(SSmapping.cached_level_up[z]))
/// there's a level below
#define Z_HAS_BELOW(z) (!isnull(SSmapping.cached_level_down[z]))

/// get turf below this turf, if any
/// we are at the mercy of zmimic when we do this. do not use in critical maploader code.
#define TURF_BELOW_ISH(T) (T.below || T.below())
/// get turf above this turf, if any
/// we are at the mercy of zmimic when we do this. do not use in critical maploader code.
#define TURF_ABOVE_ISH(T) (T.above || T.above())

/// we should use get virtual step due to our x/y being border
/// we do not get step this, so use it on something **on** game world. (aka turf or on turf).
#define AT_MAP_BORDER(A) (A.x == 2 || A.y == 2 || A.x == world.maxx - 1 || A.y == world.maxy - 1)
2 changes: 1 addition & 1 deletion code/__DEFINES/turfs/type_generation.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

/// create the standard 4 types of turfs for a given turf type.
#define CREATE_STANDARD_TURFS(type) \
##type/indoors { \
outdoors = FALSE; \
Expand Down
2 changes: 0 additions & 2 deletions code/__DEFINES/z_levels.dm

This file was deleted.

19 changes: 14 additions & 5 deletions code/_globals/bitfields.dm
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ GLOBAL_LIST_INIT(bitfields, generate_bitfields())
"TRANSPARENT" = TRANSPARENT,
"AMOUNT_VISIBLE" = AMOUNT_VISIBLE,
"NO_REACT" = NO_REACT,
),
),
"sight" = list(
"SEE_INFRA" = SEE_INFRA,
"SEE_SELF" = SEE_SELF,
Expand All @@ -70,9 +70,18 @@ GLOBAL_LIST_INIT(bitfields, generate_bitfields())
"SEE_PIXELS" = SEE_PIXELS,
"SEE_THRU" = SEE_THRU,
"SEE_BLACKNESS" = SEE_BLACKNESS,
"BLIND" = BLIND
),

)
"BLIND" = BLIND,
),
"vis_flags" = list(
"VIS_INHERIT_ICON" = VIS_INHERIT_ICON,
"VIS_INHERIT_ICON_STATE" = VIS_INHERIT_ICON_STATE,
"VIS_INHERIT_DIR" = VIS_INHERIT_DIR,
"VIS_INHERIT_LAYER" = VIS_INHERIT_LAYER,
"VIS_INHERIT_PLANE" = VIS_INHERIT_PLANE,
"VIS_INHERIT_ID" = VIS_INHERIT_ID,
"VIS_UNDERLAY" = VIS_UNDERLAY,
"VIS_HIDE" = VIS_HIDE,
),
)

#undef FLAG
4 changes: 2 additions & 2 deletions code/controllers/subsystem/air.dm
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,9 @@ SUBSYSTEM_DEF(air)
gas_string = A.initial_gas_mix
// 2. check if it's special and should look up the level's defaults
switch(gas_string)
if(ATMOSPHERE_USE_INDOORS)
gas_string = SSmapping.lookup_outdoors_air(turf_context.z)
if(ATMOSPHERE_USE_OUTDOORS)
gas_string = SSmapping.lookup_outdoors_air(turf_context.z)
if(ATMOSPHERE_USE_INDOORS)
gas_string = SSmapping.lookup_indoors_air(turf_context.z)
// 3: process atmosphere
if(generated_atmospheres[gas_string])
Expand Down
4 changes: 3 additions & 1 deletion code/controllers/subsystem/lighting.dm
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ SUBSYSTEM_DEF(lighting)
. += 1
if (TURF_IS_AMBIENT_LIT_UNSAFE(T))
T.generate_missing_corners() // Forcibly generate corners.

else
if(!T.lighting_disable_fullbright)
T.add_overlay(/obj/effect/fullbright, TRUE)
CHECK_TICK

// It's safe to pass a list of non-turfs to this list - it'll only check turfs.
Expand Down
10 changes: 6 additions & 4 deletions code/controllers/subsystem/mapping/level_helpers/linkage.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
*/
/datum/controller/subsystem/mapping/proc/crosslinked_levels()
RETURN_TYPE(/list)
. = list()
for(var/datum/map_level/L as anything in ordered_levels)
if(L.linkage == Z_LINKAGE_CROSSLINKED)
. += L.z_index
return list()
// todo: crosslink support
// . = list()
// for(var/datum/map_level/L as anything in ordered_levels)
// if(L.linkage == Z_LINKAGE_CROSSLINKED)
// . += L.z_index
50 changes: 47 additions & 3 deletions code/controllers/subsystem/mapping/level_helpers/lookup.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,51 @@
return ordered_levels[z]?.display_name

/**
* returns the z index of an id
* returns level datum in dir of level
*
* if diagonal, only returns a level if both steps are consistent with each other.
*/
/datum/controller/subsystem/mapping/proc/level_by_id(id)
return keyed_levels[id]?.z_index
/datum/controller/subsystem/mapping/proc/level_datum_in_dir(z, dir)
if(dir & (dir - 1))
// if diagonal, pass to level for advanced handling
return ordered_levels[z].level_in_dir(dir)?.z_index
var/index
switch(dir)
if(NORTH)
index = cached_level_north[z]
if(SOUTH)
index = cached_level_south[z]
if(EAST)
index = cached_level_east[z]
if(WEST)
index = cached_level_west[z]
if(UP)
index = cached_level_up[z]
if(DOWN)
index = cached_level_down[z]
return ordered_levels[index]

/**
* returns level index in dir of level
*
* if diagonal, only returns a level if both steps are consistent with each other.
*/
/datum/controller/subsystem/mapping/proc/level_index_in_dir(z, dir)
if(dir & (dir - 1))
// if diagonal, pass to level for advanced handling
return ordered_levels[z].level_in_dir(dir)
var/index
switch(dir)
if(NORTH)
index = cached_level_north[z]
if(SOUTH)
index = cached_level_south[z]
if(EAST)
index = cached_level_east[z]
if(WEST)
index = cached_level_west[z]
if(UP)
index = cached_level_up[z]
if(DOWN)
index = cached_level_down[z]
return index
14 changes: 14 additions & 0 deletions code/controllers/subsystem/mapping/level_helpers/virtualization.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2023 Citadel Station developers. *//

/**
* GAME PROC: is_level_virtualized(z)
* Checks if we should use GetVirtualCoords or similar for things like GPSes, radios
*
* Returns TRUE if:
* z is in a world_struct
*/
/datum/controller/subsystem/mapping/proc/is_level_virtualized(z)
// todo: world structs
return FALSE
// return !isnull(struct_by_z[z])
Loading
Loading