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

MultiZ WIP/Staging #27189

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c908dcc
Brings tablets into the light of modernity
Razharas Sep 13, 2016
ae86990
Merge branch 'master' of https://github.com/tgstation/-tg-station int…
Razharas Sep 13, 2016
c1323c6
Ok lets tone down the steve jobs
Razharas Sep 13, 2016
fdccd22
Oops wrong save
Razharas Sep 13, 2016
793847d
Merge branch 'master' of https://github.com/tgstation/-tg-station
Razharas Oct 1, 2016
c9d9b42
Merge branch 'master' of https://github.com/tgstation/-tg-station
Razharas Jan 17, 2017
f05e5ee
Merge branch 'master' of https://github.com/tgstation/-tg-station
Razharas Jan 18, 2017
fc2e3d3
Merge branch 'master' of https://github.com/tgstation/-tg-station
Razharas Jan 23, 2017
a85861d
Initial framework + Gas Spread + ZShadows + Early attempt at pipes.
RemieRichards May 12, 2017
c521ea9
Merge branch 'master' of https://github.com/tgstation/-tg-station int…
RemieRichards May 12, 2017
c8f4845
Merge branch 'master' of https://github.com/tgstation/-tg-station int…
RemieRichards May 13, 2017
8375d51
Modernisation + revert/merge fixes
RemieRichards May 13, 2017
441bd0f
Multiz Test map is now loaded the standard way.
RemieRichards May 13, 2017
c3ffeba
Rest in peace Zvent.
RemieRichards May 13, 2017
8b83a6c
Merge branch 'master' of https://github.com/tgstation/-tg-station
Razharas May 14, 2017
da10817
Merge branch 'VERTICALITY' of https://github.com/RemieRichards/-tg-st…
Razharas May 14, 2017
c133119
Makes vines 3d
Razharas May 15, 2017
271d02e
Checking zlevel connection on creation or movement
Razharas May 15, 2017
c9f46a2
Merge pull request #18 from Razharas/RemieRichards-VERTICALITY
RemieRichards May 15, 2017
1995587
Makes explosions 3d
Razharas May 15, 2017
f6dd79d
Merge branch 'master' of https://github.com/tgstation/-tg-station int…
Razharas May 15, 2017
b29247d
Merge pull request #19 from Razharas/RemieRichards-VERTICALITY
RemieRichards May 15, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
209 changes: 209 additions & 0 deletions _maps/map_files/debug/multiz_test.dmm

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions _maps/multiz_test.dm
@@ -0,0 +1,21 @@
#if !defined(MAP_FILE)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This entire file should be just #define FORCE_MAP "multiz_test.json"


// MultiZ Station

#define TITLESCREEN "title"

#define MINETYPE "lavaland"

#include "map_files\debug\multiz_test.dmm"

#define MAP_PATH "map_files/debug"
#define MAP_FILE "multiz_test.dmm"
#define MAP_NAME "MultiZ Station"

#define MAP_TRANSITION_CONFIG list(MAIN_STATION = UNAFFECTED)

#elif !defined(MAP_OVERRIDE)

#warn a map has already been included, ignoring MultiZ Station.

#endif
5 changes: 4 additions & 1 deletion code/__DEFINES/atmospherics.dm
Expand Up @@ -169,4 +169,7 @@
#define ATMOS_PASS_NO 0
#define ATMOS_PASS_PROC -1 //ask CanAtmosPass()
#define ATMOS_PASS_DENSITY -2 //just check density
#define CANATMOSPASS(A, O) ( A.CanAtmosPass == ATMOS_PASS_PROC ? A.CanAtmosPass(O) : ( A.CanAtmosPass == ATMOS_PASS_DENSITY ? !A.density : A.CanAtmosPass ) )
#define CANATMOSPASS(A, O) ( A.CanAtmosPass == ATMOS_PASS_PROC ? A.CanAtmosPass(O) : ( A.CanAtmosPass == ATMOS_PASS_DENSITY ? !A.density : A.CanAtmosPass ) )

