Update lua files
This commit is contained in:
@@ -1,28 +1,8 @@
|
|||||||
--if game.SinglePlayer() or CLIENT then return end
|
RefoselBots = {}
|
||||||
|
RefoselBots.NoNavMesh = {}
|
||||||
|
RefoselBots.Models = {}
|
||||||
|
|
||||||
LeadBot = {}
|
RefoselBots.Prefix = ""
|
||||||
LeadBot.NoNavMesh = {}
|
|
||||||
LeadBot.Models = {} -- Models, leave as {} if random is desired
|
|
||||||
|
|
||||||
--[[-----
|
|
||||||
|
|
||||||
CONFIG START CONFIG START
|
|
||||||
CONFIG START CONFIG START
|
|
||||||
CONFIG START CONFIG START
|
|
||||||
|
|
||||||
--]]-----
|
|
||||||
|
|
||||||
-- Name Prefix
|
|
||||||
|
|
||||||
LeadBot.Prefix = ""
|
|
||||||
|
|
||||||
--[[-----
|
|
||||||
|
|
||||||
CONFIG END CONFIG END
|
|
||||||
CONFIG END CONFIG END
|
|
||||||
CONFIG END CONFIG END
|
|
||||||
|
|
||||||
--]]-----
|
|
||||||
|
|
||||||
include("refoselbots/base.lua")
|
include("refoselbots/base.lua")
|
||||||
|
|
||||||
@@ -56,4 +36,4 @@ if file.Find("refoselbots/gamemodes/" .. map .. ".lua", "LUA")[1] then
|
|||||||
include("refoselbots/gamemodes/" .. map .. ".lua")
|
include("refoselbots/gamemodes/" .. map .. ".lua")
|
||||||
elseif file.Find("refoselbots/gamemodes/" .. gamemode .. ".lua", "LUA")[1] then
|
elseif file.Find("refoselbots/gamemodes/" .. gamemode .. ".lua", "LUA")[1] then
|
||||||
include("refoselbots/gamemodes/" .. gamemode .. ".lua")
|
include("refoselbots/gamemodes/" .. gamemode .. ".lua")
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -79,11 +79,10 @@ end
|
|||||||
|
|
||||||
function ENT:InFOV(pos, fov)
|
function ENT:InFOV(pos, fov)
|
||||||
local owner = self:GetOwner()
|
local owner = self:GetOwner()
|
||||||
|
|
||||||
|
if not IsValid(owner) then return false end
|
||||||
|
|
||||||
if IsEntity(pos) then
|
if IsEntity(pos) then
|
||||||
-- we must check eyepos and worldspacecenter
|
|
||||||
-- maybe in the future add more points
|
|
||||||
|
|
||||||
if PointWithinViewAngle(owner:EyePos(), pos:WorldSpaceCenter(), owner:GetAimVector(), fov) then
|
if PointWithinViewAngle(owner:EyePos(), pos:WorldSpaceCenter(), owner:GetAimVector(), fov) then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@@ -95,22 +94,19 @@ function ENT:InFOV(pos, fov)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function ENT:CanSee(ply, fov)
|
function ENT:CanSee(ply, fov)
|
||||||
|
local owner = self:GetOwner()
|
||||||
|
if not IsValid(owner) then return false end
|
||||||
|
|
||||||
if ply:GetPos():DistToSqr(self:GetPos()) > self:GetMaxVisionRange() * self:GetMaxVisionRange() then
|
if ply:GetPos():DistToSqr(self:GetPos()) > self:GetMaxVisionRange() * self:GetMaxVisionRange() then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
-- TODO: check fog farz and compare with distance
|
|
||||||
|
|
||||||
-- half fov or something
|
|
||||||
-- probably should move this to a variable
|
|
||||||
fov = fov or true
|
fov = fov or true
|
||||||
|
|
||||||
if fov and !self:InFOV(ply, math.cos(0.5 * (self:GetFOV() or 90) * math.pi / 180)) then
|
if fov and !self:InFOV(ply, math.cos(0.5 * (self:GetFOV() or 90) * math.pi / 180)) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
-- TODO: we really should check worldspacecenter too
|
|
||||||
local owner = self:GetOwner()
|
|
||||||
return util.QuickTrace(owner:EyePos(), ply:EyePos() - owner:EyePos(), {owner, self}).Entity == ply
|
return util.QuickTrace(owner:EyePos(), ply:EyePos() - owner:EyePos(), {owner, self}).Entity == ply
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,30 @@
|
|||||||
LeadBot.RespawnAllowed = true
|
RefoselBots.RespawnAllowed = true
|
||||||
LeadBot.SetModel = false
|
RefoselBots.SetModel = false
|
||||||
LeadBot.Gamemode = "cod_custom"
|
RefoselBots.Gamemode = "cod_custom"
|
||||||
LeadBot.TeamPlay = true
|
RefoselBots.TeamPlay = true
|
||||||
LeadBot.LerpAim = true
|
RefoselBots.LerpAim = true
|
||||||
LeadBot.NoFlashlight = true
|
RefoselBots.NoFlashlight = true
|
||||||
|
|
||||||
|
function RefoselBots.PlayerSpawn(bot)
|
||||||
|
timer.Simple(0.1, function()
|
||||||
|
if not IsValid(bot) then return end
|
||||||
|
|
||||||
|
local t1, t2 = 0, 0
|
||||||
|
|
||||||
|
for _, ply in ipairs(player.GetAll()) do
|
||||||
|
if ply ~= bot and ply:Team() then
|
||||||
|
if ply:Team() == 1 then t1 = t1 + 1
|
||||||
|
elseif ply:Team() == 2 then t2 = t2 + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if t1 <= t2 then
|
||||||
|
bot:SetTeam(1)
|
||||||
|
else
|
||||||
|
bot:SetTeam(2)
|
||||||
|
end
|
||||||
|
|
||||||
|
bot:ResetParametrsCOD()
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user