Porting multi-z support updates.
This commit is contained in:
+9
-2
@@ -186,6 +186,10 @@
|
||||
else
|
||||
M.forceMove(src)
|
||||
|
||||
//common name
|
||||
/atom/proc/update_multiz(prune_on_fail = FALSE)
|
||||
return FALSE
|
||||
|
||||
/atom/proc/assume_air(datum/gas_mixture/giver)
|
||||
qdel(giver)
|
||||
return null
|
||||
@@ -266,7 +270,7 @@
|
||||
if(SEND_SIGNAL(src, COMSIG_ATOM_GET_EXAMINE_NAME, user, override) & COMPONENT_EXNAME_CHANGED)
|
||||
should_override = TRUE
|
||||
|
||||
|
||||
|
||||
if(blood_DNA && !istype(src, /obj/effect/decal))
|
||||
override[EXAMINE_POSITION_BEFORE] = " blood-stained "
|
||||
should_override = TRUE
|
||||
@@ -832,4 +836,7 @@ Proc for attack log creation, because really why not
|
||||
if(filter_data[name])
|
||||
filter_data -= name
|
||||
update_filters()
|
||||
return TRUE
|
||||
return TRUE
|
||||
|
||||
/atom/proc/intercept_zImpact(atom/movable/AM, levels = 1)
|
||||
return FALSE
|
||||
@@ -35,6 +35,51 @@
|
||||
var/datum/component/orbiter/orbiting
|
||||
var/can_be_z_moved = TRUE
|
||||
|
||||
var/zfalling = FALSE
|
||||
|
||||
/atom/movable/proc/can_zFall(turf/source, levels = 1, turf/target, direction)
|
||||
if(!direction)
|
||||
direction = DOWN
|
||||
if(!source)
|
||||
source = get_turf(src)
|
||||
if(!source)
|
||||
return FALSE
|
||||
if(!target)
|
||||
target = get_step_multiz(source, direction)
|
||||
if(!target)
|
||||
return FALSE
|
||||
return !(movement_type & FLYING) && has_gravity(source) && !throwing
|
||||
|
||||
/atom/movable/proc/onZImpact(turf/T, levels)
|
||||
var/atom/highest = T
|
||||
for(var/i in T.contents)
|
||||
var/atom/A = i
|
||||
if(!A.density)
|
||||
continue
|
||||
if(isobj(A) || ismob(A))
|
||||
if(A.layer > highest.layer)
|
||||
highest = A
|
||||
INVOKE_ASYNC(src, .proc/SpinAnimation, 5, 2)
|
||||
throw_impact(highest)
|
||||
return TRUE
|
||||
|
||||
//For physical constraints to travelling up/down.
|
||||
/atom/movable/proc/can_zTravel(turf/destination, direction)
|
||||
var/turf/T = get_turf(src)
|
||||
if(!T)
|
||||
return FALSE
|
||||
if(!direction)
|
||||
if(!destination)
|
||||
return FALSE
|
||||
direction = get_dir(T, destination)
|
||||
if(direction != UP && direction != DOWN)
|
||||
return FALSE
|
||||
if(!destination)
|
||||
destination = get_step_multiz(src, direction)
|
||||
if(!destination)
|
||||
return FALSE
|
||||
return T.zPassOut(src, direction, destination) && destination.zPassIn(src, direction, T)
|
||||
|
||||
/atom/movable/vv_edit_var(var_name, var_value)
|
||||
var/static/list/banned_edits = list("step_x", "step_y", "step_size")
|
||||
var/static/list/careful_edits = list("bound_x", "bound_y", "bound_width", "bound_height")
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
qdel(src)
|
||||
|
||||
/obj/effect/decal/proc/NeverShouldHaveComeHere(turf/T)
|
||||
return isspaceturf(T) || isclosedturf(T) || islava(T) || istype(T, /turf/open/water) || ischasm(T)
|
||||
return isclosedturf(T) || isgroundlessturf(T)
|
||||
|
||||
/obj/effect/decal/ex_act(severity, target)
|
||||
qdel(src)
|
||||
|
||||
@@ -57,6 +57,9 @@
|
||||
/obj/effect/abstract/singularity_act()
|
||||
return
|
||||
|
||||
/obj/effect/abstract/has_gravity(turf/T)
|
||||
return FALSE
|
||||
|
||||
/obj/effect/dummy/singularity_pull()
|
||||
return
|
||||
|
||||
|
||||
@@ -100,6 +100,7 @@
|
||||
number_of_rods = 2
|
||||
smooth = SMOOTH_TRUE
|
||||
canSmoothWith = null
|
||||
obj_flags = CAN_BE_HIT | BLOCK_Z_FALL
|
||||
|
||||
/obj/structure/lattice/catwalk/deconstruction_hints(mob/user)
|
||||
to_chat(user, "<span class='notice'>The supporting rods look like they could be <b>cut</b>.</span>")
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
#define STAIR_TERMINATOR_AUTOMATIC 0
|
||||
#define STAIR_TERMINATOR_NO 1
|
||||
#define STAIR_TERMINATOR_YES 2
|
||||
|
||||
/obj/structure/stairs
|
||||
name = "stairs"
|
||||
icon = 'icons/obj/stairs.dmi'
|
||||
icon_state = "stairs"
|
||||
anchored = TRUE
|
||||
//dir = direction of travel to go upwards
|
||||
|
||||
var/force_open_above = FALSE
|
||||
var/terminator_mode = STAIR_TERMINATOR_AUTOMATIC
|
||||
var/turf/listeningTo
|
||||
|
||||
/obj/structure/stairs/Initialize(mapload)
|
||||
if(force_open_above)
|
||||
force_open_above()
|
||||
build_signal_listener()
|
||||
update_surrounding()
|
||||
return ..()
|
||||
|
||||
/obj/structure/stairs/Destroy()
|
||||
listeningTo = null
|
||||
return ..()
|
||||
|
||||
/obj/structure/stairs/Move() //Look this should never happen but...
|
||||
. = ..()
|
||||
if(force_open_above)
|
||||
build_signal_listener()
|
||||
update_surrounding()
|
||||
|
||||
/obj/structure/stairs/proc/update_surrounding()
|
||||
update_icon()
|
||||
for(var/i in GLOB.cardinals)
|
||||
var/turf/T = get_step(get_turf(src), i)
|
||||
var/obj/structure/stairs/S = locate() in T
|
||||
if(S)
|
||||
S.update_icon()
|
||||
|
||||
/obj/structure/stairs/Uncross(atom/movable/AM, turf/newloc)
|
||||
if(!newloc || !AM)
|
||||
return ..()
|
||||
if(!isobserver(AM) && isTerminator() && (get_dir(src, newloc) == dir))
|
||||
stair_ascend(AM)
|
||||
return FALSE
|
||||
return ..()
|
||||
|
||||
/obj/structure/stairs/Cross(atom/movable/AM)
|
||||
if(isTerminator() && (get_dir(src, AM) == dir))
|
||||
return FALSE
|
||||
return ..()
|
||||
|
||||
/obj/structure/stairs/update_icon()
|
||||
if(isTerminator())
|
||||
icon_state = "stairs_t"
|
||||
else
|
||||
icon_state = "stairs"
|
||||
|
||||
/obj/structure/stairs/proc/stair_ascend(atom/movable/AM)
|
||||
var/turf/checking = get_step_multiz(get_turf(src), UP)
|
||||
if(!istype(checking))
|
||||
return
|
||||
if(!checking.zPassIn(AM, UP, get_turf(src)))
|
||||
return
|
||||
var/turf/target = get_step_multiz(get_turf(src), (dir|UP))
|
||||
if(istype(target) && !target.can_zFall(AM, null, get_step_multiz(target, DOWN))) //Don't throw them into a tile that will just dump them back down.
|
||||
if(isliving(AM))
|
||||
var/mob/living/L = AM
|
||||
var/pulling = L.pulling
|
||||
if(pulling)
|
||||
L.pulling.forceMove(target)
|
||||
L.forceMove(target)
|
||||
L.start_pulling(pulling)
|
||||
else
|
||||
AM.forceMove(target)
|
||||
|
||||
/obj/structure/stairs/vv_edit_var(var_name, var_value)
|
||||
. = ..()
|
||||
if(!.)
|
||||
return
|
||||
if(var_name != NAMEOF(src, force_open_above))
|
||||
return
|
||||
if(!var_value)
|
||||
if(listeningTo)
|
||||
UnregisterSignal(listeningTo, COMSIG_TURF_MULTIZ_NEW)
|
||||
listeningTo = null
|
||||
else
|
||||
build_signal_listener()
|
||||
force_open_above()
|
||||
|
||||
/obj/structure/stairs/proc/build_signal_listener()
|
||||
if(listeningTo)
|
||||
UnregisterSignal(listeningTo, COMSIG_TURF_MULTIZ_NEW)
|
||||
var/turf/open/openspace/T = get_step_multiz(get_turf(src), UP)
|
||||
RegisterSignal(T, COMSIG_TURF_MULTIZ_NEW, .proc/on_multiz_new)
|
||||
listeningTo = T
|
||||
|
||||
/obj/structure/stairs/proc/force_open_above()
|
||||
var/turf/open/openspace/T = get_step_multiz(get_turf(src), UP)
|
||||
if(T && !istype(T))
|
||||
T.ChangeTurf(/turf/open/openspace)
|
||||
|
||||
/obj/structure/stairs/proc/on_multiz_new(turf/source, dir)
|
||||
if(dir == UP)
|
||||
var/turf/open/openspace/T = get_step_multiz(get_turf(src), UP)
|
||||
if(T && !istype(T))
|
||||
T.ChangeTurf(/turf/open/openspace)
|
||||
|
||||
/obj/structure/stairs/intercept_zImpact(atom/movable/AM, levels = 1)
|
||||
return isTerminator()
|
||||
|
||||
/obj/structure/stairs/proc/isTerminator() //If this is the last stair in a chain and should move mobs up
|
||||
if(terminator_mode != STAIR_TERMINATOR_AUTOMATIC)
|
||||
return (terminator_mode == STAIR_TERMINATOR_YES)
|
||||
var/turf/T = get_turf(src)
|
||||
if(!T)
|
||||
return FALSE
|
||||
var/turf/them = get_step(T, dir)
|
||||
if(!them)
|
||||
return FALSE
|
||||
for(var/obj/structure/stairs/S in them)
|
||||
if(S.dir == dir)
|
||||
return FALSE
|
||||
return TRUE
|
||||
+19
-32
@@ -16,6 +16,22 @@
|
||||
if(wet)
|
||||
AddComponent(/datum/component/wet_floor, wet, INFINITY, 0, INFINITY, TRUE)
|
||||
|
||||
//direction is direction of travel of A
|
||||
/turf/open/zPassIn(atom/movable/A, direction, turf/source)
|
||||
return (direction == DOWN)
|
||||
|
||||
//direction is direction of travel of A
|
||||
/turf/open/zPassOut(atom/movable/A, direction, turf/destination)
|
||||
return (direction == UP)
|
||||
|
||||
//direction is direction of travel of air
|
||||
/turf/open/zAirIn(direction, turf/source)
|
||||
return (direction == DOWN)
|
||||
|
||||
//direction is direction of travel of air
|
||||
/turf/open/zAirOut(direction, turf/source)
|
||||
return (direction == UP)
|
||||
|
||||
/turf/open/MouseDrop_T(atom/dropping, mob/user)
|
||||
. = ..()
|
||||
if(dropping == user && isliving(user))
|
||||
@@ -184,43 +200,14 @@
|
||||
update_visuals()
|
||||
|
||||
current_cycle = times_fired
|
||||
|
||||
//cache some vars
|
||||
var/list/atmos_adjacent_turfs = src.atmos_adjacent_turfs
|
||||
|
||||
for(var/direction in GLOB.cardinals)
|
||||
var/turf/open/enemy_tile = get_step(src, direction)
|
||||
if(!istype(enemy_tile))
|
||||
if (atmos_adjacent_turfs)
|
||||
atmos_adjacent_turfs -= enemy_tile
|
||||
continue
|
||||
CalculateAdjacentTurfs()
|
||||
for(var/i in atmos_adjacent_turfs)
|
||||
var/turf/open/enemy_tile = i
|
||||
var/datum/gas_mixture/enemy_air = enemy_tile.return_air()
|
||||
|
||||
//only check this turf, if it didn't check us when it was initalized
|
||||
if(enemy_tile.current_cycle < times_fired)
|
||||
if(CANATMOSPASS(src, enemy_tile))
|
||||
LAZYINITLIST(atmos_adjacent_turfs)
|
||||
LAZYINITLIST(enemy_tile.atmos_adjacent_turfs)
|
||||
atmos_adjacent_turfs[enemy_tile] = TRUE
|
||||
enemy_tile.atmos_adjacent_turfs[src] = TRUE
|
||||
else
|
||||
if (atmos_adjacent_turfs)
|
||||
atmos_adjacent_turfs -= enemy_tile
|
||||
if (enemy_tile.atmos_adjacent_turfs)
|
||||
enemy_tile.atmos_adjacent_turfs -= src
|
||||
UNSETEMPTY(enemy_tile.atmos_adjacent_turfs)
|
||||
continue
|
||||
else
|
||||
if (!atmos_adjacent_turfs || !atmos_adjacent_turfs[enemy_tile])
|
||||
continue
|
||||
|
||||
if(!excited && air.compare(enemy_air))
|
||||
//testing("Active turf found. Return value of compare(): [is_active]")
|
||||
excited = TRUE
|
||||
SSair.active_turfs |= src
|
||||
UNSETEMPTY(atmos_adjacent_turfs)
|
||||
if (atmos_adjacent_turfs)
|
||||
src.atmos_adjacent_turfs = atmos_adjacent_turfs
|
||||
|
||||
/turf/open/proc/GetHeatCapacity()
|
||||
. = air.heat_capacity()
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
/turf/open/openspace
|
||||
name = "open space"
|
||||
desc = "Watch your step!"
|
||||
icon_state = "grey"
|
||||
baseturfs = /turf/open/openspace
|
||||
CanAtmosPassVertical = ATMOS_PASS_YES
|
||||
plane = FLOOR_OPENSPACE_PLANE
|
||||
layer = OPENSPACE_LAYER
|
||||
//mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
||||
var/can_cover_up = TRUE
|
||||
var/can_build_on = TRUE
|
||||
|
||||
/turf/open/openspace/debug/update_multiz()
|
||||
..()
|
||||
return TRUE
|
||||
|
||||
/turf/open/openspace/Initialize()
|
||||
. = ..()
|
||||
return INITIALIZE_HINT_LATELOAD
|
||||
|
||||
/turf/open/openspace/LateInitialize()
|
||||
update_multiz(TRUE, TRUE)
|
||||
|
||||
/turf/open/openspace/Destroy()
|
||||
vis_contents.len = 0
|
||||
return ..()
|
||||
|
||||
/turf/open/openspace/update_multiz(prune_on_fail = FALSE, init = FALSE)
|
||||
. = ..()
|
||||
var/turf/T = below()
|
||||
if(!T)
|
||||
vis_contents.len = 0
|
||||
if(prune_on_fail)
|
||||
ChangeTurf(/turf/open/floor/plating)
|
||||
return FALSE
|
||||
if(init)
|
||||
vis_contents += T
|
||||
return TRUE
|
||||
|
||||
/turf/open/openspace/multiz_turf_del(turf/T, dir)
|
||||
if(dir != DOWN)
|
||||
return
|
||||
update_multiz()
|
||||
|
||||
/turf/open/openspace/multiz_turf_new(turf/T, dir)
|
||||
if(dir != DOWN)
|
||||
return
|
||||
update_multiz()
|
||||
|
||||
/turf/open/openspace/zAirIn()
|
||||
return TRUE
|
||||
|
||||
/turf/open/openspace/zAirOut()
|
||||
return TRUE
|
||||
|
||||
/turf/open/openspace/zPassIn(atom/movable/A, direction, turf/source)
|
||||
return TRUE
|
||||
|
||||
/turf/open/openspace/zPassOut(atom/movable/A, direction, turf/destination)
|
||||
if(A.anchored)
|
||||
return FALSE
|
||||
for(var/obj/O in contents)
|
||||
if(O.obj_flags & BLOCK_Z_FALL)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/turf/open/openspace/proc/CanCoverUp()
|
||||
return can_cover_up
|
||||
|
||||
/turf/open/openspace/proc/CanBuildHere()
|
||||
return can_build_on
|
||||
|
||||
/turf/open/openspace/attackby(obj/item/C, mob/user, params)
|
||||
..()
|
||||
if(!CanBuildHere())
|
||||
return
|
||||
if(istype(C, /obj/item/stack/rods))
|
||||
var/obj/item/stack/rods/R = C
|
||||
var/obj/structure/lattice/L = locate(/obj/structure/lattice, src)
|
||||
var/obj/structure/lattice/catwalk/W = locate(/obj/structure/lattice/catwalk, src)
|
||||
if(W)
|
||||
to_chat(user, "<span class='warning'>There is already a catwalk here!</span>")
|
||||
return
|
||||
if(L)
|
||||
if(R.use(1))
|
||||
to_chat(user, "<span class='notice'>You construct a catwalk.</span>")
|
||||
playsound(src, 'sound/weapons/genhit.ogg', 50, 1)
|
||||
new/obj/structure/lattice/catwalk(src)
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need two rods to build a catwalk!</span>")
|
||||
return
|
||||
if(R.use(1))
|
||||
to_chat(user, "<span class='notice'>You construct a lattice.</span>")
|
||||
playsound(src, 'sound/weapons/genhit.ogg', 50, 1)
|
||||
ReplaceWithLattice()
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need one rod to build a lattice.</span>")
|
||||
return
|
||||
if(istype(C, /obj/item/stack/tile/plasteel))
|
||||
if(!CanCoverUp())
|
||||
return
|
||||
var/obj/structure/lattice/L = locate(/obj/structure/lattice, src)
|
||||
if(L)
|
||||
var/obj/item/stack/tile/plasteel/S = C
|
||||
if(S.use(1))
|
||||
qdel(L)
|
||||
playsound(src, 'sound/weapons/genhit.ogg', 50, 1)
|
||||
to_chat(user, "<span class='notice'>You build a floor.</span>")
|
||||
PlaceOnTop(/turf/open/floor/plating)
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need one floor tile to build a floor!</span>")
|
||||
else
|
||||
to_chat(user, "<span class='warning'>The plating is going to need some support! Place metal rods first.</span>")
|
||||
|
||||
/turf/open/openspace/rcd_vals(mob/user, obj/item/construction/rcd/the_rcd)
|
||||
if(!CanBuildHere())
|
||||
return FALSE
|
||||
|
||||
switch(the_rcd.mode)
|
||||
if(RCD_FLOORWALL)
|
||||
var/obj/structure/lattice/L = locate(/obj/structure/lattice, src)
|
||||
if(L)
|
||||
return list("mode" = RCD_FLOORWALL, "delay" = 0, "cost" = 1)
|
||||
else
|
||||
return list("mode" = RCD_FLOORWALL, "delay" = 0, "cost" = 3)
|
||||
return FALSE
|
||||
|
||||
/turf/open/openspace/rcd_act(mob/user, obj/item/construction/rcd/the_rcd, passed_mode)
|
||||
switch(passed_mode)
|
||||
if(RCD_FLOORWALL)
|
||||
to_chat(user, "<span class='notice'>You build a floor.</span>")
|
||||
PlaceOnTop(/turf/open/floor/plating, flags = CHANGETURF_INHERIT_AIR)
|
||||
return TRUE
|
||||
return FALSE
|
||||
+67
-1
@@ -39,7 +39,7 @@
|
||||
return FALSE
|
||||
. = ..()
|
||||
|
||||
/turf/Initialize()
|
||||
/turf/Initialize(mapload)
|
||||
if(flags_1 & INITIALIZED_1)
|
||||
stack_trace("Warning: [src]([type]) initialized multiple times!")
|
||||
flags_1 |= INITIALIZED_1
|
||||
@@ -68,6 +68,15 @@
|
||||
if (light_power && light_range)
|
||||
update_light()
|
||||
|
||||
var/turf/T = SSmapping.get_turf_above(src)
|
||||
if(T)
|
||||
T.multiz_turf_new(src, DOWN)
|
||||
SEND_SIGNAL(T, COMSIG_TURF_MULTIZ_NEW, src, DOWN)
|
||||
T = SSmapping.get_turf_below(src)
|
||||
if(T)
|
||||
T.multiz_turf_new(src, UP)
|
||||
SEND_SIGNAL(T, COMSIG_TURF_MULTIZ_NEW, src, UP)
|
||||
|
||||
if (opacity)
|
||||
has_opaque_atom = TRUE
|
||||
|
||||
@@ -83,6 +92,12 @@
|
||||
if(!changing_turf)
|
||||
stack_trace("Incorrect turf deletion")
|
||||
changing_turf = FALSE
|
||||
var/turf/T = SSmapping.get_turf_above(src)
|
||||
if(T)
|
||||
T.multiz_turf_del(src, DOWN)
|
||||
T = SSmapping.get_turf_below(src)
|
||||
if(T)
|
||||
T.multiz_turf_del(src, UP)
|
||||
if(force)
|
||||
..()
|
||||
//this will completely wipe turf state
|
||||
@@ -105,6 +120,54 @@
|
||||
return
|
||||
user.Move_Pulled(src)
|
||||
|
||||
/turf/proc/multiz_turf_del(turf/T, dir)
|
||||
|
||||
/turf/proc/multiz_turf_new(turf/T, dir)
|
||||
|
||||
//zPassIn doesn't necessarily pass an atom!
|
||||
//direction is direction of travel of air
|
||||
/turf/proc/zPassIn(atom/movable/A, direction, turf/source)
|
||||
return FALSE
|
||||
|
||||
//direction is direction of travel of air
|
||||
/turf/proc/zPassOut(atom/movable/A, direction, turf/destination)
|
||||
return FALSE
|
||||
|
||||
//direction is direction of travel of air
|
||||
/turf/proc/zAirIn(direction, turf/source)
|
||||
return FALSE
|
||||
|
||||
//direction is direction of travel of air
|
||||
/turf/proc/zAirOut(direction, turf/source)
|
||||
return FALSE
|
||||
|
||||
/turf/proc/zImpact(atom/movable/A, levels = 1)
|
||||
for(var/i in contents)
|
||||
var/atom/thing = i
|
||||
if(thing.intercept_zImpact(A, levels))
|
||||
return FALSE
|
||||
if(zFall(A, ++levels))
|
||||
return FALSE
|
||||
A.visible_message("<span class='danger'>[A] crashes into [src]!</span>")
|
||||
A.onZImpact(src, levels)
|
||||
return TRUE
|
||||
|
||||
/turf/proc/can_zFall(atom/movable/A, levels = 1, turf/target)
|
||||
return zPassOut(A, DOWN, target) && target.zPassIn(A, DOWN, src)
|
||||
|
||||
/turf/proc/zFall(atom/movable/A, levels = 1, force = FALSE)
|
||||
var/turf/target = get_step_multiz(src, DOWN)
|
||||
if(!target || (!isobj(A) && !ismob(A)))
|
||||
return FALSE
|
||||
if(!force && (!can_zFall(A, levels, target) || !A.can_zFall(src, levels, target, DOWN)))
|
||||
return FALSE
|
||||
A.visible_message("<span class='danger'>[A] falls through [src]!</span>")
|
||||
A.zfalling = TRUE
|
||||
A.forceMove(target)
|
||||
A.zfalling = FALSE
|
||||
target.zImpact(A, levels)
|
||||
return TRUE
|
||||
|
||||
/turf/proc/handleRCL(obj/item/twohanded/rcl/C, mob/user)
|
||||
if(C.loaded)
|
||||
for(var/obj/structure/cable/LC in src)
|
||||
@@ -196,6 +259,9 @@
|
||||
if(O.obj_flags & FROZEN)
|
||||
O.make_unfrozen()
|
||||
|
||||
if(!AM.zfalling)
|
||||
zFall(AM)
|
||||
|
||||
/turf/proc/is_plasteel_floor()
|
||||
return FALSE
|
||||
|
||||
|
||||
Reference in New Issue
Block a user