aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Pickering <Alexander.Pickering@anondomain.site90.net>2016-01-10 20:04:06 -0500
committerAlexander Pickering <Alexander.Pickering@anondomain.site90.net>2016-01-10 20:04:06 -0500
commit09fe7cf5fac36063bae4501a6030327ec7bf2c22 (patch)
tree81e8d14943172f372ea6db6214d8ad7b18a7f401
parent397481c41dc2180edd40a06c9053d5c3df8b417f (diff)
downloadwintersurvival2-09fe7cf5fac36063bae4501a6030327ec7bf2c22.tar.gz
wintersurvival2-09fe7cf5fac36063bae4501a6030327ec7bf2c22.tar.bz2
wintersurvival2-09fe7cf5fac36063bae4501a6030327ec7bf2c22.zip
Fixed zombies sometimes bugging out if they don't have a target
-rw-r--r--gamemode/npcsystem/npcs/zombie.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/gamemode/npcsystem/npcs/zombie.lua b/gamemode/npcsystem/npcs/zombie.lua
index 5914c04..ce4105b 100644
--- a/gamemode/npcsystem/npcs/zombie.lua
+++ b/gamemode/npcsystem/npcs/zombie.lua
@@ -88,7 +88,9 @@ NPC.Attacks = {
--Attack priority is a fucntion that takes a player, and returns an int describing it's prority to attack (higher = more important) NPC will always attack the player with the highest priority
function NPC:AttackPriority(ply)
- local dist = ply:GetPos():Distance(self:GetPos())
+ local plypos = ply:GetPos()
+ local mypas = self:GetPos()
+ local dist = plypos:Distance(mypos)
return self.Stats["AwareDist"] - dist
end