diff options
| author | Alexander Pickering <Alexander.Pickering@anondomain.site90.net> | 2016-01-10 21:10:03 -0500 |
|---|---|---|
| committer | Alexander Pickering <Alexander.Pickering@anondomain.site90.net> | 2016-01-10 21:10:03 -0500 |
| commit | 31641879af7d32f1570b59bb5d27a193ed0931c3 (patch) | |
| tree | 65799bc24214382c26ee212b460a6b84ace5b8e9 /gamemode/npcsystem/npcs/antlion1.lua | |
| parent | 312f321f771960872fb3ee3e1bb24ebaf91aa38f (diff) | |
| download | wintersurvival2-31641879af7d32f1570b59bb5d27a193ed0931c3.tar.gz wintersurvival2-31641879af7d32f1570b59bb5d27a193ed0931c3.tar.bz2 wintersurvival2-31641879af7d32f1570b59bb5d27a193ed0931c3.zip | |
Fixed npc's breaking when they don't have an initial target
Diffstat (limited to 'gamemode/npcsystem/npcs/antlion1.lua')
| -rw-r--r-- | gamemode/npcsystem/npcs/antlion1.lua | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gamemode/npcsystem/npcs/antlion1.lua b/gamemode/npcsystem/npcs/antlion1.lua index 0e62a92..502ebc6 100644 --- a/gamemode/npcsystem/npcs/antlion1.lua +++ b/gamemode/npcsystem/npcs/antlion1.lua @@ -87,7 +87,10 @@ 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() + if not plypos then return 0 end + local dist = plypos:Distance(mypos)s return self.Stats["AwareDist"] - dist end |
