aboutsummaryrefslogtreecommitdiff
path: root/gamemode/inventorysystem/prayers/cl_prayers.lua
diff options
context:
space:
mode:
Diffstat (limited to 'gamemode/inventorysystem/prayers/cl_prayers.lua')
-rw-r--r--gamemode/inventorysystem/prayers/cl_prayers.lua20
1 files changed, 13 insertions, 7 deletions
diff --git a/gamemode/inventorysystem/prayers/cl_prayers.lua b/gamemode/inventorysystem/prayers/cl_prayers.lua
index afea1cc..e28db63 100644
--- a/gamemode/inventorysystem/prayers/cl_prayers.lua
+++ b/gamemode/inventorysystem/prayers/cl_prayers.lua
@@ -8,7 +8,7 @@ function pray:DrawOnDPanel(panel)
--Active grid
local agrid = vgui.Create("DGrid",panel)
agrid:SetCols(4)
- local w = ((ScrW()/4) - 10) / 4
+ local w = ((ScrW() / 4) - 10) / 4
agrid:SetHeight(w)
agrid:SetColWide(w)
agrid:SetRowHeight(w)
@@ -17,14 +17,19 @@ function pray:DrawOnDPanel(panel)
rec:SetText("F"..i)
rec:SetSize(w,w)
rec.DoClick = function(s)
- local ap = self.activeprayers[i]
+ local ap = pray.activeprayers[i]
explain:SetText(ap ~= nil and ap.Description or "Select a prayer")
end
rec:Receiver("prayer",function(s,tbl,dropped,mi,x,y)
if not dropped then return end
- self.activeprayers[i] = tbl.item
- if tbl.item.DoOnPanel then
- tbl.item.DoOnPanel(s)
+ pray.activeprayers[i] = tbl[1].item
+ if tbl[1].item == nil then
+ print("Failed to get item, tbl was")
+ PrintTable(tbl)
+ error("Failed to get item")
+ end
+ if tbl[1].item.DoOnPanel then
+ tbl[1].item:DoOnPanel(rec)
end
end,{})
agrid:AddItem(rec)
@@ -64,6 +69,7 @@ function pray:DrawOnDPanel(panel)
local observer = {}
observer.Put = function(obs,pos,item)
print("Prayer observer got request to put")
+ debug.Trace()
drawprayer(item)
end
observer.Remove = function(obs,pos,item)
@@ -79,12 +85,12 @@ local prayerhooks = {
["gm_showspare1"] = 3,
["gm_showspare2"] = 4
}
-hook.Add("PlayerBindPress", function( ply, bind, pressed )
+hook.Add("PlayerBindPress", "pray_hook", function( ply, bind, pressed )
local phn = prayerhooks[bind]
if phn == nil then return end
local pap = pray.activeprayers[phn]
if pap == nil then return end
- pap:pray()
+ pap:Pray()
end)
return pray