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

@@ -64,6 +64,15 @@
new /obj/item/stack/rods(get_turf(src))
qdel(src)
/obj/structure/railing/blob_act(var/obj/structure/blob/B)
. = ..()
if(B?.overmind?.blob_type)
take_damage(rand(B.overmind.blob_type.damage_lower, B.overmind.blob_type.damage_upper))
return
take_damage(rand(10,30))
/obj/structure/railing/proc/NeighborsCheck(var/UpdateNeighbors = 1)
check = 0
//if (!anchored) return

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)

View File

@@ -62,6 +62,7 @@ var/global/list/overminds = list()
if(B && B.overmind == src)
B.overmind = null
B.update_icon() //reset anything that was ours
B.fall() // No longer held up by whatever blob horror the core had going on (if any), fall like a really gross rock.
for(var/BLO in blob_mobs)
var/mob/living/simple_mob/blob/spore/BM = BLO
@@ -165,3 +166,6 @@ var/global/list/overminds = list()
log_say(message, src)
return 1
/mob/observer/blob/can_fall()
return FALSE

View File

@@ -199,8 +199,24 @@
if(B && B.overmind == src)
break
// Only player-blobs can currently move up or down at will. AI-blobs can only fall downward.
if(!B) // No cardinals, check if it can creep down from above or build up from below.
var/list/T_ZChecks = list()
T_ZChecks["UP"] = GetAbove(T)
T_ZChecks["DOWN"]= GetBelow(T)
for(var/zdir in T_ZChecks)
var/turf/T_check = T_ZChecks[zdir]
if(!T_check)
continue
B = locate(/obj/structure/blob) in T_check
if(B && T.CanZPass(B, (zdir == "UP") ? DOWN : UP)) // Can the blob [B] from [zdir] pass into the target turf by moving in the opposite direction. IE, A blob above enter by moving downward, or reverse.
break
B = null // If both checks fail, B must be nulled for the next check.
if(!B)
to_chat(src, "<span class='warning'>There is no blob cardinally adjacent to the target tile!</span>")
to_chat(src, "<span class='warning'>There is no blob cardinally or vertically adjacent to the target tile!</span>")
return
if(!can_buy(4))

View File

@@ -161,6 +161,9 @@
if(AM.has_buckled_mobs()) // Similarly, the rider entering the turf will bring along whatever they're buckled to
return
if(istype(AM, /obj/structure/blob)) // Blobs can't go down stairs normally. They kind of.. roll down them, when spreading. (See: They just fall.)
return
var/list/atom/movable/pulling = list() // Will also include grabbed mobs
if(isliving(AM))
var/mob/living/L = AM
@@ -203,6 +206,9 @@
if(isobserver(AM)) // Ghosts have their own methods for going up and down
return
if(istype(AM, /obj/structure/blob)) // Blobs can't go down stairs normally. They kind of.. roll down them, when spreading. (See: They just fall.)
return
if(isliving(AM))
var/mob/living/L = AM
@@ -417,6 +423,9 @@
if(AM.has_buckled_mobs()) // Similarly, the rider entering the turf will bring along whatever they're buckled to
return
if(istype(AM, /obj/structure/blob)) // Blobs can't go down stairs normally. They kind of.. roll down them, when spreading. (See: They just fall.)
return
var/list/atom/movable/pulling = list() // Will also include grabbed mobs
if(isliving(AM))
var/mob/living/L = AM
@@ -457,6 +466,9 @@
if(isobserver(AM)) // Ghosts have their own methods for going up and down
return
if(istype(AM, /obj/structure/blob)) // Blobs can't go down stairs normally. They kind of.. roll down them, when spreading. (See: They just fall.)
return
if(isliving(AM))
var/mob/living/L = AM