From a3a9aa4ba567a42c04adfd790049de8b390ee2d5 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Wed, 30 Dec 2015 14:09:16 -0500 Subject: Allowed aidirector to spawn dodos --- entities/entities/ws_npc_ambient/init.lua | 8 ++++---- gamemode/itemsystem/items/sword.lua | 6 +++--- gamemode/npcsystem/aidirector.lua | 8 ++++---- gamemode/npcsystem/loadnpcs.lua | 3 ++- gamemode/npcsystem/npcs/bird.lua | 2 +- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/entities/entities/ws_npc_ambient/init.lua b/entities/entities/ws_npc_ambient/init.lua index ee39178..485b6c9 100644 --- a/entities/entities/ws_npc_ambient/init.lua +++ b/entities/entities/ws_npc_ambient/init.lua @@ -5,7 +5,7 @@ AddCSLuaFile( "shared.lua" ) include('shared.lua') function ENT:Initialize() - print("NPC spawned!") + --print("NPC spawned!") if(self.Model) then self:SetModel(self.Model) else print("NPC created without model, this might be a bug!") end --self:SetModel( "models/Humans/Group01/Female_01.mdl" ) @@ -23,21 +23,21 @@ function ENT:Initialize() end function ENT:OnInjured(dmg) - print("Taking some dammage") + --print("Taking some dammage") local itempos = self:GetPos() self:SetHealth(self:Health() - dmg:GetDamage()) if self.OnDammage != nil then self:OnDammage(dmg) end if self:Health() <= 0 then //run on death if(CLIENT) then return end if not self.Drops then return end - print("Looks like we have some drops") + --print("Looks like we have some drops") local rng = math.random(0,100) for k,v in pairs(self.Drops) do local itemname = self.Drops[k][1] local itemchance = self.Drops[k][2] local heightoffset = 10 if rng < itemchance then - print("Createing a " .. itemname) + --print("Createing a " .. itemname) local drop = ents.Create("ws_item") drop.Item = GetItemByName(itemname) drop:SetModel(drop.Item.Model) diff --git a/gamemode/itemsystem/items/sword.lua b/gamemode/itemsystem/items/sword.lua index 47388d2..0da38c3 100644 --- a/gamemode/itemsystem/items/sword.lua +++ b/gamemode/itemsystem/items/sword.lua @@ -37,9 +37,9 @@ function ITEM:OnPrimary(pl,tr) if (IsValid(tr.Entity)) then local ent = tr.Entity local class = ent:GetClass() - print("Class:") - print(class) - + --print("Class:") + --print(class) + if (class == "player" or class:find("npc_") or class == "ws_pigeon" or class == "ws_prop") then ent:TakeDamage(self.Damage,pl) diff --git a/gamemode/npcsystem/aidirector.lua b/gamemode/npcsystem/aidirector.lua index d5da7db..f6cd0f9 100644 --- a/gamemode/npcsystem/aidirector.lua +++ b/gamemode/npcsystem/aidirector.lua @@ -1,7 +1,7 @@ --Lol i dunno, spawn some npc's or something -concommand.Add("ws_spawnbird",function(ply, cmd, args) - SpawnNpcByName("Bird",ply:GetPos()) +concommand.Add("ws_spawnzomb",function(ply, cmd, args) + SpawnNpcByName("Zombie",ply:GetPos()) end ) @@ -40,7 +40,7 @@ local traceline = util.TraceLine local contents = util.PointContents local Up = Vector(0,0,1) ---Randomly spawn npc's around? +--Randomly spawn bird npc's around? local Tick = CurTime() hook.Add("Tick","SpawnAmbient",function() if(CLIENT) then return end @@ -71,7 +71,7 @@ hook.Add("Tick","SpawnAmbient",function() local C = contents(Pos) if (C != CONTENTS_WATER and C != CONTENTS_WATER+CONTENTS_TRANSLUCENT) then - print("Appropriate place found, spawning bird)") + --print("Appropriate place found, spawning bird)") SpawnNpcByName("Bird",Pos) break end diff --git a/gamemode/npcsystem/loadnpcs.lua b/gamemode/npcsystem/loadnpcs.lua index 72a1511..c522400 100644 --- a/gamemode/npcsystem/loadnpcs.lua +++ b/gamemode/npcsystem/loadnpcs.lua @@ -39,7 +39,7 @@ function GetNpcByName(name) return nil end - +--[[ function GM:SpawnNPCByName(name,pos) print("Server side, spawning bird!") @@ -75,6 +75,7 @@ function GM:SpawnNPCByName(name,pos) end ent:Spawn() end +]] --[[ function GetRecipeForItem(name) for k,v in pairs( GAMEMODE.Recipes ) do diff --git a/gamemode/npcsystem/npcs/bird.lua b/gamemode/npcsystem/npcs/bird.lua index d09f1ef..fa98335 100644 --- a/gamemode/npcsystem/npcs/bird.lua +++ b/gamemode/npcsystem/npcs/bird.lua @@ -33,7 +33,7 @@ end --What to replace ENT:RunBehaviour with function NPC:Behave() - print("Going into bird's custom behaviour") + --print("Going into bird's custom behaviour") while ( true ) do self:StartActivity( ACT_IDLE ) -- walk anims self:PlaySequenceAndWait( "Idle01" ) -- Sit on the floor -- cgit v1.2.3-70-g09d2