//MultiZ / Atmos Spreading
#define ATMOS_DIRS cardinal+list(UP,DOWN)
9 changes: 8 additions & 1 deletion code/__HELPERS/icon_smoothing.dm
Expand Up @@ -259,7 +259,7 @@
A.cut_overlay(A.bottom_left_corner)
A.bottom_left_corner = se
LAZYADD(New, se)

if(New)
A.add_overlay(New)

Expand Down Expand Up @@ -394,3 +394,10 @@
icon_state = "smooth"
smooth = SMOOTH_TRUE|SMOOTH_DIAGONAL|SMOOTH_BORDER
canSmoothWith = null



//Called by SSicon_smooth after this atom has smoothed
/atom/proc/post_smooth()
if(zshadow)
zshadow.SyncAppearance()
7 changes: 7 additions & 0 deletions code/controllers/subsystem/air.dm
Expand Up @@ -278,6 +278,13 @@ var/datum/subsystem/air/SSair
add_to_active(T)
queued_for_activation.Cut()

//Recalculated, for Multi-Z (In an ideal world I'd move setup_allturfs() here
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this got moved during the merge, woops.
explains the comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was originally in StopLoadingMap()

//but it's sadly not that simple)
for(var/t in block(locate(1, 1, 1), locate(world.maxx, world.maxy, world.maxz)))
var/turf/T = t
T.CalculateAdjacentTurfs()
CHECK_TICK

/datum/subsystem/air/proc/setup_allturfs()
var/list/turfs_to_init = block(locate(1, 1, 1), locate(world.maxx, world.maxy, world.maxz))
var/list/active_turfs = src.active_turfs
Expand Down
1 change: 1 addition & 0 deletions code/controllers/subsystem/icon_smooth.dm
Expand Up @@ -32,6 +32,7 @@ var/datum/subsystem/icon_smooth/SSicon_smooth
if(!A || A.z <= 2)
continue
smooth_icon(A)
A.post_smooth()
CHECK_TICK

..()
20 changes: 20 additions & 0 deletions code/controllers/subsystem/multiz.dm
@@ -0,0 +1,20 @@
var/datum/subsystem/z_levels/SSz

/datum/subsystem/z_levels
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace these three lines with SUBSYSTEM_DEF(z_levels)

name = "Z Levels"
flags = SS_NO_FIRE
init_order = 12 //before SSatoms
var/list/vertical_connections //assoc list of "[Z number]" = list("[Other Z Number]" = TRUE/FALSE)
var/list/zshadows

/datum/subsystem/z_levels/New()
NEW_SS_GLOBAL(SSz)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove these two lines



/datum/subsystem/z_levels/stat_entry()
var/c = 0
for(var/z in vertical_connections)
var/list/L = vertical_connections[z]
if(L)
c += L.len //this will count A<->B twice, since it's A->B and B->A
..("ZP:[c], ZS:[LAZYLEN(zshadows)]") //"Z Pairs", "Z Shadows"
19 changes: 14 additions & 5 deletions code/modules/atmospherics/environmental/LINDA_system.dm
Expand Up @@ -14,18 +14,18 @@
/turf/open/CanAtmosPass(turf/T)
var/R
if(blocks_air || T.blocks_air)
R = 1
R = TRUE

for(var/obj/O in contents+T.contents)
var/turf/other = (O.loc == src ? T : src)
if(!CANATMOSPASS(O, other))
R = 1
R = TRUE
if(O.BlockSuperconductivity()) //the direction and open/closed are already checked on CanAtmosPass() so there are no arguments
var/D = get_dir(src, T)
atmos_supeconductivity |= D
D = get_dir(T, src)
T.atmos_supeconductivity |= D
return 0 //no need to keep going, we got all we asked
return FALSE //no need to keep going, we got all we asked

atmos_supeconductivity &= ~get_dir(src, T)
T.atmos_supeconductivity &= ~get_dir(T, src)
Expand All @@ -39,10 +39,19 @@

/turf/proc/CalculateAdjacentTurfs()
var/list/atmos_adjacent_turfs = src.atmos_adjacent_turfs
for(var/direction in cardinal)
for(var/direction in ATMOS_DIRS)
var/turf/T = get_step(src, direction)
if(!T)
continue

if(direction == UP)
if(!T.z_open)
continue

else if(direction == DOWN)
if(!z_open)
continue

