Merge pull request #5977 from Neerti/btw_i_use_fixed_arc

BTW I USE (FIXED) ARC
This commit is contained in:
Anewbe
2019-02-21 12:49:00 -06:00
committed by GitHub
4 changed files with 105 additions and 54 deletions
+25 -3
View File
@@ -127,9 +127,12 @@
// Otherwise default to the mob's firing sound.
playsound(src, P.fire_sound ? P.fire_sound : projectilesound, 80, 1)
P.firer = src // So we can't shoot ourselves.
P.old_style_target(A, src)
P.fire()
// For some reason there isn't an argument for accuracy, so access the projectile directly instead.
// Also, placing dispersion here instead of in forced_spread will randomize the chosen angle between dispersion and -dispersion in fire() instead of having to do that here.
P.accuracy += calculate_accuracy()
P.dispersion += calculate_dispersion()
P.launch_projectile(target = A, target_zone = null, user = src, params = null, angle_override = null, forced_spread = 0)
if(needs_reload)
reload_count++
@@ -149,6 +152,25 @@
. = FALSE
set_AI_busy(FALSE)
/mob/living/simple_mob/proc/calculate_dispersion()
. = projectile_dispersion // Start with the basic var.
// Some modifiers change dispersion. This makes simple_mobs respect that.
for(var/datum/modifier/M in modifiers)
if(!isnull(M.accuracy_dispersion))
. += M.accuracy_dispersion
// Make sure we don't go under zero dispersion.
. = max(., 0)
/mob/living/simple_mob/proc/calculate_accuracy()
. = projectile_accuracy // Start with the basic var.
// Some modifiers make it harder or easier to hit things.
for(var/datum/modifier/M in modifiers)
if(!isnull(M.accuracy))
. += M.accuracy
// Can we currently do a special attack?
/mob/living/simple_mob/proc/can_special_attack(atom/A)
// Validity check.
@@ -82,6 +82,8 @@
//Attack ranged settings
var/projectiletype // The projectiles I shoot
var/projectilesound // The sound I make when I do it
var/projectile_accuracy = 0 // Accuracy modifier to add onto the bullet when its fired.
var/projectile_dispersion = 0 // How many degrees to vary when I do it.
var/casingtype // What to make the hugely laggy casings pile out of
// Reloading settings, part of ranged code