Turrets now aim at the chest/groin unless the target has a neck grab on someone, otherwise they aim elsewhere.
Projectiles are now able to miss targets that are lying or buckled, except when the target is at point blank range and is the original target for the projectile.
This commit is contained in:
mwerezak
2015-07-27 17:45:27 -04:00
parent c0d23536e2
commit d203362d38
4 changed files with 22 additions and 5 deletions

View File

@@ -624,6 +624,14 @@ var/list/turret_icons
// Emagged turrets again use twice as much power due to higher firing rates
use_power(reqpower * (2 * (emagged || lethal)) * (2 * emagged))
//Turrets aim for the center of mass by default.
//If the target is grabbing someone then the turret smartly aims for extremities
var/obj/item/weapon/grab/G = locate() in target
if(G && G.state >= GRAB_NECK) //works because mobs are currently not allowed to upgrade to NECK if they are grabbing two people.
A.def_zone = pick("head", "l_hand", "r_hand", "l_foot", "r_foot", "l_arm", "r_arm", "l_leg", "r_leg")
else
A.def_zone = pick("chest", "groin")
//Shooting Code:
A.current = T
A.starting = T

View File

@@ -266,6 +266,15 @@
else
A = new /obj/item/projectile/energy/electrode( loc )
use_power(200)
//Turrets aim for the center of mass by default.
//If the target is grabbing someone then the turret smartly aims for extremities
var/obj/item/weapon/grab/G = locate() in target
if(G && G.state >= GRAB_NECK) //works because mobs are currently not allowed to upgrade to NECK if they are grabbing two people.
A.def_zone = pick("head", "l_hand", "r_hand", "l_foot", "r_foot", "l_arm", "r_arm", "l_leg", "r_leg")
else
A.def_zone = pick("chest", "groin")
A.current = T
A.starting = T
A.yo = U.y - T.y

View File

@@ -264,11 +264,11 @@ var/list/global/organ_rel_size = list(
/proc/get_zone_with_miss_chance(zone, var/mob/target, var/miss_chance_mod = 0, var/ranged_attack=0)
zone = check_zone(zone)
if(!ranged_attack)
// you cannot miss if your target is prone or restrained
if(target.buckled || target.lying)
return zone
// if your target is being grabbed aggressively by someone you cannot miss either
if(!ranged_attack)
for(var/obj/item/weapon/grab/G in target.grabbed_by)
if(G.state >= GRAB_AGGRESSIVE)
return zone

View File

@@ -165,7 +165,7 @@
//roll to-hit
miss_modifier = max(15*(distance-2) - round(15*accuracy) + miss_modifier, 0)
var/hit_zone = get_zone_with_miss_chance(def_zone, target_mob, miss_modifier, ranged_attack=(distance > 1))
var/hit_zone = get_zone_with_miss_chance(def_zone, target_mob, miss_modifier, ranged_attack=(distance > 1 || original != target_mob)) //if the projectile hits a target we weren't originally aiming at then retain the chance to miss
if(!hit_zone)
visible_message("<span class='notice'>\The [src] misses [target_mob] narrowly!</span>")
return 0