if(CANATMOSPASS(T, src))
LAZYINITLIST(atmos_adjacent_turfs)
LAZYINITLIST(T.atmos_adjacent_turfs)
Expand Down Expand Up @@ -76,7 +85,7 @@
var/matchingDirections = 0
var/turf/S = get_step(curloc, direction)

for (var/checkDirection in cardinal)
for (var/checkDirection in ATMOS_DIRS)
var/turf/checkTurf = get_step(S, checkDirection)
if(!S.atmos_adjacent_turfs || !S.atmos_adjacent_turfs[checkTurf])
continue
Expand Down
2 changes: 1 addition & 1 deletion code/modules/atmospherics/gasmixtures/gas_types.dm
Expand Up @@ -91,7 +91,7 @@ var/list/hardcoded_gases = list("o2","n2","co2","plasma") //the main four gases,
icon = 'icons/effects/tile_effects.dmi'
mouse_opacity = 0
layer = FLY_LAYER
appearance_flags = TILE_BOUND
appearance_flags = TILE_BOUND|RESET_COLOR|RESET_ALPHA

/obj/effect/overlay/gas/New(state)
. = ..()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/atmospherics/machinery/atmosmachinery.dm
Expand Up @@ -67,7 +67,7 @@ Pipelines + Other Objects -> Pipe network
node_connects.len = device_type

for(DEVICE_TYPE_LOOP)
for(var/D in cardinal)
for(var/D in ATMOS_DIRS)
if(D & GetInitDirections())
if(D in node_connects)
continue
Expand Down
20 changes: 18 additions & 2 deletions code/modules/atmospherics/machinery/other/zvent.dm
@@ -1,3 +1,15 @@

