Files
Aurora.3/code/modules/multiz/turf.dm
Lohikar f702f99f14 Openturf throw fix & minor refactors (#2203)
changes:

Thrown objects will now fire Entered() on the turf they land on. As a result, they will now fall if they land on an openturf.
Openturfs now queue an icon update if something falls down.
/obj/item/weapon/ore_radar converted to use SSfast_process instead of a spawn loop.
Converted hand-held tanks' New() to Initialize().
Note: This PR allows grenades to be thrown down openturfs.
2017-05-13 12:35:40 +03:00

136 lines
3.3 KiB
Plaintext

/turf/proc/CanZPass(atom/A, direction)
if(z == A.z) //moving FROM this turf
return direction == UP //can't go below
else
if(direction == UP) //on a turf below, trying to enter
return 0
if(direction == DOWN) //on a turf above, trying to enter
return !density
/turf/simulated/open/CanZPass(atom, direction)
return 1
/turf/space/CanZPass(atom, direction)
return 1
/turf/simulated/open
name = "open space"
icon = 'icons/turf/space.dmi'
icon_state = ""
plane = PLANE_SPACE_BACKGROUND
density = 0
pathweight = 100000 //Seriously, don't try and path over this one numbnuts
is_hole = TRUE
var/tmp/turf/below
var/tmp/atom/movable/openspace/multiplier/shadower // Overlay used to multiply color of all OO overlays at once.
var/tmp/updating = FALSE // If this turf is queued for openturf update.
var/tmp/last_seen_turf // A soft reference to the last turf present when this was updated.
var/tmp/depth
/turf/simulated/open/proc/is_above_space()
var/turf/T = GetBelow(src)
while (T && T.is_hole)
if (istype(T, /turf/space))
return TRUE
T = GetBelow(T)
return FALSE
/turf/simulated/open/Destroy()
SSopenturf.openspace_turfs -= src
SSopenturf.queued_turfs -= src
QDEL_NULL(shadower)
for (var/atom/movable/openspace/overlay in src)
qdel(overlay)
if (istype(above))
above.update()
above = null
below = null
return ..()
/turf/simulated/open/airless
oxygen = 0
nitrogen = 0
temperature = TCMB
/turf/simulated/open/post_change()
..()
update()
/turf/simulated/open/Initialize()
. = ..()
update()
SSopenturf.openspace_turfs += src
/turf/simulated/open/proc/update()
set waitfor = FALSE
below = GetBelow(src)
below.above = src
levelupdate()
for(var/atom/movable/A in src)
A.fall()
update_icon()
/turf/simulated/open/update_dirt()
return 0
/turf/simulated/open/Entered(atom/movable/mover)
..()
mover.fall()
update_icon()
// override to make sure nothing is hidden
/turf/simulated/open/levelupdate()
for(var/obj/O in src)
O.hide(0)
/turf/simulated/open/update_icon()
if(!updating && below)
updating = TRUE
SSopenturf.queued_turfs += src
if (above)
// Cascade updates until we hit the top openturf.
above.update_icon()
/turf/simulated/open/attackby(obj/item/C as obj, mob/user as mob)
if (istype(C, /obj/item/stack/rods))
var/obj/structure/lattice/L = locate(/obj/structure/lattice, src)
if(L)
return
var/obj/item/stack/rods/R = C
if (R.use(1))
to_chat(user, "<span class='notice'>You lay down the support lattice.</span>")
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
new /obj/structure/lattice(locate(src.x, src.y, src.z))
return
if (istype(C, /obj/item/stack/tile))
var/obj/structure/lattice/L = locate(/obj/structure/lattice, src)
if(L)
var/obj/item/stack/tile/floor/S = C
if (S.get_amount() < 1)
return
qdel(L)
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
S.use(1)
ChangeTurf(/turf/simulated/floor/airless)
return
else
to_chat(user, "<span class='warning'>The plating is going to need some support.</span>")
//To lay cable.
if(istype(C, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/coil = C
coil.turf_place(src, user)
return
return
//Most things use is_plating to test if there is a cover tile on top (like regular floors)
/turf/simulated/open/is_plating()
return 1