From bc4b0dbf3c305c42a6c0fa5bda492b8a786353a8 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Sat, 25 Jun 2016 18:18:21 -0400 Subject: Fixed client-side error on scientist npc's --- entities/entities/npc_nb_base/shared.lua | 42 ++++++++++++++++++++++-- entities/entities/npc_scientist/shared.lua | 2 +- entities/weapons/rad_itemplacer/shared.lua | 20 ++++++++++-- gamemode/cl_init.lua | 52 +++++++++++++++--------------- 4 files changed, 85 insertions(+), 31 deletions(-) diff --git a/entities/entities/npc_nb_base/shared.lua b/entities/entities/npc_nb_base/shared.lua index 5be63a5..2e5aeeb 100644 --- a/entities/entities/npc_nb_base/shared.lua +++ b/entities/entities/npc_nb_base/shared.lua @@ -35,7 +35,7 @@ Sound( "npc/zombie/claw_miss2.wav" ) } ENT.VoiceSounds = {} ENT.NextBot = true -ENT.ShouldDrawPath = false +ENT.ShouldDrawPath = true ENT.Obstructed = false ENT.FireDamageTime = 0 ENT.FireTime = 0 @@ -64,12 +64,19 @@ function ENT:Initialize() self.loco:SetDeathDropHeight( 1000 ) self.loco:SetAcceleration( 500 ) self.loco:SetJumpHeight( self.JumpHeight ) + print(self.loco) + --[[ + self.loco.Jump = function() + print("I want to jump!") + end + ]] end self.DmgTable = {} self.LastPos = self.Entity:GetPos() self.Stuck = CurTime() + 1 + end function ENT:Think() @@ -899,9 +906,36 @@ function ENT:EnemyRoutine() end end +--[[ +function ENT:BehaveUpdate(interval) + if(self.timerThink == nil) then + self.timerThink = 0 + self.path = Path("Chase") + print("Path is ") + print(self.path) + end + if(self.timerThink < CurTime()) then + self.timerThink = CurTime(1)+1 + self.path:Compute(self,Entity(1):GetPos()) -function ENT:RunBehaviour() + end + local segment = self.path:GetCurrentGoal() + if(segment.type == 2) then + local tp = self:GetPos() + local fp = self:GetForward()*20 + --If we can climb over this obstical, do that + self:SetPos(tp+Vector(0,0,50)+(fp/19)) + self:PlaySequenceAndWait("pickup") + self:SetPos(tp+fp+Vector(0,0,50)) + end + self.path:Update(self) + self.path:Draw() + --print("BehaveUpdate:" .. interval) +end +]] +function ENT:RunBehaviour() + print("RunBehaviour fired") while true do self.Entity:StartActivity( self.MoveAnim ) @@ -955,6 +989,10 @@ function ENT:RunBehaviour() end + if(self.path) then + print("Got a path!") + end + coroutine.yield() end diff --git a/entities/entities/npc_scientist/shared.lua b/entities/entities/npc_scientist/shared.lua index d9d76dd..44f20b2 100644 --- a/entities/entities/npc_scientist/shared.lua +++ b/entities/entities/npc_scientist/shared.lua @@ -159,7 +159,7 @@ function ENT:StuckThink() end function ENT:Respawn() - + if GAMEMODE.NPCSpawns == nil then return end for k,v in pairs( GAMEMODE.NPCSpawns ) do if IsValid( v ) then diff --git a/entities/weapons/rad_itemplacer/shared.lua b/entities/weapons/rad_itemplacer/shared.lua index 6ae189d..801092a 100644 --- a/entities/weapons/rad_itemplacer/shared.lua +++ b/entities/weapons/rad_itemplacer/shared.lua @@ -57,14 +57,30 @@ SWEP.ItemTypes = { "info_player_zombie", "info_lootspawn", "info_npcspawn", "info_evac", -"point_radiation" } +"point_radiation", +"rad_incendiarygrenade", +"rad_grenade", +"rad_revolver", +"sent_c4", +"sent_fuel_diesel", +"sent_fuel_gas", +"sent_propane_canister", +"sent_propane_tank", } SWEP.ServersideItems = { "info_player_zombie", "info_player_army", "info_lootspawn", "info_npcspawn", "info_evac", -"point_radiation" } +"point_radiation", +"rad_incendiarygrenade", +"rad_grenade", +"rad_revolver", +"sent_c4", +"sent_fuel_diesel", +"sent_fuel_gas", +"sent_propane_canister", +"sent_propane_tank", } SWEP.SharedItems = {} diff --git a/gamemode/cl_init.lua b/gamemode/cl_init.lua index 1933025..0a6b5d5 100644 --- a/gamemode/cl_init.lua +++ b/gamemode/cl_init.lua @@ -66,10 +66,10 @@ function GM:Initialize() surface.CreateFont ( "AmmoFontSmall", { size = 12, weight = 300, antialias = true, additive = true, font = "Verdana" } ) surface.CreateFont ( "TargetIDFont", { size = 12, weight = 200, antialias = true, additive = true, font = "Verdana" } ) - //matRadar = Material( "radbox/radar" ) - //matArm = Material( "radbox/radar_arm" ) - //matArrow = Material( "radbox/radar_arrow" ) - //matNoise = Material( "radbox/nvg_noise" ) + --matRadar = Material( "radbox/radar" ) + --matArm = Material( "radbox/radar_arm" ) + --matArrow = Material( "radbox/radar_arrow" ) + --matNoise = Material( "radbox/nvg_noise" ) matHealth = Material( "radbox/img_health" ) matStamina = Material( "radbox/img_stamina" ) @@ -95,7 +95,7 @@ function GM:GetHelpHTML() end -// Help menu - comment this out later? +-- Help menu - comment this out later? function GM:ShowHelp() if IsValid( self.HelpFrame ) then return end @@ -156,7 +156,7 @@ function GM:Think() GAMEMODE:FadeRagdolls() GAMEMODE:GoreRagdolls() GAMEMODE:HUDTraces() - //GAMEMODE:SpawnRagdolls() + --GAMEMODE:SpawnRagdolls() if GetGlobalBool( "GameOver", false ) and not EndScreenShown then @@ -172,7 +172,7 @@ function GM:Think() StartMenuShown = true GAMEMODE:ShowClasses() - //player_manager.SetPlayerClass( LocalPlayer(), "player_base" ) + --player_manager.SetPlayerClass( LocalPlayer(), "player_base" ) end @@ -184,7 +184,7 @@ function GM:Think() end - if LocalPlayer():Team() != TEAM_ARMY then return end + if LocalPlayer():Team() ~= TEAM_ARMY then return end if LocalPlayer():Alive() and HeartBeat < CurTime() and ( LocalPlayer():GetNWBool( "Bleeding", false ) or LocalPlayer():Health() < 50 ) then @@ -237,7 +237,7 @@ function GM:Think() local close = math.sqrt( diff.x * diff.x + diff.y * diff.y ) < MaxDist * FadeDist - if ( !v:IsPlayer() or ( v:Alive() and ( v != LocalPlayer() and ( v:Team() == LocalPlayer():Team() or close ) ) ) ) and !IsOnRadar( v ) and ( dot > 0.99 or close ) then + if ( notv:IsPlayer() or ( v:Alive() and ( v ~= LocalPlayer() and ( v:Team() == LocalPlayer():Team() or close ) ) ) ) and notIsOnRadar( v ) and ( dot > 0.99 or close ) then local pos = v:GetPos() local color = Color( 0, 255, 0 ) @@ -264,7 +264,7 @@ function GM:Think() end - elseif v:IsPlayer() and v:Team() != LocalPlayer():Team() then + elseif v:IsPlayer() and v:Team() ~= LocalPlayer():Team() then color = Color( 255, 80, 80 ) @@ -292,19 +292,19 @@ function GM:FadeRagdolls() if v.Time and v.Time < CurTime() then - //v:SetColor( Color( 255, 255, 255, v.Alpha ) ) - //v.Alpha = math.Approach( v.Alpha, 0, -2 ) + --v:SetColor( Color( 255, 255, 255, v.Alpha ) ) + --v.Alpha = math.Approach( v.Alpha, 0, -2 ) - //if v.Alpha <= 0 then - //v:Remove() - //end + --if v.Alpha <= 0 then + --v:Remove() + --end v:Remove() elseif not v.Time then v.Time = CurTime() + 12 - //v.Alpha = 255 + --v.Alpha = 255 end @@ -758,7 +758,7 @@ function GM:HUDPaint() GAMEMODE:HUDDrawTargetID() - if not LocalPlayer():Alive() and LocalPlayer():Team() != TEAM_UNASSIGNED then + if not LocalPlayer():Alive() and LocalPlayer():Team() ~= TEAM_UNASSIGNED then DeathScreenScale = math.Approach( DeathScreenScale, 1, FrameTime() * 0.3 ) @@ -785,7 +785,7 @@ function GM:HUDPaint() end - if not LocalPlayer():Alive() or LocalPlayer():Team() == TEAM_UNASSIGNED then return end //or GAMEMODE:ElementsVisible() then return end + if not LocalPlayer():Alive() or LocalPlayer():Team() == TEAM_UNASSIGNED then return end --or GAMEMODE:ElementsVisible() then return end GAMEMODE:DrawMarkers() @@ -815,7 +815,7 @@ function GM:HUDPaint() local ylen = 55 local ypos = 35 - if IsValid( LocalPlayer():GetActiveWeapon() ) and ( LocalPlayer():GetActiveWeapon().AmmoType or "SMG" ) != "Knife" then + if IsValid( LocalPlayer():GetActiveWeapon() ) and ( LocalPlayer():GetActiveWeapon().AmmoType or "SMG" ) ~= "Knife" then local total = LocalPlayer():GetNWInt( "Ammo" .. ( LocalPlayer():GetActiveWeapon().AmmoType or "SMG" ), 0 ) local ammo = math.Clamp( LocalPlayer():GetActiveWeapon():Clip1(), 0, total ) @@ -859,7 +859,7 @@ function GM:HUDPaint() end - if v.DieTime != -1 then + if v.DieTime ~= -1 then alpha = 100 * ( math.Clamp( v.DieTime - CurTime(), 0, BlipTime ) / BlipTime ) @@ -871,7 +871,7 @@ function GM:HUDPaint() if math.sqrt( diff.x * diff.x + diff.y * diff.y ) > MaxDist * FadeDist and v.DieTime == -1 then - PosTable[k].DieTime = CurTime() + 1.5 // Remove the dot because they left our inner circle + PosTable[k].DieTime = CurTime() + 1.5 -- Remove the dot because they left our inner circle end @@ -893,7 +893,7 @@ function GM:HUDPaint() for k,v in pairs( PosTable ) do - if v.DieTime != -1 and v.DieTime < CurTime() then + if v.DieTime ~= -1 and v.DieTime < CurTime() then table.remove( PosTable, k ) @@ -907,7 +907,7 @@ function GM:HUDPaint() local ent = LocalPlayer():GetDTEntity( 0 ) - if IsValid( ent ) or StaticPos != Vector(0,0,0) then + if IsValid( ent ) or StaticPos ~= Vector(0,0,0) then local ang = Angle(0,0,0) @@ -925,7 +925,7 @@ function GM:HUDPaint() end - if StaticPos != Vector(0,0,0) then + if StaticPos ~= Vector(0,0,0) then ang = ( StaticPos - LocalPlayer():GetShootPos()):Angle() - LocalPlayer():GetForward():Angle() @@ -985,7 +985,7 @@ function GM:CreateMove( cmd ) local ang = cmd:GetViewAngles() - if ang.r != 0 then + if ang.r ~= 0 then ang.r = 0 cmd:SetViewAngles( ang ) @@ -1035,7 +1035,7 @@ function GM:CreateMove( cmd ) local ang = cmd:GetViewAngles() - if ViewWobble > 0 or ang.r != 0 then + if ViewWobble > 0 or ang.r ~= 0 then ang.p = ang.p + math.sin( CurTime() ) * ViewWobble ang.y = ang.y + math.cos( CurTime() ) * ViewWobble -- cgit v1.2.3-70-g09d2