From d58dce3bb0ba800ed9e0f8b21f5e080bc77131e1 Mon Sep 17 00:00:00 2001 From: Terilia Date: Mon, 6 Jul 2020 12:29:36 +0200 Subject: [PATCH 1/3] Fixed the very obvious and annoying bug --- code/modules/mob/living/simple_animal/hostile/headcrab.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/modules/mob/living/simple_animal/hostile/headcrab.dm b/code/modules/mob/living/simple_animal/hostile/headcrab.dm index 08eb7128055..1748b301bcf 100644 --- a/code/modules/mob/living/simple_animal/hostile/headcrab.dm +++ b/code/modules/mob/living/simple_animal/hostile/headcrab.dm @@ -23,6 +23,8 @@ robust_searching = 1 var/host_species = "" var/list/human_overlays = list() + var/cycles = 4 + /mob/living/simple_animal/hostile/headcrab/Life(seconds, times_fired) if(..() && !stat) @@ -31,7 +33,6 @@ if(H.stat == DEAD || (!H.check_death_method() && H.health <= HEALTH_THRESHOLD_DEAD)) Zombify(H) break - var/cycles = 4 if(cycles >= 4) for(var/mob/living/simple_animal/K in oview(src, 1)) //Only for corpse right next to/on same tile if(K.stat == DEAD || (!K.check_death_method() && K.health <= HEALTH_THRESHOLD_DEAD)) From faeaab739b1bda41de29824cc350cb608b93cd91 Mon Sep 17 00:00:00 2001 From: Terilia Date: Mon, 6 Jul 2020 12:36:38 +0200 Subject: [PATCH 2/3] And adjusting the scope to reset the cycles. --- code/modules/mob/living/simple_animal/hostile/headcrab.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/mob/living/simple_animal/hostile/headcrab.dm b/code/modules/mob/living/simple_animal/hostile/headcrab.dm index 1748b301bcf..b7cec09e6b5 100644 --- a/code/modules/mob/living/simple_animal/hostile/headcrab.dm +++ b/code/modules/mob/living/simple_animal/hostile/headcrab.dm @@ -41,7 +41,7 @@ health += 10 qdel(K) break - cycles = 0 + cycles = 0 cycles++ /mob/living/simple_animal/hostile/headcrab/OpenFire(atom/A) From 530c00012007ab9809c721bab6494a732651d590 Mon Sep 17 00:00:00 2001 From: Terilia Date: Tue, 14 Jul 2020 10:59:12 +0200 Subject: [PATCH 3/3] Added the modulo operator - who would have thought that is faster :D --- code/modules/mob/living/simple_animal/hostile/headcrab.dm | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/code/modules/mob/living/simple_animal/hostile/headcrab.dm b/code/modules/mob/living/simple_animal/hostile/headcrab.dm index b7cec09e6b5..c093c8e3d36 100644 --- a/code/modules/mob/living/simple_animal/hostile/headcrab.dm +++ b/code/modules/mob/living/simple_animal/hostile/headcrab.dm @@ -23,8 +23,6 @@ robust_searching = 1 var/host_species = "" var/list/human_overlays = list() - var/cycles = 4 - /mob/living/simple_animal/hostile/headcrab/Life(seconds, times_fired) if(..() && !stat) @@ -33,7 +31,7 @@ if(H.stat == DEAD || (!H.check_death_method() && H.health <= HEALTH_THRESHOLD_DEAD)) Zombify(H) break - if(cycles >= 4) + if(times_fired % 4 == 0) for(var/mob/living/simple_animal/K in oview(src, 1)) //Only for corpse right next to/on same tile if(K.stat == DEAD || (!K.check_death_method() && K.health <= HEALTH_THRESHOLD_DEAD)) visible_message("[src] consumes [K] whole!") @@ -41,8 +39,6 @@ health += 10 qdel(K) break - cycles = 0 - cycles++ /mob/living/simple_animal/hostile/headcrab/OpenFire(atom/A) if(check_friendly_fire) @@ -94,7 +90,6 @@ if(is_zombie) qdel(src) - /mob/living/simple_animal/hostile/headcrab/handle_automated_speech() // This way they have different screams when attacking, sometimes. Might be seen as sphagetthi code though. if(speak_chance) if(rand(0,200) < speak_chance) @@ -107,7 +102,6 @@ M.loc = get_turf(src) return ..() - /mob/living/simple_animal/hostile/headcrab/update_icons() . = ..() if(is_zombie)