/*
Remie note:
I added proper multiZ, but this thing is ancient
I "updated" it, and it DOES work, but it's
not in RPDs, pipe dispensers etc and some of its
content (on/off, volume_rate) aren't implemented.

Use this for ruins and stuff I guess, or fix it up proper.
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

honestly just remove zvent

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By that I mean that cross-z connections should only happen between nodes. Making that work shouldn't be too difficult, but having a vent like this is unnecessary complexity for a redundant gain (pipe up connected to a vent is basically the same)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure I guess, it just seemed cruel to kill it when it survived, semi-working, for such a long time.
rip zvent.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do appreciate the respect you had for this poor piece of oldmos

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

;_;7



/obj/machinery/zvent
name = "interfloor air transfer system"

Expand All @@ -21,9 +33,13 @@

//all this object does, is make its turf share air with the ones above and below it, if they have a vent too.
if(isturf(loc)) //if we're not on a valid turf, forget it
for (var/new_z in list(-1,1)) //change this list if a fancier system of z-levels gets implemented
var/turf/open/zturf_conn = locate(x,y,z+new_z)
var/turf/T = loc
for (var/ddir in list(DOWN,UP)) //change this list if a fancier system of z-levels gets implemented //meow
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static list

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No point, dunc wants the file murdered.

var/turf/open/zturf_conn = get_step(loc, ddir)
if (istype(zturf_conn))
if(!AreZsConnected(zturf_conn.z, T.z))
continue

var/obj/machinery/zvent/zvent_conn= locate(/obj/machinery/zvent) in zturf_conn
if (istype(zvent_conn))
//both floors have simulated turfs, share()
Expand Down
26 changes: 26 additions & 0 deletions code/modules/atmospherics/machinery/pipes/multiz.dm
@@ -0,0 +1,26 @@

//where for art thou duncathan

/obj/machinery/atmospherics/pipe/simple/multiz
icon = 'icons/obj/atmospherics/pipes/multiz.dmi'
var/basestate

/obj/machinery/atmospherics/pipe/simple/multiz/update_icon()
icon_state = "[basestate][invisibility ? "-f" : "" ]"


/obj/machinery/atmospherics/pipe/simple/multiz/up
initialize_directions = SOUTH|UP
basestate = "up"

/obj/machinery/atmospherics/pipe/simple/multiz/up/SetInitDirections()
initialize_directions = dir|UP


/obj/machinery/atmospherics/pipe/simple/multiz/down
initialize_directions = SOUTH|DOWN
basestate = "down"

/obj/machinery/atmospherics/pipe/simple/multiz/down/SetInitDirections()
initialize_directions = dir|DOWN

119 changes: 119 additions & 0 deletions code/modules/multiz/atoms.dm
@@ -0,0 +1,119 @@

/atom
var/atom/movable/zshadow/zshadow
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move it to atoms.dm



//TODO: Simplify for base atoms? (their shadows would never move, so they don't need a zshadow movable atom)
/atom/proc/CreateZShadow()
if(!zshadow) //if one exists, just sync it
zshadow = new()
zshadow.owner = src
zshadow.Sync()
return zshadow


//Can we fall through to the Z below? (regardless of open turfs, etc.)
//This is so mobs with jetpacks, thrown items, etc. can ignore falling
/atom/proc/CanFallThroughZ()
if(!has_gravity())
return FALSE
return TRUE


/atom/movable/CanFallThroughZ()
. = ..()
if(.)
if(throwing)
return FALSE


/mob/CanFallThroughZ()
. = ..()
if(.)
var/obj/item/weapon/tank/jetpack/J = get_jetpack()
if(istype(J) && J.allow_thrust(0.01, src)) //working jetpack
return FALSE



//Hooks:
//TODO: move to existing locations

/atom/proc/SetupZShadow(mapload = FALSE)
if(mapload) //This is before SSz, so we can't rely on connections yet
var/turf/U = get_step(src, UP)
if(U && U.z_open)
CreateZShadow()
else if(GetAboveConnectedTurf(src))
CreateZShadow()

/atom/Initialize(mapload)
..()
SetupZShadow(mapload)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is gonna add overhead to every atom, just call it from atoms.dm

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I swear I left a //TODO to move these.
this file is temporary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did actually, line 40.


/turf/Initialize(mapload)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

..()
if(z_open)
var/turf/D = get_step(src, DOWN)
if(D)
ConnectVerticalZs(z, D.z)
D.SetupZShadow()
for(var/a in D)
var/atom/A = a
A.SetupZShadow(mapload)

SetupZShadow(mapload)

/atom/setDir(dir)
..()
if(zshadow)
zshadow.setDir(dir) //dir is not an appearance var, so we can update it quickly

/atom/Destroy()
. = ..()
if(zshadow)
qdel(zshadow)

/atom/movable/Moved()
..()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest are fine, just these 3 are performance critical

if(zshadow)
zshadow.SyncLoc()
else
if(GetAboveConnectedTurf(src))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is meant to be GetZOpenAbove(src) (so that Zshadows lazy-create (the creation of a hole above them is already covered))

CreateZShadow()


//Get this to cascade somehow...
/obj/update_icon()
..()
if(zshadow)
zshadow.SyncAppearance()

//Cascade somehow.
/mob/update_icons()
..()
if(zshadow)
zshadow.SyncAppearance()

/turf/AfterChange()
..()
if(zshadow)
zshadow.SyncAppearance()


/turf/add_decal(decal,group)
..()
if(zshadow)
zshadow.SyncAppearance()


/turf/remove_decal(group)
..()
if(zshadow)
zshadow.SyncAppearance()


/turf/open/update_visuals()
..()
if(zshadow)
zshadow.SyncAppearance()
31 changes: 31 additions & 0 deletions code/modules/multiz/turfs.dm
@@ -0,0 +1,31 @@

/turf
var/z_open = FALSE //are we see the Z below us through this turf? (true/false)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

am gud att engrish



/turf/open/open_z
icon = null
icon_state = ""
desc = ""
name = "zopen"
invisibility = 101 //Not real!!
z_open = TRUE


/turf/open/open_z/Entered(atom/movable/AM, atom/oloc)
..()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another performance worry

var/turf/T = GetBelowConnectedTurf(src)
if(AtomCanFallThrough(AM) && T)
AM.forceMove(T)


/turf/open/open_z/proc/AtomCanFallThrough(atom/movable/AM)
. = FALSE
if(AM.CanFallThroughZ())
. = TRUE
if(locate(/obj/structure/lattice/catwalk) in src)
. = FALSE


/turf/open/open_z/CreateZShadow() //just no
return