Projectile accuracy tweak (#21225)

* If we hit target we didnt aim at, there is no accuracy

* 1 tile 100% accuracy

* sniper projectiles always accurate
This commit is contained in:
HMBGERDO
2023-07-05 20:46:49 +02:00
committed by GitHub
parent 429fa97512
commit d403c7273f
3 changed files with 9 additions and 2 deletions
@@ -195,6 +195,7 @@
damage = 10
speed = 0.75
impact_effect_type = /obj/effect/temp_visual/impact_effect/purple_laser
forced_accuracy = TRUE
var/can_knockdown = TRUE
/obj/item/projectile/beam/laser/sniper/Range()
@@ -58,6 +58,7 @@
damage = 70
weaken = 10 SECONDS
armour_penetration_flat = 70
forced_accuracy = TRUE
/obj/item/ammo_box/magazine/sniper_rounds/antimatter
name = "sniper rounds (Antimatter)"
+7 -2
View File
@@ -55,7 +55,7 @@
var/stamina = 0
var/jitter = 0
/// Number of times an object can pass through an object. -1 is infinite
var/forcedodge = 0
var/forcedodge = 0
var/dismemberment = 0 //The higher the number, the greater the bonus to dismembering. 0 will not dismember at all.
var/impact_effect_type //what type of impact effect to show when hitting something
var/ricochets = 0
@@ -78,6 +78,7 @@
/// Does this projectile do extra damage to / break shields?
var/shield_buster = FALSE
var/forced_accuracy = FALSE
/obj/item/projectile/New()
return ..()
@@ -212,7 +213,11 @@
return 0
var/distance = get_dist(get_turf(A), starting) // Get the distance between the turf shot from and the mob we hit and use that for the calculations.
def_zone = ran_zone(def_zone, max(100-(7*distance), 5)) //Lower accurancy/longer range tradeoff. 7 is a balanced number to use.
if(!forced_accuracy)
if(get_dist(A, original) <= 1)
def_zone = ran_zone(def_zone, max(100 - (7 * distance), 5)) //Lower accurancy/longer range tradeoff. 7 is a balanced number to use.
else
def_zone = pick(list("head", "chest", "l_arm", "r_arm", "l_leg", "r_leg")) // If we were aiming at one target but another one got hit, no accuracy is applied
if(isturf(A) && hitsound_wall)
var/volume = clamp(vol_by_damage() + 20, 0, 100)