bd937c290e
Players are no longer implicitly zombies if they're not humans. Players are no longer implicitly humans if they're not zombies. This is preparation for a third, optional spectator team. A few small optimizations and fixes.
27 lines
722 B
Lua
27 lines
722 B
Lua
AddCSLuaFile("shared.lua")
|
|
|
|
include("shared.lua")
|
|
|
|
function ENT:Think()
|
|
local owner = self:GetOwner()
|
|
if not owner:IsValid() or not owner:Alive() then return end
|
|
|
|
if owner:Team() ~= TEAM_HUMAN then self:Remove() return end
|
|
|
|
if self:IsUnderwater() then
|
|
if owner:WaterLevel() < 3 and not (owner.NoAirBrush and owner.NoAirBrush:IsValid()) then
|
|
self:SetUnderwater(false)
|
|
end
|
|
elseif owner:WaterLevel() >= 3 or owner.NoAirBrush and owner.NoAirBrush:IsValid() then
|
|
self:SetUnderwater(true)
|
|
end
|
|
|
|
if self:IsDrowning() then
|
|
owner:TakeSpecialDamage(10, DMG_DROWN, game.GetWorld())
|
|
|
|
self:NextThink(CurTime() + 1)
|
|
return true
|
|
elseif not self:IsUnderwater() and self:GetDrown() == 0 then
|
|
self:Remove()
|
|
end
|
|
end
|