aboutsummaryrefslogtreecommitdiff
path: root/entities
diff options
context:
space:
mode:
Diffstat (limited to 'entities')
-rw-r--r--entities/entities/art_chest/cl_init.lua2
-rw-r--r--entities/entities/art_chest/init.lua4
-rw-r--r--entities/entities/art_droppeditem/cl_init.lua3
-rw-r--r--entities/entities/art_droppeditem/init.lua40
-rw-r--r--entities/entities/art_lootchest/init.lua1
-rw-r--r--entities/entities/info_huntablespawn/init.lua1
-rw-r--r--entities/entities/info_townienode/shared.lua2
-rw-r--r--entities/entities/npc_huntable/init.lua23
-rw-r--r--entities/entities/npc_huntable/shared.lua30
-rw-r--r--entities/entities/npc_shop/init.lua9
-rw-r--r--entities/entities/npc_townie/init.lua12
-rw-r--r--entities/entities/npc_townie/shared.lua8
-rw-r--r--entities/weapons/hands.lua2
13 files changed, 14 insertions, 123 deletions
diff --git a/entities/entities/art_chest/cl_init.lua b/entities/entities/art_chest/cl_init.lua
index 41a98d9..e7357ea 100644
--- a/entities/entities/art_chest/cl_init.lua
+++ b/entities/entities/art_chest/cl_init.lua
@@ -23,7 +23,6 @@ local namecache = {}
net.Receive("openchestinv",function(len,ply)
if oldpanel ~= nil then oldpanel:Remove() end
- print("Opening chest inventory")
local what = net.ReadEntity()
local chest = invfuncs.DeSerializeBackpack()
ShowInventory()
@@ -46,7 +45,6 @@ net.Receive("openchestinv",function(len,ply)
local invpanel = dat.panel
invpanel:SetPos( width - (width / 4), 0 )
invpanel:SetSize( width / 4, height )
- print("Trying to get name",name)
if namecache[what] == nil then
net.Start("requestchestname")
net.WriteEntity(what)
diff --git a/entities/entities/art_chest/init.lua b/entities/entities/art_chest/init.lua
index fb0fef5..60f82c8 100644
--- a/entities/entities/art_chest/init.lua
+++ b/entities/entities/art_chest/init.lua
@@ -25,7 +25,6 @@ function ENT:Initialize()
myinv.Owner = self
timer.Simple(0, function()
- print("Chest has creation id", self:GetCreationID())
myinv.id = self:GetCreationID()
self.data.inventories[myinv.id] = myinv
end) --Wait until the entity is initalized
@@ -41,7 +40,6 @@ end
net.Receive("closechestinv", function(ln, ply)
local chest = net.ReadEntity()
- print("closeing chest of ", ply, chest)
local obsid = chest.Observers[ply]
chest.data.inventories[chest:GetCreationID()]:RemoveObserver(obsid)
chest.Observers[ply] = nil
@@ -49,7 +47,6 @@ end)
--NOTE:Why is it important to allow a table to this argument?
function ENT:SendInventory(towho)
- print("Sending inventory to ", towho)
local observer = track.MakeInventoryObserver(towho, self:GetCreationID())
local obsid = self.data.inventories[self:GetCreationID()]:AddObserver(observer)
self.Observers[towho] = obsid
@@ -57,6 +54,5 @@ function ENT:SendInventory(towho)
end
function ENT:Use(ply)
- print("Ply opened:", ply)
self:SendInventory(ply)
end
diff --git a/entities/entities/art_droppeditem/cl_init.lua b/entities/entities/art_droppeditem/cl_init.lua
index eaea39b..3cf68e8 100644
--- a/entities/entities/art_droppeditem/cl_init.lua
+++ b/entities/entities/art_droppeditem/cl_init.lua
@@ -24,7 +24,6 @@ hook.Add("Tick","pickupitemstick",function()
for k,v in pairs(ae) do
local ei = v:EntIndex()
if (not sentrequests[ei]) and v.GetClass and v:GetClass() == "art_droppeditem" then
- print("Sending request to pick up", ei)
net.Start("art_requestpickup")
net.WriteUInt(ei,16)
net.SendToServer()
@@ -38,11 +37,9 @@ end)
net.Receive("art_informmodel",function()
- print("Player received model information")
local ei = net.ReadUInt(16)
local m = net.ReadString()
local e = Entity(ei)
- print(m)
e:SetModel(m)
e.newmodel = m
end)
diff --git a/entities/entities/art_droppeditem/init.lua b/entities/entities/art_droppeditem/init.lua
index 1ebb9c8..b9d5ec8 100644
--- a/entities/entities/art_droppeditem/init.lua
+++ b/entities/entities/art_droppeditem/init.lua
@@ -16,24 +16,11 @@ function ENT:Initialize()
self.ItemName = self.Item.Name
self.ItemData = self.Item.Data
local phoney = itm.GetItemFromData(self.ItemName,self.ItemData)
- print("About to check for onDropped",phoney,phoney.onDropped)
- PrintTable(phoney)
if phoney.onDropped ~= nil then
timer.Simple(1,function() --Can't be 0, because pac needs to know about the entity
phoney:onDropped(self)
- print("After doing phoney's ondropped, model is",self:GetModel())
- print("After ondropped, angles are",self:GetAngles(),"and color is", self:GetColor())
- --self:SetColor(Color(0,0,0,0))
end)
- -- print("Item had onDropped")
- -- self:SetColor(Color(0,0,0,0))
- -- timer.Simple(0,function()
- -- if self and self.Item then
- -- self.Item:onDropped(self)
- -- end
- -- end)
end
- print("Dropped item spawned at", self:GetPos())
self:DrawShadow(false)
self:SetMoveType(MOVETYPE_NONE)
self:SetSolid(SOLID_NONE)
@@ -42,7 +29,6 @@ end
--A client is near enough to draw the item, tell them what to draw.
net.Receive("art_requestmodel",function(len,pl)
- print(pl," requested a model")
local ei = net.ReadUInt(16)
local e = Entity(ei)
assert(e.Model ~= nil,"Attempted to request model for non-art_droppeditem entity")
@@ -55,44 +41,20 @@ end)
net.Receive("art_requestpickup",function(len,pl)
local ei = net.ReadUInt(16)
local e = Entity(ei)
- print("Got request to pick up", e)
local ep = e:GetPos()
- print("got ep pos")
local plp = pl:GetPos()
- print("got pl pos")
local d = ep:Distance(plp)
- print("Got distance")
- if d < 30 then
- print("Inside if statement")
+ if d < 100 then
local i = itm.GetItemFromData(e.ItemName, e.ItemData)
- print("Created item")
xpcall(function()
pl:GiveItem(i)
e:Remove()
end,function()
- print("Unable to put item into player's inventory")
--We couldn't put the item in the player's inventory!
--Don't do anything I guess
end)
- else
- print("Player not close enough!")
end
end)
function ENT:Use(activator, caller, usetype)
- print("a",activator,"c",caller,"u",usetype)
end
-
-print("Remove the concommand in art_droppeditem/init.lua")
-concommand.Add("dropmellon",function(ply,cmd,args)
- if not ply:IsAdmin() then return end
- local e = ents.Create("art_droppeditem")
- e.Model = "models/props_junk/Rock001a.mdl"
- e.Item = itm.GetItemByName("Watermelon")
- local hitpos = ply:GetEyeTrace().HitPos + Vector(0,0,10)
- print("Traceresult was")
- PrintTable(ply:GetEyeTrace())
- print("Hitpos was", hitpos)
- e:SetPos(hitpos)
- e:Spawn()
-end)
diff --git a/entities/entities/art_lootchest/init.lua b/entities/entities/art_lootchest/init.lua
index 4e6dd52..37d7006 100644
--- a/entities/entities/art_lootchest/init.lua
+++ b/entities/entities/art_lootchest/init.lua
@@ -3,6 +3,7 @@ AddCSLuaFile( "shared.lua" )
include("shared.lua")
+--TODO:Finish the loot chest
function CreateRandomLoot(time)
end
diff --git a/entities/entities/info_huntablespawn/init.lua b/entities/entities/info_huntablespawn/init.lua
index 709c019..9fa7f7e 100644
--- a/entities/entities/info_huntablespawn/init.lua
+++ b/entities/entities/info_huntablespawn/init.lua
@@ -1,7 +1,6 @@
--[[
This entity gives townies things to do
]]
-print("hello test")
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
diff --git a/entities/entities/info_townienode/shared.lua b/entities/entities/info_townienode/shared.lua
index fe72ac8..4b52977 100644
--- a/entities/entities/info_townienode/shared.lua
+++ b/entities/entities/info_townienode/shared.lua
@@ -2,6 +2,6 @@ ENT.Base = "base_entity"
function ENT:DoActivity(npc)
if not self.onActivity() then
- print("Node without activity, this might be an error!")
+ error("Node without activity, this might be an error!")
end
end
diff --git a/entities/entities/npc_huntable/init.lua b/entities/entities/npc_huntable/init.lua
index f1e7ac2..d6df045 100644
--- a/entities/entities/npc_huntable/init.lua
+++ b/entities/entities/npc_huntable/init.lua
@@ -4,12 +4,8 @@ include("shared.lua")
local applyfields = {"Model", "Stats"}
function ENT:Initialize()
- --print("NPC spawned!")
- --self:SetMoveType(MOVETYPE_STEP)
- --self:SetSolid(SOLID_OBB)
self:SetCollisionGroup(COLLISION_GROUP_PUSHAWAY )
- --self:SetCollisionGroup(COLLISION_GROUP_INTERACTIVE)
for _, v in pairs(applyfields) do
assert(self[v], "NPC created without " .. v .. " this might be a bug!")
end
@@ -19,7 +15,7 @@ function ENT:Initialize()
if (self.Stats["Vitality"]) then
self:SetHealth(self.Stats["Vitality"])
else
- print("NPC created with no stat for vitality, this might be a bug!")
+ error("NPC created with no stat for vitality, this might be a bug!")
end
if (self.Stats["Accel"]) then
@@ -44,7 +40,6 @@ function ENT:Initialize()
end
function ENT:OnInjured(dmg)
- print("Ent OnInjured fired! dmg was", dmg)
if self.OnDammage ~= nil then
self:OnDammage(dmg)
end
@@ -53,22 +48,6 @@ end
function ENT:OnKilled(dmg)
if (CLIENT) then return end
if not self.Drops then return end
- --print("Looks like we have some drops")
- --error("You need to code how item drops work!")
- --local itemstodrop = {}
-
- -- for k, v in pairs(self.Drops) do
- -- local rng = math.random(0, 100)
- -- local itemname = self.Drops[k][1]
- -- local itemchance = self.Drops[k][2]
- -- local heightoffset = 10
- --
- -- if rng < itemchance then
- -- --local drop = ART.GetItemByName(itemname)
- -- --print("Createing a drop of",drop)
- -- --ART.CreateDroppedItem(drop, self:GetPos())
- -- end
- -- end
self:BecomeRagdoll(dmg)
end
diff --git a/entities/entities/npc_huntable/shared.lua b/entities/entities/npc_huntable/shared.lua
index 619e2b4..01abfe8 100644
--- a/entities/entities/npc_huntable/shared.lua
+++ b/entities/entities/npc_huntable/shared.lua
@@ -17,7 +17,6 @@ end
function ENT:DefaultBehaviour()
- print("In default behavior")
self.lastrun = CurTime()
--Set some stuff up for navigation
@@ -27,12 +26,10 @@ function ENT:DefaultBehaviour()
local delta = CurTime() - self.lastrun
self:AI(delta)
while (true) do
- --print("Inside defaultbehaviour")
--Sets all the values needed for the rest of this function to do it's thing
--Main loop for ai
- --print("Going into behavior for " .. self.Name)
--Update aware enemies
delta = CurTime() - self.lastrun
if delta > 0.1 then
@@ -40,7 +37,7 @@ function ENT:DefaultBehaviour()
end
if self.TargetPos ~= nil then
- if ( !path:IsValid() ) then print("Path wasn't valid!") end
+ if ( !path:IsValid() ) then --[[path wasn't valid]] end
if ( path:GetAge() > 0.1 ) then -- Since we are following the player we have to constantly repath
path:Compute( self, self.TargetPos ) -- Compute the path towards the enemy's position again
path:Update( self ) -- This function moves the bot along the path
@@ -65,7 +62,6 @@ end
function ENT:AI(num)
- --print("Inside behaveupdate")
local players = player.GetAll()
for k, v in pairs(players) do
@@ -82,11 +78,6 @@ function ENT:AI(num)
for k, v in pairs(self.AwareEnemies) do
local priority = self:AttackPriority(v)
- if (priority == nil) then
- --print("Nill priority hit after ")
- --PrintTable(self)
- end
-
if (priority > maxpriority) then
maxpriority = priority
maxprioritytarget = v
@@ -94,16 +85,12 @@ function ENT:AI(num)
end
self.Target = maxprioritytarget
- --print("My target is",self.Target)
--If we can't find anyone to attack, just stay idle
if (self.Target == nil) then
- --print("Couldn't find anyone to attack!")
--Play an idle sequence
local randanim = math.Round(math.Rand(0, #self.IdleSequences))
- --print("Playing sequence",self.IdleSequences[randanim])
self:PlaySequenceAndWait(self.IdleSequences[randanim])
self:StartActivity(ACT_IDLE)
- --print("Acting idle")
--If there's noone within 4000 units, just remove ourselves to save server resources
local closest = 5000
@@ -116,7 +103,6 @@ function ENT:AI(num)
end
if (closest > 4000) then
- --print("Closes player is " .. closest .. " removeing self...")
self:BecomeRagdoll(DamageInfo())
end
else
@@ -148,30 +134,18 @@ function ENT:AI(num)
end
end
- --[[
- print("Before running, behavethread was", self.BehaveThread)
- local ok, message = coroutine.resume( self.BehaveThread )
- if not ok then
- self.BehaveThread = nil
- Msg( self, "error: ", message, "\n" );
- end
- ]]
-
if (self.Act) then
self:Act(num)
else
- print("NPC spawned without an Act function, this might be an error!")
+ error("NPC spawned without an Act function, this might be an error!")
end
end
function ENT:RunBehaviour()
- print("Running behavior")
if (self.Behave) then
- print("Doing self.behave")
self:Behave()
else
- print("Doing default behavior")
self:DefaultBehaviour()
end
end
diff --git a/entities/entities/npc_shop/init.lua b/entities/entities/npc_shop/init.lua
index 022f80e..deedddf 100644
--- a/entities/entities/npc_shop/init.lua
+++ b/entities/entities/npc_shop/init.lua
@@ -16,17 +16,16 @@ function ENT:Initialize()
self:SetSolid(SOLID_BBOX )
self:SetCollisionGroup(COLLISION_GROUP_NPC )
- print("Initalizeing shop npc")
if self.Model then self:SetModel(self.Model)
- else print("NPC created without model, this might be a bug!") end
+ else error("NPC created without model, this might be a bug!") end
if self.Pos then self:SetPos(self.Pos)
- else print("NPC created without a position, this might be a bug!") end
+ else error("NPC created without a position, this might be a bug!") end
self.talking = false
if self.Name then self:SetName(self.Name)
- else print("NPC created without a name! They won't be able to open doors!") end
+ else error("NPC created without a name! They won't be able to open doors!") end
if self.OnSpawn then self.OnSpawn(self) end
@@ -34,8 +33,6 @@ function ENT:Initialize()
end
function ENT:Use(ply)
- print("In shop npc, shop is", shop)
- PrintTable(shop)
--TODO:Fix shop
shop.OpenShop(self.shopitems,ply)
end
diff --git a/entities/entities/npc_townie/init.lua b/entities/entities/npc_townie/init.lua
index 00eaa63..7adc571 100644
--- a/entities/entities/npc_townie/init.lua
+++ b/entities/entities/npc_townie/init.lua
@@ -9,7 +9,6 @@ util.AddNetworkString( "closenpcdialog" )
util.AddNetworkString( "updatenpcdialog")
function ENT:Initialize()
- --print("NPC spawned!")
--self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_BBOX )
self:SetCollisionGroup(COLLISION_GROUP_NPC )
@@ -28,15 +27,15 @@ function ENT:Initialize()
self.lastdooropen = CurTime()
if self.Model then self:SetModel(self.Model)
- else print("NPC created without model, this might be a bug!") end
+ else error("NPC created without model, this might be a bug!") end
if self.Pos then self:SetPos(self.Pos)
- else print("NPC created without a position, this might be a bug!") end
+ else error("NPC created without a position, this might be a bug!") end
self.talking = false
if self.Name then self:SetName(self.Name)
- else print("NPC created without a name! They won't be able to open doors!") end
+ else error("NPC created without a name! They won't be able to open doors!") end
if self.Ang then self:SetAngles(self.Ang) end
@@ -77,7 +76,7 @@ function ENT:BehaveUpdate(num)
self.nodereached = true
else
if self.curnode.IsDone(self) then
- print("Finished action")
+ error("Finished action")
self.curnode = self:selectNewNode()
self.nodereached = false
end
@@ -91,9 +90,7 @@ function ENT:BehaveUpdate(num)
}
local tr = util.TraceLine(trdata)
local ecl
- --print("tr",tr,"tr.entity",tr.Entity)
if (tr ~= nil) and (tr.Entity ~= nil) and tr.Entity:IsValid() then
- --print("Not returning")
ecl = tr.Entity:GetClass()
end
if tr.Hit and removeblock[ecl] ~= nil then
@@ -109,7 +106,6 @@ end
function ENT:OnKilled(dmg)
if not self.Drops then return end
- --print("Looks like we have some drops")
for k,v in pairs(self.Drops) do
local rng = math.random(0,100)
local itemname = self.Drops[k][1]
diff --git a/entities/entities/npc_townie/shared.lua b/entities/entities/npc_townie/shared.lua
index 4962681..80b9cbc 100644
--- a/entities/entities/npc_townie/shared.lua
+++ b/entities/entities/npc_townie/shared.lua
@@ -7,7 +7,7 @@ function ENT:BehaveAct()
if self.Act then
self:Act()
else
- print("NPC spawned without an Act function, this might be an error!")
+ error("NPC spawned without an Act function, this might be an error!")
end
end
@@ -16,7 +16,6 @@ function ENT:Use()
end
function ENT:OnStuck()
- print("I'm stuck!")
self.curnode = self:selectNewNode()
self.nodereached = false
end
@@ -33,7 +32,6 @@ end
function ENT:RunBehaviour()
while true do
- --print("In runbehaviour")
local opts = { lookahead = 50,
tolerance = 20,
draw = false,
@@ -43,7 +41,6 @@ function ENT:RunBehaviour()
self.curnode = self:selectNewNode()
end
if self.curnode == nil then
- print("Townie could not find any nodes!")
while true do
coroutine.yield()
end
@@ -52,7 +49,6 @@ function ENT:RunBehaviour()
self:MoveToPos( self.curnode:GetPos(), opts )
self:StartActivity(ACT_WALK )
end
- --print("Called movetopos")
coroutine.yield()
end
end
@@ -67,9 +63,7 @@ function SendableDialog(tbl)
end
net.Receive("closenpcdialog",function(len,ply)
- print("player closed dialog1")
local npc = net.ReadEntity()
- print("player closed dialog")
npc.DialogCursors[ply] = nil
if next(npc.DialogCursors) == nil and
npc.loco:GetMaxYawRate() == 0 and
diff --git a/entities/weapons/hands.lua b/entities/weapons/hands.lua
index 57c56d9..8d97ab7 100644
--- a/entities/weapons/hands.lua
+++ b/entities/weapons/hands.lua
@@ -62,8 +62,6 @@ function SWEP:Tick()
local targetang = self.Owner:EyeAngles() + self.PickupAngles
local angvel = self.Pickup:GetAngles() - targetang
local deltaang = self.Pickup:GetPhysicsObject():GetAngleVelocity() - angvel:Forward()
- print("target",targetang,"vel",angvel,"delta",deltaang)
- print("Cur is", self.Pickup:GetPhysicsObject():GetAngleVelocity())
self.Pickup:GetPhysicsObject():AddAngleVelocity(angvel:Forward())
end
end