Skip to content

Commit

Permalink
Multi-Z Support for Lazy Templates | Cleans up some turf flag misuse …
Browse files Browse the repository at this point in the history
…(#77786)

Adds multi-z support for lazy templates
Also fixes some improper use and placement for turf flags

Shadow needs/wants this for bit runner maps.
Turf flags are also why lava has been generating in places it shouldnt.
(inside of ruins)
:cl:
fix: Lava can no longer occasionally generate inside of previously
loaded templates and breach and/or destroy shit
/:cl:

---------

Co-authored-by: Jeremiah <[email protected]>
Co-authored-by: LemonInTheDark <[email protected]>
  • Loading branch information
3 people authored and dwasint committed Sep 30, 2023
1 parent 260e2da commit e41e5ad
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 19 deletions.
4 changes: 2 additions & 2 deletions code/datums/diseases/advance/symptoms/heal.dm
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@

/datum/symptom/heal/starlight/proc/CanTileHealDirectional(turf/turf_to_check, direction)
if(direction == UP)
turf_to_check = turf_to_check.above()
turf_to_check = GET_TURF_ABOVE(turf_to_check)
if(!turf_to_check)
return STARLIGHT_CANNOT_HEAL
var/area/area_to_check = get_area(turf_to_check)
Expand All @@ -99,7 +99,7 @@
if(istransparentturf(turf_to_check) || istype(turf_to_check, /turf/open/openspace))
// Check above or below us
if(direction == UP)
turf_to_check = turf_to_check.above()
turf_to_check = GET_TURF_ABOVE(turf_to_check)
else
turf_to_check = GET_TURF_BELOW(turf_to_check)

Expand Down
1 change: 1 addition & 0 deletions code/datums/lazy_template.dm
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
/datum/lazy_template/nukie_base
key = LAZY_TEMPLATE_KEY_NUKIEBASE
map_name = "nukie_base"

/datum/lazy_template/wizard_dem
key = LAZY_TEMPLATE_KEY_WIZARDDEN
map_name = "wizard_den"
Expand Down
5 changes: 3 additions & 2 deletions code/game/objects/effects/decals/cleanable/aliens.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@
return
if(mapload)
for (var/i in 1 to range)
if(!isgroundlessturf(loc) || GET_TURF_BELOW(loc))
new /obj/effect/decal/cleanable/xenoblood/xsplatter(loc)
var/turf/my_turf = get_turf(src)
if(!isgroundlessturf(my_turf) || GET_TURF_BELOW(my_turf))
new /obj/effect/decal/cleanable/xenoblood/xsplatter(my_turf)
if (!step_to(src, get_step(src, direction), 0))
break
return
Expand Down
5 changes: 3 additions & 2 deletions code/game/objects/effects/decals/cleanable/humans.dm
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,9 @@
return
if(mapload)
for (var/i in 1 to range)
if(!isgroundlessturf(loc) || GET_TURF_BELOW(loc))
new /obj/effect/decal/cleanable/blood/splatter(loc)
var/turf/my_turf = get_turf(src)
if(!isgroundlessturf(my_turf) || GET_TURF_BELOW(my_turf))
new /obj/effect/decal/cleanable/blood/splatter(my_turf)
if (!step_to(src, get_step(src, direction), 0))
break
return
Expand Down
5 changes: 3 additions & 2 deletions code/game/objects/effects/decals/cleanable/robots.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
return
if(mapload)
for (var/i in 1 to range)
if(prob(40) && (!isgroundlessturf(loc) || GET_TURF_BELOW(loc)))
new /obj/effect/decal/cleanable/oil/streak(loc)
var/turf/my_turf = get_turf(src)
if(prob(40) && (!isgroundlessturf(my_turf) || GET_TURF_BELOW(my_turf)))
new /obj/effect/decal/cleanable/oil/streak(my_turf)
if (!step_to(src, get_step(src, direction), 0))
break
return
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mapping/reader.dm
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@
var/y_skip_above = min(world.maxy - y_relative_to_absolute, y_upper, relative_y)
// How many lines to skip because they'd be above the y cuttoff line
var/y_starting_skip = relative_y - y_skip_above
highest_y += y_starting_skip
highest_y -= y_starting_skip

// Y is the LOWEST it will ever be here, so we can easily set a threshold for how low to go
var/line_count = length(first_column.gridLines)
Expand Down
14 changes: 4 additions & 10 deletions code/modules/mapping/space_management/multiz_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
var/turf/us = get_turf(ref)
if(dir & UP)
dir &= ~UP
return get_step(GET_TURF_ABOVE(get_turf(ref)), dir)
return get_step(GET_TURF_ABOVE(us), dir)
if(dir & DOWN)
dir &= ~DOWN
return get_step(GET_TURF_BELOW(get_turf(ref)), dir)
return get_step(GET_TURF_BELOW(us), dir)
return get_step(ref, dir)

/proc/get_dir_multiz(turf/us, turf/them)
Expand All @@ -28,15 +28,9 @@
return get_dir(us, them)
return (dir | get_dir(us, them))

/turf/proc/above()
return GET_TURF_ABOVE(src)

/turf/proc/below()
return GET_TURF_BELOW(src)

/proc/get_lowest_turf(atom/ref)
var/turf/us = get_turf(ref)
var/next = GET_TURF_BELOW(us)
var/turf/next = GET_TURF_BELOW(us)
while(next)
us = next
next = GET_TURF_BELOW(us)
Expand All @@ -45,7 +39,7 @@
// I wish this was lisp
/proc/get_highest_turf(atom/ref)
var/turf/us = get_turf(ref)
var/next = GET_TURF_ABOVE(us)
var/turf/next = GET_TURF_ABOVE(us)
while(next)
us = next
next = GET_TURF_ABOVE(us)
Expand Down

0 comments on commit e41e5ad

Please sign in to comment.