Attempting to prevent overlapping blob chunks.

This commit is contained in:
MistakeNot4892
2023-07-03 01:38:50 +10:00
parent b7048d890d
commit c9cce12305
2 changed files with 15 additions and 7 deletions

View File

@@ -148,16 +148,17 @@ GLOBAL_LIST_EMPTY(all_blobs)
var/dirn = pick(dirs)
dirs.Remove(dirn)
T = get_step(src, dirn)
var/obj/structure/blob/B = locate(/obj/structure/blob) in T
if(!T)
continue
var/obj/structure/blob/B = locate() in T
if(!B || B.faction != faction) // Allow opposing blobs to fight.
break
else
T = null
T = null
if(!T)
return FALSE
var/make_blob = TRUE //can we make a blob?
if(istype(T, /turf/space) && !(locate(/obj/structure/lattice) in T) && prob(80))
make_blob = FALSE
playsound(src, 'sound/effects/splat.ogg', 50, 1) //Let's give some feedback that we DID try to spawn in space, since players are used to it
@@ -183,7 +184,7 @@ GLOBAL_LIST_EMPTY(all_blobs)
B.density = TRUE
if(T.Enter(B,src)) //NOW we can attempt to move into the tile
do_slide_animation(B, T, expand_reaction)
return B
return QDELETED(B) ? null : B
blob_attack_animation(T, controller)
T.blob_act(src) //if we can't move in hit the turf again
qdel(B) //we should never get to this point, since we checked before moving in. destroy the blob so we don't have two blobs on one tile
@@ -194,6 +195,9 @@ GLOBAL_LIST_EMPTY(all_blobs)
/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.
if(locate(/obj/structure/blob) in T)
qdel(B)
return
B.density = initial(B.density)
B.forceMove(T)
B.update_icon()