Blob Maintenance: Stairs are Hard (#9146)

* Fix: Blobs respect gravity if not otherwise prevented.
Tweak: Blobs do not directly interact with stairs
Tweak: Blobs, when expanding against a stair's middle structure, can grow up Z-levels if the turf allows.
Tweak: Blobs, if controlled by a player, may grow upward or downward, if the turfs allow.
Fix: Blob Overmind is no longer affected by gravity.

* Fringe case deleted blobs are null-loc'd for GC so they are not stuck in-map.
Railing checks properly function.
This commit is contained in:
Mechoid
2023-07-23 16:04:37 -07:00
committed by GitHub
parent 9738fe87f4
commit 0f3172ad86
6 changed files with 111 additions and 41 deletions

View File

@@ -86,6 +86,10 @@ GLOBAL_LIST_EMPTY(all_blobs)
overmind.blob_type.on_emp(src, severity)
/obj/structure/blob/proc/pulsed()
if(QDELETED(src))
loc = null
overmind = null
return
if(pulse_timestamp <= world.time)
consume_tile()
if(heal_timestamp <= world.time)
@@ -96,6 +100,7 @@ GLOBAL_LIST_EMPTY(all_blobs)
if(overmind)
faction = overmind.blob_type.faction
overmind.blob_type.on_pulse(src)
fall() // Make sure to obey gravity.
return TRUE //we did it, we were pulsed!
return FALSE //oh no we failed
@@ -169,6 +174,11 @@ GLOBAL_LIST_EMPTY(all_blobs)
make_blob = FALSE
T.blob_act(src) //hit the turf if it is
if((locate(/obj/structure/stairs/middle) in T) && (locate(/obj/structure/stairs/bottom) in get_turf(src))) // If we're growing against stairs, check for an open space above to grow 'up' the stairs.
var/turf/TAbove = GetAbove(src)
if(TAbove.CanZPass(src, UP)) // Can we pass through the turf above us to enter the tile? If so, swap T to that, we're going upstairs.
T = TAbove
for(var/atom/A in T)
if(!A.CanPass(src, T)) //is anything in the turf impassable
make_blob = FALSE
@@ -192,6 +202,21 @@ GLOBAL_LIST_EMPTY(all_blobs)
else
blob_attack_animation(T, controller) //if we can't, animate that we attacked
/obj/structure/blob/fall_impact(var/atom/hit_atom, var/damage_min = 0, var/damage_max = 10, var/silent = FALSE, var/planetary = FALSE)
..()
playsound(src, 'sound/effects/splat.ogg', 50, 1)
consume_tile()
/obj/structure/blob/can_fall() // Despite popular belief, the blob's belief in its ability to fly doesn't matter. (Unless something else is holding it up)
if(overmind)
for(var/direction in cardinal)
var/turf/other_T = get_step(get_turf(src), direction)
if(other_T)
var/obj/structure/blob/B = locate(/obj/structure/blob/shield) in other_T
if(B && B.overmind)
return FALSE
return TRUE
/obj/structure/blob/proc/do_slide_animation(var/obj/structure/blob/B, var/turf/T, var/expand_reaction)
set waitfor = FALSE
sleep(1) // To have the slide animation work.
@@ -201,6 +226,9 @@ GLOBAL_LIST_EMPTY(all_blobs)
B.density = initial(B.density)
B.forceMove(T)
B.update_icon()
B.fall()
if(B.overmind && expand_reaction)
B.overmind.blob_type.on_expand(src, B, T, B.overmind)
@@ -417,6 +445,7 @@ GLOBAL_LIST_EMPTY(all_blobs)
qdel(src)
else
update_icon()
fall()
/obj/effect/temporary_effect/blob_attack
name = "blob"

View File

@@ -144,7 +144,7 @@ var/global/list/blob_cores = list()
// overmind.update_health_hud()
pulse_area(overmind, 15, BLOB_CORE_PULSE_RANGE, BLOB_CORE_EXPAND_RANGE)
for(var/obj/structure/blob/normal/B in range(1, src))
if(prob(5))
if(B.overmind == overmind && prob(5))
B.change_to(/obj/structure/blob/shield/core, overmind)
overmind.blob_type.on_core_process(src)