From 0d8c6e91df56561b017ec55631a8c488e4ba30ee Mon Sep 17 00:00:00 2001 From: Razgriz Date: Tue, 9 Apr 2019 18:56:06 -0700 Subject: [PATCH] MoveAndShoot optimization Added if statements to state 3 and 4 of the mob's states so that it won't run the MoveAndShoot() proc unless the mob's move_shoot var is true. --- .../mob/living/simple_animal/simple_animal.dm | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 510cfd88be..c1751ef5ba 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -583,11 +583,13 @@ annoyed = 50 a_intent = I_HURT RequestHelp() - MoveAndShoot() + if(move_shoot) + MoveAndShoot() MoveToTarget() if(STANCE_ATTACKING) annoyed = 50 - MoveAndShoot() + if(move_shoot) + MoveAndShoot() AttackTarget() /mob/living/simple_animal/proc/handle_supernatural() @@ -1262,12 +1264,7 @@ ai_log("AttackTarget() vs. [target_mob]",1) var/distance = get_dist(src, target_mob) face_atom(target_mob) -/* - if(move_shoot == 1 && distance <= shoot_range && distance >= 2 && ranged_cooldown <= world.time) - ai_log("AttackTarget() ranged",3) - ShootTarget(target_mob) - return 1 -*/ + //Hadoooooken! if(prob(spattack_prob) && (distance >= spattack_min_range) && (distance <= spattack_max_range)) ai_log("AttackTarget() special",3) @@ -1296,7 +1293,7 @@ ai_log("MoveAndShoot() vs. [target_mob]",1) var/distance = get_dist(src, target_mob) face_atom(target_mob) - if(move_shoot == 1 && distance <= shoot_range && distance >= 2 && ranged_cooldown <= world.time) + if(distance <= shoot_range && distance >= 2 && ranged_cooldown <= world.time) ai_log("MoveAndShoot() moving and shooting",3) ShootTarget(target_mob)