Fixes blob diagonal expansion (#25848)

* fixes double_expand runtime with null overmind

* Apply suggestions from code review

Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>
Signed-off-by: chuga-git <98280110+chuga-git@users.noreply.github.com>

* DGL reviews

* today on git butchers applying suggestions

* Update code/modules/events/blob/theblob.dm

Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Signed-off-by: chuga-git <98280110+chuga-git@users.noreply.github.com>

---------

Signed-off-by: chuga-git <98280110+chuga-git@users.noreply.github.com>
Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>
Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
This commit is contained in:
chuga-git
2024-06-12 16:59:26 -05:00
committed by GitHub
parent b842e3909a
commit e7e340598c
+51 -37
View File
@@ -50,11 +50,9 @@ GLOBAL_LIST_EMPTY(blob_minions)
return ..()
/obj/structure/blob/CanPass(atom/movable/mover, turf/target, height=0)
if(height==0)
return 1
if(istype(mover) && mover.checkpass(PASSBLOB))
return 1
return 0
if(height == 0)
return TRUE
return istype(mover) && mover.checkpass(PASSBLOB)
/obj/structure/blob/CanAtmosPass(direction)
return !atmosblock
@@ -89,12 +87,15 @@ GLOBAL_LIST_EMPTY(blob_minions)
/obj/structure/blob/proc/RegenHealth()
// All blobs heal over time when pulsed, but it has a cool down
if(health_timestamp > world.time)
return 0
return FALSE
var/turf/T = get_turf(src)
chemical_attack(T)
if(obj_integrity < max_integrity)
obj_integrity = min(max_integrity, obj_integrity + 1)
check_integrity()
health_timestamp = world.time + 10 // 1 seconds
/obj/structure/blob/proc/chemical_attack(turf/T)
@@ -118,26 +119,23 @@ GLOBAL_LIST_EMPTY(blob_minions)
return//Inf loop check
//Looking for another blob to pulse
var/list/dirs = list(1,2,4,8)
var/list/dirs = list(NORTH, SOUTH, EAST, WEST)
dirs.Remove(origin_dir)//Dont pulse the guy who pulsed us
for(var/i = 1 to 4)
if(!length(dirs)) break
var/dirn = pick(dirs)
dirs.Remove(dirn)
var/turf/T = get_step(src, dirn)
var/obj/structure/blob/B = (locate(/obj/structure/blob) in T)
if(!B)
expand(T, 1, a_color, overmind)//No blob here so try and expand
return
B.adjustcolors(a_color)
B.Pulse((pulse+1),get_dir(src.loc,T), a_color)
if(!length(dirs))
return
return
var/dirn = pick_n_take(dirs)
var/turf/T = get_step(src, dirn)
var/obj/structure/blob/B = locate(/obj/structure/blob) in T
if(!B)
expand(T, 1, a_color, overmind) //No blob here so try and expand
return
B.adjustcolors(a_color)
B.Pulse(pulse + 1, get_dir(loc, T), a_color)
/obj/structure/blob/proc/run_action()
return 0
return FALSE
/obj/structure/blob/proc/ConsumeTile()
for(var/atom/A in loc)
@@ -145,31 +143,42 @@ GLOBAL_LIST_EMPTY(blob_minions)
if(iswallturf(loc))
loc.blob_act(src) //don't ask how a wall got on top of the core, just eat it
/obj/structure/blob/proc/expand(turf/T = null, prob = 1, a_color, _overmind = null, turf/double_target = null)
/obj/structure/blob/proc/expand(turf/T, prob = TRUE, a_color, _overmind, turf/double_target)
if(prob && !prob(obj_integrity))
return
if(isspaceturf(T) && prob(75)) return
if(!T)
var/list/dirs = list(1,2,4,8)
for(var/i = 1 to 4)
var/dirn = pick(dirs)
dirs.Remove(dirn)
T = get_step(src, dirn)
if(!(locate(/obj/structure/blob) in T)) break
else T = null
if(!T) return 0
if(isspaceturf(T) && prob(75))
return
if(!T)
var/list/dirs = list(NORTH, SOUTH, EAST, WEST)
for(var/i = 1 to 4)
var/dirn = pick_n_take(dirs)
T = get_step(src, dirn)
if(!(locate(/obj/structure/blob) in T))
break
else
T = null
if(!T)
return FALSE
var/obj/structure/blob/normal/B = new /obj/structure/blob/normal(src.loc, min(obj_integrity, 30))
B.color = a_color
B.density = TRUE
B.overmind = _overmind
if(T.Enter(B,src))//Attempt to move into the tile
B.density = initial(B.density)
B.loc = T
if(double_target)
if(!overmind.can_buy(5))
overmind.last_attack = world.time
return
B.expand(double_target, 0, overmind.blob_reagent_datum.color, overmind)
overmind.blob_core.chemical_attack(T)
overmind.last_attack = world.time
@@ -185,14 +194,14 @@ GLOBAL_LIST_EMPTY(blob_minions)
overmind.blob_reagent_datum.reaction_mob(M, REAGENT_TOUCH, 25, 1, mob_protection)
overmind.blob_reagent_datum.send_message(M)
A.blob_act(src)
return 1
return TRUE
/obj/structure/blob/proc/double_expand(turf/T = null, prob = 1, a_color, _overmind = null)
/obj/structure/blob/proc/double_expand(turf/T, prob = TRUE, a_color, mob/camera/blob/incoming_overmind)
for(var/turf/adjacent in circlerange(T, 1))
if(adjacent in circlerange(src, 1))
expand(adjacent, 0, overmind.blob_reagent_datum.color, overmind, T)
overmind.blob_core.chemical_attack(adjacent)
color = overmind.blob_reagent_datum.color
expand(adjacent, 0, incoming_overmind.blob_reagent_datum.color, incoming_overmind, T)
incoming_overmind.blob_core.chemical_attack(adjacent)
color = incoming_overmind.blob_reagent_datum.color
return
/obj/structure/blob/Crossed(mob/living/L, oldloc)
@@ -230,12 +239,15 @@ GLOBAL_LIST_EMPTY(blob_minions)
damage_amount *= fire_resist
else
return 0
var/armor_protection = 0
if(damage_flag)
armor_protection = armor.getRating(damage_flag)
damage_amount = round(damage_amount * (100 - armor_protection)*0.01, 0.1)
if(overmind && damage_flag)
damage_amount = overmind.blob_reagent_datum.damage_reaction(src, damage_amount, damage_type, damage_flag)
return damage_amount
/obj/structure/blob/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1, attack_dir)
@@ -246,11 +258,13 @@ GLOBAL_LIST_EMPTY(blob_minions)
/obj/structure/blob/proc/change_to(type)
if(!ispath(type))
error("[type] is an invalid type for the blob.")
var/obj/structure/blob/B = new type(src.loc)
if(!istype(type, /obj/structure/blob/core) || !istype(type, /obj/structure/blob/node))
B.color = color
else
B.adjustcolors(color)
qdel(src)
/obj/structure/blob/proc/adjustcolors(a_color)