aboutsummaryrefslogtreecommitdiff
path: root/gamemode
diff options
context:
space:
mode:
Diffstat (limited to 'gamemode')
-rw-r--r--gamemode/client/cl_inventory.lua7
-rw-r--r--gamemode/core/clienteffects/cl_effects.lua2
-rw-r--r--gamemode/core/combat/cl_damage.lua1
-rw-r--r--gamemode/core/combat/cl_weaponswing.lua7
-rw-r--r--gamemode/core/database/sv_queries.lua6
-rw-r--r--gamemode/core/database/sv_setup.lua11
-rw-r--r--gamemode/core/inventory/sv_invtracker.lua30
-rw-r--r--gamemode/core/mapstich/sv_mapstich.lua22
-rw-r--r--gamemode/inventorysystem/cl_common.lua17
-rw-r--r--gamemode/inventorysystem/shapedinventory/cl_shaped.lua4
-rw-r--r--gamemode/inventorysystem/shapedinventory/sh_shaped.lua14
-rw-r--r--gamemode/inventorysystem/skills/cl_skills.lua9
-rw-r--r--gamemode/inventorysystem/skills/sh_skillcommon.lua4
-rw-r--r--gamemode/inventorysystem/skills/sh_skills.lua17
14 files changed, 10 insertions, 141 deletions
diff --git a/gamemode/client/cl_inventory.lua b/gamemode/client/cl_inventory.lua
index 105f1b3..838cdfb 100644
--- a/gamemode/client/cl_inventory.lua
+++ b/gamemode/client/cl_inventory.lua
@@ -15,15 +15,11 @@ local itm = nrequire("core/inventory/common/items.lua")
--local qpray = nrequire("cl_qprayers.lua")
local inv = {}
---print("Hello from cl_inventory.lua")
---debug.Trace()
-
local prayerequiped = {
false,false,false,false,false
}
net.Receive("equiphelpprayer",function()
- --print("equiphelp received client side!")
prayerequiped[4] = "Noob Help"
end)
@@ -67,7 +63,7 @@ end
local function BuildInventory()
if qframe and IsValid(qframe) then return end
- if not player_data then print("no player data!") player_data = {credits = 0} end
+ if not player_data then error("no player data!") player_data = {credits = 0} end
qframe = vgui.Create("DFrame")
qframe:SetPos(0,0)
qframe:SetSize(width / 4, height)
@@ -104,7 +100,6 @@ end
---Shows the player's inventory.
-- If the player's inventory hasn't been built yet, builds the inventory, then displays it.
function inv.ShowInventory()
- --print("qframe is ", qframe)
if not qframe then BuildInventory()
else qframe:Show() end
state.invopen = true
diff --git a/gamemode/core/clienteffects/cl_effects.lua b/gamemode/core/clienteffects/cl_effects.lua
index db84b24..eff8dba 100644
--- a/gamemode/core/clienteffects/cl_effects.lua
+++ b/gamemode/core/clienteffects/cl_effects.lua
@@ -24,7 +24,7 @@ end)
net.Receive("art_clienteffect",function()
local effectname = net.ReadString()
local effectdata = net.ReadData(net.ReadUInt(32))
- print("Got effect name",effectname)
+ log.debug("Got effect name",effectname)
effects[effectname](effectdata)
end)
diff --git a/gamemode/core/combat/cl_damage.lua b/gamemode/core/combat/cl_damage.lua
index a45cb72..ed21b8a 100644
--- a/gamemode/core/combat/cl_damage.lua
+++ b/gamemode/core/combat/cl_damage.lua
@@ -3,7 +3,6 @@
local drawables = {}
net.Receive("art_damage_ent",function()
- --print("Notified of damage")
local who = net.ReadEntity()
local dmg = net.ReadDouble()
diff --git a/gamemode/core/combat/cl_weaponswing.lua b/gamemode/core/combat/cl_weaponswing.lua
index 7f2c927..61c31b0 100644
--- a/gamemode/core/combat/cl_weaponswing.lua
+++ b/gamemode/core/combat/cl_weaponswing.lua
@@ -6,7 +6,6 @@ function finddmgpoint(name)
local filetext = file.Read(filepath,"DATA")
local outfit = CompileString(string.format("return {%s}",filetext),name)()
ball = LocalPlayer():FindPACPart(outfit, "wep_point")
- print("point is",ball,type(ball))
end
function finddmgbox(who,name)
local filepath = string.format(CLIENT_PAC_DIR .. "/%s.txt",name)
@@ -61,7 +60,6 @@ net.Receive("artery_doanimation",function()
--pac.SetupENT(who)
finddmgbox(who,pacname)
animent = who
- print("Doing animation:",animname,animtime,echoname)
who:SetupBones()
who:SetLuaAnimation(animname)
stt.invopen = true
@@ -71,7 +69,6 @@ net.Receive("artery_doanimation",function()
timer.Simple(animtime,function()
tracking = false
stt.invopen = false
- print("Stopping animation",animname)
who:StopLuaAnimation(animname)
net.Start("artery_notifyserverofswing")
net.WriteString(wepname)
@@ -99,10 +96,8 @@ local lastpos
hook.Add("Tick","trace_weppos",function()
if not IsValid(ball) or not IsValid(ball.Entity) then return end
if lastpos == nil then lastpos = ball.Entity:GetPos() end
- --print("Distance between ", ball.Entity:GetPos(), "and", lastpos, " is" ,ball.Entity:GetPos():Distance(lastpos))
- if --[[ball.Entity:GetPos():Distance(lastpos) > 0.5 and]] tracking then
+ if tracking then
swingtbl[#swingtbl + 1] = ball.Entity:GetPos() - animent:GetPos()
- --print(ball.Entity:GetPos() - animent:GetPos())
lastpos = ball.Entity:GetPos()
end
end)
diff --git a/gamemode/core/database/sv_queries.lua b/gamemode/core/database/sv_queries.lua
index 3c5f309..4d659b2 100644
--- a/gamemode/core/database/sv_queries.lua
+++ b/gamemode/core/database/sv_queries.lua
@@ -41,18 +41,12 @@ function q.deserialize_player(ply,str)
log.error("Failed to deserialize player " .. ply:Nick() .. "\n" .. str)
end
local invs = tbl.inventories
- print("Inventories was", invs)
- PrintTable(invs)
for k,v in pairs(invs) do
- print("Giveing inventory",v[1],v[2])
track.GiveInventoryWithData(ply,v[1],v[2])
- print("Gave inventory ", v[1])
end
ply.data.skills = tbl.skills or {}
ply.data.quests = tbl.quests or {}
ply.data.credits = tbl.credits or 100
- print("After deserializeing player, their .data is",ply.data)
- PrintTable(ply.data)
track.SendPlayerData(ply)
end
diff --git a/gamemode/core/database/sv_setup.lua b/gamemode/core/database/sv_setup.lua
index 3fa1823..c98a8e4 100644
--- a/gamemode/core/database/sv_setup.lua
+++ b/gamemode/core/database/sv_setup.lua
@@ -58,19 +58,14 @@ function sql.GetPlayerData(ply)
local s64 = ply:SteamID64()
local q_str = q.s_fmt(fetch_player_query,s64)
local q_suc = function(res,li)
- print("Got player's data:",res,type(res))
if res == nil then
- print("Was nil, createing player data")
sql.CreatePlayerTable(ply)
else
- PrintTable(res)
assert(#res == 1,"Not unique!")
local meta = res[1].MetaData
local plyd = res[1].PlayerData
local mtbl = util.JSONToTable(meta)
- print("About to check if we are on the right server")
if mtbl.lastserver ~= game.GetIPAddress() then
- print("Connecting player to ", mtbl.lastserver, " was on ", game.GetIPAddress())
--ply:ConCommand("connect " .. mtbl.lastserver)
net.Start("art_sendtoserver")
net.WriteString(mtbl.lastserver)
@@ -106,14 +101,8 @@ function sql.CreatePlayerTable(ply)
--print("steamid was", s64)
local plytbl = data.newdata()
local plymet = data.newmeta()
- print("creating player, before uttj, plytbl is")
- PrintTable(plytbl)
local plydata =util.TableToJSON(plytbl)
- print("after, plydata is")
- print(plydata)
local metdata = util.TableToJSON(plymet)
- print("plydata", plydata)
- print("metdata", metdata)
local q_str = q.s_fmt(create_player_query,s64,plydata,metdata)
local q_suc = function(res,li)
--print("Inserted new player",ply)
diff --git a/gamemode/core/inventory/sv_invtracker.lua b/gamemode/core/inventory/sv_invtracker.lua
index 67e32a1..32388d7 100644
--- a/gamemode/core/inventory/sv_invtracker.lua
+++ b/gamemode/core/inventory/sv_invtracker.lua
@@ -77,14 +77,6 @@ net.Receive("art_RequestInvDrop",function(len,ply)
local frominvid = net.ReadUInt(32)
local frompos = net.ReadTable()
assert(not froment:IsPlayer() or froment == ply, "Player tried to drop an item that was from another players inventory")
- print("Using data for drop:")
- PrintTable({
- ["froment"] = froment,
- ["frominvid"] = frominvid,
- ["frompos"] = frompos
- })
- print("Player's data is:")
- PrintTable(froment.data)
local frominv = froment.data.inventories[frominvid]
local item = frominv:Get(frompos)
frominv:Remove(frompos)
@@ -119,11 +111,8 @@ end
--@tparam player ply The player we want to provide the updates to
--@tparam number invid The inventory number on the player we want to provide the updates to
function track.MakeInventoryObserver(ply,invid)
- print("Making observer...")
local observer = {}
observer.Put = function(self,pos,item)
- print("In observer, item was", item)
- PrintTable(item)
local name = item.Name
local data = item:Serialize()
net.Start("art_UpdateInventory")
@@ -142,7 +131,6 @@ function track.MakeInventoryObserver(ply,invid)
net.WriteTable(pos)
net.Send(ply)
end
- print("Returning observer...")
return observer
end
@@ -157,7 +145,6 @@ function track.NotifyPlayerOfInventory(ply,tinv)
net.WriteString(tinv.Name)
net.WriteUInt(#initaldat,32)
net.WriteData(initaldat,#initaldat)
- print("Before sending, inv owner is", tinv.Owner, "and type is",tinv.Name)
net.WriteEntity(tinv.Owner)
net.WriteTable({})
net.Send(ply)
@@ -199,18 +186,12 @@ end
--@tparam table|nil higharchy The spot in the higharchy to place the inventory.
function track.GiveInventoryWithData(ply,name,data,higharchy)
local hi = higharchy or {}
- print("Giveing inventory with data")
local i = inv.CreateInventoryFromData(name,data,ply)
- print("Created inventory track",ply,ply.data,ply.data.inventories)
local nid = #ply.data.inventories + 1
- print("got nid")
local observer = track.MakeInventoryObserver(ply,nid)
- print("Made observer for", i)
i.id = nid
i:AddObserver(observer)
- print("Added observer")
ply.data.inventories[nid] = i
- print("About to tell client to observe")
net.Start("art_ObserveInventory")
net.WriteUInt(nid,32)
net.WriteString(name)
@@ -218,11 +199,7 @@ function track.GiveInventoryWithData(ply,name,data,higharchy)
net.WriteData(data,#data)
net.WriteEntity(ply)
net.WriteTable(hi)
- print("About to send...")
net.Send(ply)
-
- print("Finished giving inventory with data, ply.data is now ", ply.data)
- PrintTable(ply.data)
end
@@ -249,14 +226,9 @@ end
--@tparam table tbl The position the item is in (returned by plymeta:HasItem())
--@treturn itemtbl The item that was removed
function plymeta:RemoveItem(tbl)
- print("Got remove table, it was",tbl)
- PrintTable(tbl)
local nid = tbl[1]
local pos = tbl[2]
- print("Self inventory was")
- PrintTable(self.data.inventories[nid])
local item = self.data.inventories[nid]:Remove(pos)
- print("sv_invtracker's item was", item)
return item
end
@@ -275,7 +247,6 @@ function plymeta:GiveItem(tbl)
log.debug("inventory " .. k .. " couldn't fit it...")
end
end
- PrintTable(tbl)
error("Unable to find place to put item")
end
@@ -288,7 +259,6 @@ end
---Sets a player's credits.
-- To be depriciated
function plymeta:SetCredits(num)
- print("Set credits called")
self.data.credits = num
net.Start("art_load_player_data")
net.WriteTable({
diff --git a/gamemode/core/mapstich/sv_mapstich.lua b/gamemode/core/mapstich/sv_mapstich.lua
index 5fd8129..f4208dd 100644
--- a/gamemode/core/mapstich/sv_mapstich.lua
+++ b/gamemode/core/mapstich/sv_mapstich.lua
@@ -6,14 +6,18 @@
nrequire("sv_mysqlite.lua")
if not nrequire("sh_zones.lua") then return end
local q = nrequire("core/database/sv_queries.lua")
+local log = nrequire("log.lua")
--if not zones then error("This thing needs zones to function!") end
-print("Hello from sv_mapstich.lua")
util.AddNetworkString("art_zonechange")
util.AddNetworkString("art_sendtoserver")
local dontupdatedisconnect = {}
+local function sqlerror(err,sql)
+ log.error("Query error:\nQuery:",sql,"\nError:",err)
+end
+
local function SavePlayerData(ply)
local query
local pdat = q.serialize_player(ply)
@@ -31,16 +35,11 @@ local function SavePlayerData(ply)
lastserver = game.GetIPAddress(),
lastlocation = tostring(ply:GetPos())
})
- print("pmet turns out to be",pmet)
query = q.s_fmt(query,pdat,pmet,ply:SteamID64())
end
MySQLite.query(query,function(data)
- end,function(err,sql)
- print("Query error:")
- print("Query",sql)
- print("Error",err)
- end)
+ end,sqlerror)
end
---Saves the player.
@@ -64,21 +63,14 @@ net.Receive("art_zonechange",function(len,ply)
lastserver = zone.toserver,
lastlocation = tostring(zone.topos)
})
- print("pmet is", pmet)
local fquery = q.s_fmt(query,pmet,ply:SteamID64())
- print("fquery was", fquery)
- print("Running query:",qc)
MySQLite.query(fquery,function(data)
--Holy shit fuck garry for breaking this
--ply:ConCommand("connect " .. zone.toserver)
net.Start("art_sendtoserver")
net.WriteString(zone.toserver)
net.Send(ply)
- end,function(err,sql)
- print("Query error:")
- print("Query",sql)
- print("Error",err)
- end)
+ end,sqlerror)
end
end)
end)
diff --git a/gamemode/inventorysystem/cl_common.lua b/gamemode/inventorysystem/cl_common.lua
index 505c5d9..559c8f0 100644
--- a/gamemode/inventorysystem/cl_common.lua
+++ b/gamemode/inventorysystem/cl_common.lua
@@ -27,21 +27,6 @@ function com.generatereceiver()
local fromid,toid = panels[1].info.id,self.info.id
local frompos,topos = panels[1].info.pos,self.info.pos
local frominv,toinv = panels[1].info.inv,self.info.inv
- print("Something was dropped on:",x,y)
- PrintTable(panels)
- print("self is", self)
- print("self.info is", self.info)
- PrintTable(self.info)
- print("froment:",froment)
- print("toent:",toent)
- print("fromid",fromid)
- print("toid",toid)
- print("frompos:",frompos)
- PrintTable(panels[1].info.pos)
- print("topos:",topos)
- PrintTable(self.info.pos)
- print("frominv",frominv)
- print("toinv",toinv)
--Do nothing if we don't actually want to move anything anywhere
local posequal = true
@@ -57,12 +42,10 @@ function com.generatereceiver()
if posequal then return end
local item = frominv:Get(frompos)
- print("item was", item)
--Fake remove the item, in case the position we want to move it to overlaps with where it is now.
frominv:Remove(frompos)
local cf = toinv:CanFitIn(topos,item)
frominv:Put(frompos,item)
- print("canfit was:",cf)
if cf == true then
--Send the request
net.Start("art_RequestInvMove")
diff --git a/gamemode/inventorysystem/shapedinventory/cl_shaped.lua b/gamemode/inventorysystem/shapedinventory/cl_shaped.lua
index dde523f..d74b629 100644
--- a/gamemode/inventorysystem/shapedinventory/cl_shaped.lua
+++ b/gamemode/inventorysystem/shapedinventory/cl_shaped.lua
@@ -46,7 +46,6 @@ end
--Draw the item in a position
local function drawitemat(self,x,y,item)
- print("Drawing item at ",x,y)
local tp = self.gridpanels[x][y]
if tp == nil then
error("Unable to continue, could not find item at (" .. x .. "," .. y .. ")")
@@ -67,7 +66,6 @@ local function drawitemat(self,x,y,item)
end
end
if item.DoOnPanel then
- print("Calling cl_shaped's DoOnPanel")
item:DoOnPanel(tp)
end
if item.Paint then
@@ -139,11 +137,9 @@ inv.DrawOnDPanel = function(self,panel)
local observer = {}
observer.Put = function(obs,position,item)
- print("observer's put was called")
drawitemat(self,position[1],position[2],item)
end
observer.Remove = function(obs,position)
- print("observer's remove was called")
undrawitemat(self,position[1],position[2])
end
return observer
diff --git a/gamemode/inventorysystem/shapedinventory/sh_shaped.lua b/gamemode/inventorysystem/shapedinventory/sh_shaped.lua
index e9b2e91..5de6272 100644
--- a/gamemode/inventorysystem/shapedinventory/sh_shaped.lua
+++ b/gamemode/inventorysystem/shapedinventory/sh_shaped.lua
@@ -21,7 +21,6 @@ local function canfitin(self,arow,acol,shape)
for rn,row in ipairs(shape) do
for cn,col in ipairs(row) do
local absrow,abscol = arow + rn - 1, acol + cn - 1
- print("absrow was",absrow,"abscol was",abscol)
local slot = calcposition(self.width,self.height,absrow,abscol)
if col and ((self.tracker[slot] ~= nil) or (absrow > self.width) or (abscol > self.height)) then
return false
@@ -53,7 +52,6 @@ function inv:CanFitIn(tbl,item)
end
function inv:Put(tbl,item)
- print("Calling put")
--Set the item's shape to true
for rn,row in ipairs(item.Shape) do
@@ -66,9 +64,7 @@ function inv:Put(tbl,item)
end
--Now set the item in the correct slot
- print("Put item at ",tbl[1],tbl[2])
local slot = calcposition(self.width,self.height,tbl[1],tbl[2])
- print("Slot is",slot)
self.tracker[slot] = item
end
@@ -81,10 +77,8 @@ function inv:Has(ptr)
end
for k,v in pairs(self.tracker) do
if type(v) == "table" and compare_func(v) then
- print("Found item in spot:",k)
local row = math.ceil(k / self.width)
local col = ((k - 1) % self.width) + 1
- print("Has is retuning",row,col)
return {row,col}
end
end
@@ -93,7 +87,6 @@ end
function inv:Remove(tbl)
local slot = calcposition(self.width,self.height,tbl[1],tbl[2])
- print("Slot is",slot)
local item = self.tracker[slot]
self.tracker[slot] = nil
for rn,row in ipairs(item.Shape) do
@@ -104,7 +97,6 @@ function inv:Remove(tbl)
end
end
end
- print("shaped is returning",item)
return item
end
@@ -127,19 +119,13 @@ function inv:Serialize()
end
function inv:DeSerialize(str)
- print("Deserialize str is", str)
local ret = table.Copy(self)
local tbl = util.JSONToTable(str)
- print("unjsoned is",tbl,type(tbl))
- PrintTable(tbl)
for k,v in pairs(tbl) do
local name = k
local pos = v[1]
local data = v[2]
local item = itm.GetItemFromData(name,data)
- print("Got item",item)
- PrintTable(item)
- print("got pos",pos)
ret:Put(pos,item)
--ret.tracker[pos] = itm.GetItemFromData(name,data)
end
diff --git a/gamemode/inventorysystem/skills/cl_skills.lua b/gamemode/inventorysystem/skills/cl_skills.lua
index fed0f46..d0a5421 100644
--- a/gamemode/inventorysystem/skills/cl_skills.lua
+++ b/gamemode/inventorysystem/skills/cl_skills.lua
@@ -16,17 +16,12 @@ local levelfunc = function(val)
end
local set_xp_of = function(name,ammt)
- print("setting xp of", name," to ", ammt)
local lvl,frac = levelfunc(ammt)
elements[name].label:SetText(string.format("%s : %d (%2.5f%%)",name,lvl,frac))
elements[name].bar:SetFraction(frac)
end
inv.DrawOnDPanel = function(self,panel)
- print("Drawing skills on panel")
- PrintTable(sc.SkillList())
- print("with")
- PrintTable(self.skills)
local sheet = vgui.Create( "DColumnSheet", panel )
sheet:Dock( FILL )
@@ -59,14 +54,10 @@ inv.DrawOnDPanel = function(self,panel)
local prox = {}
prox.Put = function(s,position,item)
- print("Calling inventory's put")
- print("At time of call, skill was")
- PrintTable(self)
set_xp_of(position[1],self.skills[position[1]] or item.ammt)--Observer might be called before our put()
end
prox.Remove = function(s,position)
- print("Calling inventory's remove")
set_xp_of(position[1],self.skills[position[1]] or itm.ammt)
end
diff --git a/gamemode/inventorysystem/skills/sh_skillcommon.lua b/gamemode/inventorysystem/skills/sh_skillcommon.lua
index fd05eaa..9640421 100644
--- a/gamemode/inventorysystem/skills/sh_skillcommon.lua
+++ b/gamemode/inventorysystem/skills/sh_skillcommon.lua
@@ -39,8 +39,6 @@ local lib = {}
local skills = {}
--Skillname is a table of {string_group,string_name}
function lib.RegisterSkill(skillname)
- print("funcs.RegisterSkill called with")
- PrintTable(skillname)
local group,name = skillname[1],skillname[2]
if not skills[group] then
skills[group] = {}
@@ -57,8 +55,6 @@ function lib.RegisterSkill(skillname)
else
skills[group][#skills[group] + 1] = name
end
- print("After registering skill, skills is")
- PrintTable(skills)
end
function lib.SkillList()
diff --git a/gamemode/inventorysystem/skills/sh_skills.lua b/gamemode/inventorysystem/skills/sh_skills.lua
index 9b6edd5..a1c878f 100644
--- a/gamemode/inventorysystem/skills/sh_skills.lua
+++ b/gamemode/inventorysystem/skills/sh_skills.lua
@@ -81,12 +81,9 @@ inv.skills = {}
local function calculate_skills()
for k,v in pairs(sc.SkillList()) do
for i,j in pairs(v) do
- print("settings inv's skills' ", j, " to 0")
inv.skills[j] = 0
end
end
- print("After calculating skills, inv was")
- PrintTable(inv)
end
calculate_skills()
@@ -99,15 +96,9 @@ item should be
}
]]
inv.FindPlaceFor = function(self, item)
- print("finding place for ")
- PrintTable(item)
if not item.isskill then
return nil
end
- print("Skill inventory trying to find place for, looking in ")
- PrintTable(inv.skills)
- print("for")
- print(item.name)
if inv.skills[item.name] then
return {item.name}
else
@@ -120,8 +111,6 @@ inv.CanFitIn = function(self,position,item)
end
inv.Put = function(self,position,item)
- print("item is")
- PrintTable(item)
self.skills[position[1]] = (self.skills[position[1]] or 0) + item.ammt
end
@@ -155,17 +144,11 @@ inv.DeSerialize = function(self,data)
return table.Copy(inv)
end
calculate_skills()
- print("At the time we deserialized, sc.skilllist was")
- PrintTable(sc.SkillList())
- print("Before making a copy of, inv is")
- PrintTable(inv)
local cpy = table.Copy(self)
local gen = util.JSONToTable(data)
for k,v in pairs(gen) do
cpy.skills[k] = v
end
- print("AFter deserializing inventory, it is")
- PrintTable(cpy)
return cpy
end