Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AddCSLuaFile("cl_init.lua")
- AddCSLuaFile("shared.lua")
- include("shared.lua")
- ENT.foundLiving = false
- function ENT:spawnEnemy(npclevel)
- self:SetNWInt("Wave", GAMEMODE.CurrentWave);
- local spawnedNPC = ents.Create(self:levelToNPC(npclevel)) // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
- if not IsValid(spawnedNPC) then return end
- spawnedNPC:SetPos(self:grabSpawnPosition())
- spawnedNPC:Spawn()
- spawnedNPC:Activate()
- //local c = spawnedNPC:GetClass(c)
- // all the noise below just sets the entity to attack and hate players, and be nice to other npcs
- for l,entt in pairs(ents.GetAll()) do
- if entt:IsPlayer() then
- spawnedNPC:AddEntityRelationship( entt, D_HT, 50 )
- end
- if entt:IsNPC() then
- spawnedNPC:AddEntityRelationship(entt,D_LI,99)
- entt:AddEntityRelationship(spawnedNPC,D_LI,99)
- end // lua_run for k,v in pairs(player.GetAll()[1]:GetEyeTrace().Entity:GetTable()) do print(" " ..k) print(v) end
- end
- //local capas = { CAP_MOVE_GROUND , CAP_OPEN_DOORS , CAP_ANIMATEDFACE , CAP_TURN_HEAD , CAP_USE_SHOT_REGULATOR , CAP_AIM_GUN , CAP_MOVE_JUMP , CAP_MOVE_CLIMB, CAP_USE_WEAPONS }
- local p = FindNearestPlayer(self) || player.GetAll()[1]
- local ppos = p:GetPos()
- spawnedNPC:SetLastPosition(ppos)
- spawnedNPC:SetEnemy(p)
- spawnedNPC:UpdateEnemyMemory( p, ppos )
- spawnedNPC:SetSchedule( SCHED_CHASE_ENEMY )
- spawnedNPC:SetOwner(game.GetWorld())
- spawnedNPC.IsEnemy = true
- spawnedNPC:SetNWInt("IsEnemy",1)
- //net.Start( "sendenemy" )
- // net.WriteEntity(spawnedNPC:GetID())
- //net.Broadcast()
- end
- util.AddNetworkString("sendPurgeTime")
- util.AddNetworkString("sendTimeBetweenPurge")
- net.Receive("sendPurgeTime", function()
- if timer.Exists("purgetime") then
- net.Start("sendPurgeTime")
- net.WriteString(tostring(timer.TimeLeft("purgetime")))
- net.Broadcast()
- end
- if !timer.Exists("time_between_purge") and !timer.Exists("purgetime") then
- timer.Create("time_between_purge", 1350, 1, betweenPurgeTimer)
- net.Start("sendTimeBetweenPurge")
- net.WriteString(tostring(timer.TimeLeft("time_between_purge")))
- net.Broadcast()
- end
- end)
- net.Receive("sendTimeBetweenPurge",function()
- if timer.Exists("time_between_purge") then
- net.Start("sendTimeBetweenPurge")
- net.WriteString(tostring(timer.TimeLeft("time_between_purge")))
- net.Broadcast()
- end
- if !timer.Exists("time_between_purge") and !timer.Exists("purgetime") then
- timer.Create("time_between_purge", 1350, 1, betweenPurgeTimer)
- net.Start("sendTimeBetweenPurge")
- net.WriteString(tostring(timer.TimeLeft("time_between_purge")))
- net.Broadcast()
- end
- end)
- //ragdoll check
- checked_Ragdolls_Last = 0
- function checkRagdolls()
- /*if CurTime()-checked_Ragdolls_Last < 15 then return end
- checked_Ragdolls_Last = CurTime()
- for k,v in pairs(ents.GetAll()) do
- if v:GetClass()=="prop_ragdoll" then
- v:Remove()
- end
- end*/
- end
- hook.Add("Think","ragdollcheckthink",function() checkRagdolls() end)
- /* moved to shared
- function InitializeXP()
- timer.Simple(5, function()
- for k,v in pairs(player.GetAll()) do
- if v.MonstersXP and v.MonstersLevels and net.Send then
- net.Start( "update_experience" )
- net.WriteString(tostring(v.MonstersXP))
- for k,v in pairs(v.MonstersLevels) do
- net.WriteString(tostring(v))
- end
- net.Send(v)
- end
- end
- end)
- end
- hook.Add("InitPostEntity", "initxp" , InitializeXP)
- */
- function RemoveDeadRag( ent )
- if (ent:GetClass() == "class C_ClientRagdoll") then
- if ent:IsValid() and !(ent == NULL) then
- SafeRemoveEntityDelayed(ent,0)
- end
- end
- end
- hook.Add("OnEntityCreated", "RemoveDeadRag", RemoveDeadRag)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement