Fixes the juggernaut reflect and refactors the reflect to be a proc instead of copy pasta

This commit is contained in:
joep van der velden
2019-12-12 17:25:15 +01:00
parent 1029bf7e7a
commit f005908970
4 changed files with 20 additions and 39 deletions
+15
View File
@@ -302,6 +302,21 @@
Range()
sleep(1)
obj/item/projectile/proc/reflect_back(atom/source, list/position_modifiers = list(0, 0, 0, 0, 0, -1, 1, -2, 2))
if(starting)
var/new_x = starting.x + pick(position_modifiers)
var/new_y = starting.y + pick(position_modifiers)
var/turf/curloc = get_turf(source)
// redirect the projectile
firer = source
original = locate(new_x, new_y, z)
starting = curloc
current = curloc
yo = new_y - curloc.y
xo = new_x - curloc.x
Angle = null // Will be calculated in fire()
obj/item/projectile/Crossed(atom/movable/AM, oldloc) //A mob moving on a tile with a projectile is hit by it.
..()
if(isliving(AM) && AM.density && !checkpass(PASSMOB))