aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Pickering <Alexander.Pickering@anondomain.site90.net>2016-01-10 19:54:32 -0500
committerAlexander Pickering <Alexander.Pickering@anondomain.site90.net>2016-01-10 19:54:32 -0500
commit096a5bff99727b45f69f4cf0263e4bdd32da8e1a (patch)
tree3e68d5ea04e2261e45f5433242b0c382eff645ec
parente1a30b7c0ce3797b4eb6750d53cae8476abf878b (diff)
downloadwintersurvival2-096a5bff99727b45f69f4cf0263e4bdd32da8e1a.tar.gz
wintersurvival2-096a5bff99727b45f69f4cf0263e4bdd32da8e1a.tar.bz2
wintersurvival2-096a5bff99727b45f69f4cf0263e4bdd32da8e1a.zip
Fixed NPC bounding box issue
-rw-r--r--entities/entities/ws_npc_ambient/init.lua6
-rw-r--r--entities/entities/ws_npc_ambient/shared.lua6
2 files changed, 9 insertions, 3 deletions
diff --git a/entities/entities/ws_npc_ambient/init.lua b/entities/entities/ws_npc_ambient/init.lua
index d169357..1f08884 100644
--- a/entities/entities/ws_npc_ambient/init.lua
+++ b/entities/entities/ws_npc_ambient/init.lua
@@ -7,11 +7,15 @@ include('shared.lua')
function ENT:Initialize()
--print("NPC spawned!")
--self:SetMoveType(MOVETYPE_STEP)
- self:SetSolid(SOLID_VPHYSICS)
+ self:SetSolid(SOLID_OBB)
--self:SetCollisionGroup(COLLISION_GROUP_INTERACTIVE)
if(self.Model) then self:SetModel(self.Model)
else print("NPC created without model, this might be a bug!") end
+ if(not self.Stats) then
+ print("NPC created without any stats, this is a bug!")
+ return
+ end
if(self.Stats["Vitality"]) then
self:SetHealth(self.Stats["Vitality"])
print("Helath set to " .. self.Stats["Vitality"])
diff --git a/entities/entities/ws_npc_ambient/shared.lua b/entities/entities/ws_npc_ambient/shared.lua
index d41558d..c14de1e 100644
--- a/entities/entities/ws_npc_ambient/shared.lua
+++ b/entities/entities/ws_npc_ambient/shared.lua
@@ -19,7 +19,7 @@ end
function ENT:DefaultBehaviour()
while ( true ) do
--Main loop for ai
-
+ print("Going into behavior for " .. self.Name)
--Update aware enemies
local players = ents.FindByClass("Player")
for k,v in pairs(players) do
@@ -49,6 +49,7 @@ function ENT:DefaultBehaviour()
local randanim = math.Round(math.Rand(0,#self.IdleSequences))
self:PlaySequenceAndWait( self.IdleSequences[randanim] )
self:StartActivity( ACT_IDLE )
+ print("Acting idle")
--If there's noone within 4000 units, just remove ourselves to save server resources
local closest = 5000
for k,v in pairs(player.GetAll()) do
@@ -57,7 +58,8 @@ function ENT:DefaultBehaviour()
closest = thisdist
end
end
- if(closest > 4000) then self:BecomeRagdoll(DamageInfo()) end
+ if(closest > 4000) then
+ print("Closes player is " .. closest .. " removeing self...") self:BecomeRagdoll(DamageInfo()) end
else
--We have a target to attack!