I'm working on some SEnts for a gamemode, and until this point, they were working fine.
Keep in mind, all of this is server side, and yes, functions are separated in 'if SERVER' if it's not shared.
As a brush, I have Think running to determine if there are player Ents within the collision bounds.
But I've now realized that I need to network this SEnt. When I change it's type to anim, Think is still running, but it will not recognize a player entity.
With PrintTable, it spits out the ladder ents and itself, but nothing else.
What am I missing here?
Gist-of-it sample code:
Works fine:
[CODE]
ENT.Type = "brush"
ENT.Base = "base_entity"
function ENT:Initialize()
self:SetTrigger(true)
end
function ENT.Think()
for _, eia in pairs(ents.FindInBox(self:GetModelBounds())) do
if eia:GetClass() == "player" and eia:Alive() then
--Stuff handling players in area
end
end
end
[/CODE]
Partially works, but not in the ways I need it to:
[CODE]
AddCSLuaFile()
ENT.Type = "anim"
ENT.Base = "base_entity"
function ENT:Initialize()
if SERVER then self:SetTrigger(true) end
end
function ENT.Think()
for _, eia in pairs(ents.FindInBox(self:GetModelBounds())) do
if eia:GetClass() == "player" and eia:Alive() then
--Stuff handling players in area
end
end
end
[/CODE]
try replacing eia:GetClass() if eia:IsPlayer()
[QUOTE=whitestar;48487573]try replacing eia:GetClass() if eia:IsPlayer()[/QUOTE]
Nope. I've run [CODE]ents.FindInBox(self:GetModelBounds())[/CODE] (with 'self' replaced with the proper reference) in console and it doesn't recognize a player entity as being present.
I've even tried GetCollisionBounds to see if anything changed, but it didn't.
Alright, so I gave up trying to have the entity handle everything on it's own.
I just have the brush update it's own data, then the server polls it and networks it to the client.
A bit more code, but at least everything works now.
Thanks whitestar for replying.
Sorry, you need to Log In to post a reply to this thread.