summaryrefslogtreecommitdiff
path: root/gamemode/structuresystem
diff options
context:
space:
mode:
authorScott <scotth0828@gmail.com>2016-05-31 20:06:31 -0400
committerScott <scotth0828@gmail.com>2016-05-31 20:06:31 -0400
commit57581aecaba8105c0f8ed88c56d7f54e74123973 (patch)
treeab2096ee6a8a873c157d4f2ed0d099ea2417e33a /gamemode/structuresystem
parentdee21960c708a18785320d8dcabc7322a1f90da7 (diff)
downloadgmstranded-57581aecaba8105c0f8ed88c56d7f54e74123973.tar.gz
gmstranded-57581aecaba8105c0f8ed88c56d7f54e74123973.tar.bz2
gmstranded-57581aecaba8105c0f8ed88c56d7f54e74123973.zip
q menu can only be opened when alive, change to structure menu, structure menu bug fixes
Diffstat (limited to 'gamemode/structuresystem')
-rw-r--r--gamemode/structuresystem/common.lua56
-rw-r--r--gamemode/structuresystem/structures/stonefurnace.lua4
2 files changed, 34 insertions, 26 deletions
diff --git a/gamemode/structuresystem/common.lua b/gamemode/structuresystem/common.lua
index 2eb2233..61ffe66 100644
--- a/gamemode/structuresystem/common.lua
+++ b/gamemode/structuresystem/common.lua
@@ -1,11 +1,11 @@
-local buts = 92
+local buts = 90
local recipeWidth = buts*4
local recipeHeight = buts*1.5
local function makeCraftingWindow(name)
- local pw = 750
+ local pw = 735
local ph = 500
local DermaPanel = vgui.Create( "DFrame" )
DermaPanel:SetPos( 100, 100 )
@@ -13,15 +13,19 @@ local function makeCraftingWindow(name)
DermaPanel:SetTitle( name )
DermaPanel:SetDraggable( true )
DermaPanel:Center()
+ DermaPanel.Paint = function(self,w,h)
+
+ draw.RoundedBox( 0, 0, 0, w, h, Color(86,86,86,200) )
+
+ end
DermaPanel.scroll = vgui.Create( "DScrollPanel", DermaPanel )
DermaPanel.scroll:Dock(FILL)
DermaPanel.scroll:SetPos( 0, 25 )
- DermaPanel.scroll:SetPadding()
DermaPanel.Grid = vgui.Create("DGrid",DermaPanel.scroll)
DermaPanel.Grid:SetPos(0,0)
- DermaPanel.Grid:SetColWide(recipeWidth-10)
+ DermaPanel.Grid:SetColWide(recipeWidth+5)
DermaPanel.Grid:SetCols(pw / recipeWidth)
- DermaPanel.Grid:SetRowHeight(recipeHeight-10)
+ DermaPanel.Grid:SetRowHeight(recipeHeight+5)
/*DermaPanel.info = vgui.Create("DPanel",DermaPanel)
DermaPanel.info:SetPos(10,(buts * 2) + 30)
DermaPanel.info:SetSize(pw - 20, buts * 0.75)
@@ -96,44 +100,48 @@ function genericMakeCrafting(tbl)
end
local DermaPanel = makeCraftingWindow(tbl.Name)
+ local infoPosX = 130
+ local infoPosY = 20
for k,v in pairs(tbl.Recipes) do
local recipeButton = vgui.Create("DButton")
local text = v.Description .. "\nRequires:"
for i,j in pairs(v.Req) do
- text = text .. "\n" .. i .. "x" .. j
+ text = text .. "\n" .. i .. " x" .. j
end
recipeButton.text = text
recipeButton:SetText("")
recipeButton:SetSize(recipeWidth,recipeHeight)
- recipeButton.Paint = function(self,w,h)
+
+ recipeButton.Paint = function()
//draw.RoundedBox( 8, 5, 5, w-10, h-10, Color( 0, 0, 0 ) )
local fillcolor = Color(255,255,255)
if v.haslevelsfor then
if v.hasmatsfor then
- fillcolor = Color(200,200,200)
+ fillcolor = Color(23,180,23)
else
fillcolor = Color(200,0,0)
end
else
fillcolor = Color(200,200,0)
end
- draw.RoundedBox(0,10,10,w-20,h-20,Color(255,255,255))
- draw.RoundedBox(0,15,15,110,h-30,fillcolor)
- draw.RoundedBox(8,20,20,100,h-40,Color(255,255,255))
- draw.SimpleText( v.Description, "Default", 150, 20, Color(0,0,0) )
+ draw.RoundedBox(0,0,0,recipeWidth,recipeHeight,Color(48,48,48,255))
+ draw.RoundedBox(0,15,15,110,recipeHeight-30,fillcolor)
+ draw.RoundedBox(8,20,20,100,recipeHeight-40,Color(98,98,98))
+ //draw.RoundedBox(0,125,20,w-110,h-40,fillcolor)
+ draw.DrawText( text, "TargetID", infoPosX, infoPosY, Color( 255, 255, 255, 255 ) )
+
end
recipeButton.DoClick = function(button)
- DermaPanel.structname = tbl.Name
+ DermaPanel.structname = tbl.Name
DermaPanel.recipeNum = v.genericNum
DermaPanel.recipeMult = v.mult
- local text = v.Description .. "\nRequires:"
- for i,j in pairs(v.Req) do
- text = text .. "\n" .. i .. "x" .. j
- end
- DermaPanel.infotext:SetText(v.Name)
- DermaPanel.reqtext:SetText(text)
- DermaPanel.makebutton:SetEnabled(v.haslevelsfor and v.hasmatsfor)
+ net.Start("makerecipe")
+ net.WriteString(DermaPanel.structname)
+ if tbl.uniquedata then net.WriteUInt(self:EntIndex(), GMS.NETINT_BITCOUNT) end
+ net.WriteUInt(DermaPanel.recipeNum, GMS.NETINT_BITCOUNT)
+ net.WriteUInt(DermaPanel.recipeMult, GMS.NETINT_BITCOUNT)
+ net.SendToServer()
end
local img = vgui.Create("DImage", recipeButton)
@@ -175,7 +183,7 @@ net.Receive( "makerecipe", function(ln,ply)
--Check that we have enough ingredients
for k,v in pairs(recipe.Requirements) do
- if ply:GetResource(k * mult) < v then
+ if ply:GetResource(k) < v then
ply:SendMessage("You don't have enough!", 3, Color(255, 255, 255, 255))
return
end
@@ -190,13 +198,13 @@ net.Receive( "makerecipe", function(ln,ply)
--We have enough resources! make it!
startProcessGeneric(ply,"Crafting " .. recipe.Name, recipe.Time(ply,mult), function(player)
for k,v in pairs(recipe.Results) do
- player:IncResource(k * mult,v)
+ player:IncResource(k,mult)
end
for k,v in pairs(recipe.Requirements) do
- ply:DecResource(k * mult,v)
+ ply:DecResource(k,mult)
end
end)
-
+
end)
function genericGiveRecipie(tbl, recipe)
diff --git a/gamemode/structuresystem/structures/stonefurnace.lua b/gamemode/structuresystem/structures/stonefurnace.lua
index acd20ff..3d3e013 100644
--- a/gamemode/structuresystem/structures/stonefurnace.lua
+++ b/gamemode/structuresystem/structures/stonefurnace.lua
@@ -30,14 +30,14 @@ end
local genericRecipe = {
["Name"] = "Copper",
- ["Description"] = "Smelt some copper or into copper!",
+ ["Description"] = "Smelt some copper ore into\ncopper!",
["Requirements"] = {["Copper Ore"] = 1},
["Results"] = {["Copper"] = 1},
["Ratio"] = {1,1},
["Image"] = "items/ingot_copper.png",
["CanCraft"] = checkfunc,
["Time"] = timefunc,
- ["Mults"] = {1,5,10,20,50,3,4,6,7,87}
+ ["Mults"] = {1,5,10,20,50}
}
genericGiveRecipie(STRUCT,genericRecipe)