Files
Polaris/code/game/turfs/turf_changing.dm
Jon 85c704676f Updates all get_base_turf usages to get_base_turf_by_area.
This means that instead of the base turf being defined by the z-level, it's now defined by area and defaulted by z-level.

Updates all "shuttle" and "solar" areas to have a base_turf of space.
Updates docking arms 1, 2, and 3 on the main asteroid level to have a base_turf of space.

Other z-levels may still need updating.

This change means that all actions which destroy or dismantle a tile - for example bombs, a singularity, a shuttle leaving, or deconstruction - now leave these new areas as space not asteroid. Future mapping efforts may need to take this into account.
2015-12-05 04:24:17 +00:00

87 lines
2.3 KiB
Plaintext

/turf/proc/ReplaceWithLattice()
src.ChangeTurf(get_base_turf_by_area(src))
spawn()
new /obj/structure/lattice( locate(src.x, src.y, src.z) )
// Removes all signs of lattice on the pos of the turf -Donkieyo
/turf/proc/RemoveLattice()
var/obj/structure/lattice/L = locate(/obj/structure/lattice, src)
if(L)
qdel(L)
//Creates a new turf
/turf/proc/ChangeTurf(var/turf/N, var/tell_universe=1, var/force_lighting_update = 0)
if (!N)
return
// This makes sure that turfs are not changed to space when one side is part of a zone
if(N == /turf/space)
var/turf/below = GetBelow(src)
if(istype(below) && (air_master.has_valid_zone(below) || air_master.has_valid_zone(src)))
N = /turf/simulated/open
var/obj/fire/old_fire = fire
var/old_opacity = opacity
var/old_dynamic_lighting = dynamic_lighting
var/list/old_affecting_lights = affecting_lights
var/old_lighting_overlay = lighting_overlay
//world << "Replacing [src.type] with [N]"
if(connections) connections.erase_all()
if(istype(src,/turf/simulated))
//Yeah, we're just going to rebuild the whole thing.
//Despite this being called a bunch during explosions,
//the zone will only really do heavy lifting once.
var/turf/simulated/S = src
if(S.zone) S.zone.rebuild()
if(ispath(N, /turf/simulated/floor))
var/turf/simulated/W = new N( locate(src.x, src.y, src.z) )
if(old_fire)
fire = old_fire
if (istype(W,/turf/simulated/floor))
W.RemoveLattice()
if(tell_universe)
universe.OnTurfChange(W)
if(air_master)
air_master.mark_for_update(src) //handle the addition of the new turf.
for(var/turf/space/S in range(W,1))
S.update_starlight()
W.levelupdate()
. = W
else
var/turf/W = new N( locate(src.x, src.y, src.z) )
if(old_fire)
old_fire.RemoveFire()
if(tell_universe)
universe.OnTurfChange(W)
if(air_master)
air_master.mark_for_update(src)
for(var/turf/space/S in range(W,1))
S.update_starlight()
W.levelupdate()
. = W
lighting_overlay = old_lighting_overlay
affecting_lights = old_affecting_lights
if((old_opacity != opacity) || (dynamic_lighting != old_dynamic_lighting) || force_lighting_update)
reconsider_lights()
if(dynamic_lighting != old_dynamic_lighting)
if(dynamic_lighting)
lighting_build_overlays()
else
lighting_clear_overlays()