From 5ed16717129121ebb9c7c1012d1ce17f2aa71bf7 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Wed, 30 Dec 2015 22:18:49 -0500 Subject: Fixed birds crashing with no nav meshes --- gamemode/npcsystem/npcs/bird.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'gamemode/npcsystem') diff --git a/gamemode/npcsystem/npcs/bird.lua b/gamemode/npcsystem/npcs/bird.lua index 0393532..fa3ad8d 100644 --- a/gamemode/npcsystem/npcs/bird.lua +++ b/gamemode/npcsystem/npcs/bird.lua @@ -58,7 +58,7 @@ function NPC:Behave() --Keep flying away as long as we're being chased while((dist < fardist and not iscrouched) or (dist < closedist)) do self:StartActivity(ACT_FLY) - self:SetSequence( "Fly01" ) + self:PlaySequenceAndWait( "Fly01" ) --Find a position in roughly the oposite direction of the player local tpos = self:GetPos() @@ -76,12 +76,16 @@ function NPC:Behave() end --]] local navarea = navmesh.GetNavArea(self:GetPos(), 100) + if navarea:IsValid() then + --print("Looks like nav area is valid") self:MoveToPos(topos) else + --print("Looks like nav area is invalid") self:BecomeRagdoll(DamageInfo()) end - -- + + --Check to see if we're being chased iscrouched = v:Crouching() -- cgit v1.2.3-70-g09d2