Fix missing file causing turret errors
This commit is contained in:
parent
463c1ace11
commit
5613e075e7
1 changed files with 27 additions and 0 deletions
27
gamemodes/zombiesurvival/gamemode/sh_channel.lua
Normal file
27
gamemodes/zombiesurvival/gamemode/sh_channel.lua
Normal file
|
@ -0,0 +1,27 @@
|
|||
GM.MaxChannels = {}
|
||||
GM.MaxChannels["prop_gunturret"] = 7
|
||||
|
||||
function GM:GetFreeChannel(class)
|
||||
local max = self.MaxChannels[class]
|
||||
if not max then return 1 end
|
||||
|
||||
local taken_channels = {}
|
||||
|
||||
for _, ent in pairs(ents.FindByClass(class)) do
|
||||
if ent:IsValid() and ent.GetChannel then
|
||||
taken_channels[ent:GetChannel()] = true
|
||||
end
|
||||
end
|
||||
|
||||
for i=1, max do
|
||||
if not taken_channels[i] then
|
||||
return i
|
||||
end
|
||||
end
|
||||
|
||||
return -1
|
||||
end
|
||||
|
||||
function GM:HasFreeChannel(class)
|
||||
return self:GetFreeChannel(class) >= 1
|
||||
end
|
Loading…
Reference in a new issue