MY VOICE SUCKS EVEN FOR DEVVING

This commit is contained in:
Fesiug 2023-12-31 16:24:23 -05:00
parent 3e247aba0e
commit c0b0157797
1 changed files with 52 additions and 15 deletions

View File

@ -212,13 +212,13 @@ ENT.States = {
local rp = RecipientFilter() local rp = RecipientFilter()
rp:AddAllPlayers() rp:AddAllPlayers()
self:EmitSound("benny/weapons/usp/01.ogg", 100, 100, 0.2, nil, nil, nil, rp ) self:EmitSound("benny/weapons/usp/01.ogg", 100, 100, 0.2, nil, nil, nil, rp )
--self:FireBullets( { self:FireBullets( {
-- Attacker = self, Attacker = self,
-- Inflictor = self, Inflictor = self,
-- Damage = 0, Damage = 3,
-- Dir = self:EyeAngles():Forward(), Dir = self:EyeAngles():Forward(),
-- Src = self:EyePos() Src = self:EyePos()
--} ) } )
self.NextFire = CurTime() + 0.5 self.NextFire = CurTime() + 0.5
end end
else else
@ -227,13 +227,18 @@ ENT.States = {
local em = self.bEnemyMemory[re] local em = self.bEnemyMemory[re]
if em and em.GoToLastKnown and em.GoToLastKnown != true then if em and em.GoToLastKnown and em.GoToLastKnown != true then
local result = self:MoveToPos( em.GoToLastKnown, { lookahead = 100, tolerance = 32, draw = true, repath = 0.5 } ) local result = self:ChaseEnemy( { re = re, draw = true } )
--local result = self:MoveToPos( em.GoToLastKnown, { lookahead = 100, tolerance = 32, draw = true, repath = 0.5 } )
if result == "ok" then if result == "ok" then
em.GoToLastKnown = true em.GoToLastKnown = true
self:DebugChat("Went to last known position of " .. re:Nick()) self:DebugChat("Went to last known position of " .. re:Nick())
elseif result == "stuck" then elseif result == "stuck" then
em.GoToLastKnown = true em.GoToLastKnown = true
self:DebugChat("Failed to go to last known position of " .. re:Nick() .. " at " .. tostring(self:GetPos())) self:DebugChat("Failed to go to last known position of " .. re:Nick() .. " at " .. tostring(self:GetPos()))
elseif result == "cancelled" then
em.GoToLastKnown = false
self:DebugChat("Reengaging " .. re:Nick() .. "!!")
self:EmitSound( "benny/dev/reengaging.wav", 90, 100, 1 )
else else
em.GoToLastKnown = true em.GoToLastKnown = true
self:DebugChat("Unknown state " .. result .. " while going to " .. re:Nick() .. " at " .. tostring(self:GetPos())) self:DebugChat("Unknown state " .. result .. " while going to " .. re:Nick() .. " at " .. tostring(self:GetPos()))
@ -241,7 +246,7 @@ ENT.States = {
elseif em and em.GoToLastKnown == true then elseif em and em.GoToLastKnown == true then
self:DebugChat("Investigated " .. re:Nick() .. "'s last known position, it's clear." ) self:DebugChat("Investigated " .. re:Nick() .. "'s last known position, it's clear." )
self:SetState("idle") self:SetState("idle")
self:EmitSound( "benny/dev/lostem.ogg", 90, 100, 1 ) self:EmitSound( "benny/dev/at last point of interest.wav", 90, 100, 1 )
end end
end end
end end
@ -255,6 +260,38 @@ ENT.States = {
}, },
} }
function ENT:ChaseEnemy( options )
local options = options or {}
local path = Path( "Follow" )
path:SetMinLookAheadDistance( options.lookahead or 300 )
path:SetGoalTolerance( options.tolerance or 20 )
local em = self.bEnemyMemory[options.re]
if !em.GoToLastKnown then return "cancelled" end
if !isvector( em.GoToLastKnown ) then return "cancelled" end
path:Compute( self, em.GoToLastKnown ) -- Compute the path towards the enemy's position
if ( !path:IsValid() ) then return "failed" end
while ( path:IsValid() ) do
if !em.GoToLastKnown then return "cancelled" end
if !isvector( em.GoToLastKnown ) then return "cancelled" end
if ( path:GetAge() > 0.1 ) then -- Since we are following the player we have to constantly remake the path
path:Compute(self, em.GoToLastKnown )-- Compute the path towards the enemy's position again
end
path:Update( self ) -- This function moves the bot along the path
if ( options.draw ) then path:Draw() end
-- If we're stuck then call the HandleStuck function and abandon
if ( self.loco:IsStuck() ) then
self:HandleStuck()
return "stuck"
end
coroutine.yield()
end
return "ok"
end
function ENT:BodyUpdate() function ENT:BodyUpdate()
local target = self:RecentEnemy() local target = self:RecentEnemy()
if target then if target then
@ -284,17 +321,17 @@ function ENT:OnEntitySight( ent )
else else
if self.bEnemyMemory[ent] then if self.bEnemyMemory[ent] then
local em = self.bEnemyMemory[ent] local em = self.bEnemyMemory[ent]
if CurTime()-em.LastSeenTime > 3 then if CurTime()-em.LastSeenTime > 5 then
self:DebugChat( "Been a while " .. ent:Nick() .. "!! " .. string.NiceTime(CurTime()-em.LastSeenTime), Color( 255, 200, 100 ) ) self:DebugChat( "Been a while " .. ent:Nick() .. "!! " .. string.NiceTime(CurTime()-em.LastSeenTime), Color( 255, 200, 100 ) )
self.NextFire = CurTime() + 0.5 self.NextFire = CurTime() + 0.5
self:EmitSound( "benny/dev/therehis.ogg", 90, 100, 1 ) self:EmitSound( "benny/dev/there he is.wav", 90, 100, 1 )
else else
self:DebugChat( "Resighted " .. ent:Nick() .. "! " .. string.NiceTime(CurTime()-em.LastSeenTime), Color( 255, 200, 100 ) ) self:DebugChat( "Resighted " .. ent:Nick() .. "! " .. string.NiceTime(CurTime()-em.LastSeenTime), Color( 255, 200, 100 ) )
self.NextFire = CurTime() + 0.25 self.NextFire = CurTime() + 0.25
end end
else else
self:DebugChat( "New target " .. ent:Nick() .. "!!", Color( 255, 200, 100 ) ) self:DebugChat( "New target " .. ent:Nick() .. "!!", Color( 255, 200, 100 ) )
self:EmitSound( "benny/dev/target.ogg", 90, 100, 1 ) self:EmitSound( "benny/dev/new target.wav", 90, 100, 1 )
end end
self:SetState("combat") self:SetState("combat")
end end
@ -376,7 +413,7 @@ function ENT:Think()
if ent.BennyNPC then if ent.BennyNPC then
if !self.Team and !ent.Team and self.Rank >= ent.Rank then if !self.Team and !ent.Team and self.Rank >= ent.Rank then
self:DebugChat( "Duoing with " .. ent:Nick() ) self:DebugChat( "Duoing with " .. ent:Nick() )
self:EmitSound( "benny/dev/yourewithme.ogg", 90, 100, 1 ) self:EmitSound( "benny/dev/stick with me.wav", 90, 100, 1 )
self.Team = "ALPHA_Duo_1" self.Team = "ALPHA_Duo_1"
ent.Team = "ALPHA_Duo_1" ent.Team = "ALPHA_Duo_1"
end end
@ -390,10 +427,10 @@ function ENT:Think()
self.bEnemyMemory[ent] = nil self.bEnemyMemory[ent] = nil
continue continue
end end
if self.Faction != ent.Faction and !data.GoToLastKnown and data.LastSeenTime+5 < CurTime() then if self.Faction != ent.Faction and !data.GoToLastKnown and data.LastSeenTime + 2 < CurTime() then
data.GoToLastKnown = Vector(data.LastPos) data.GoToLastKnown = Vector(data.LastPos)
self:DebugChat( "Investigating " .. ent:Nick() .. "'s last known position" ) self:DebugChat( "Investigating " .. ent:Nick() .. "'s last known position" )
self:EmitSound( "benny/dev/immoving.ogg", 90, 100, 1 ) self:EmitSound( "benny/dev/moving.wav", 90, 100, 1 )
--self:SetState("idle") --self:SetState("idle")
end end
end end