diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2016-05-07 23:19:43 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2016-05-07 23:19:43 -0400 |
| commit | 98e22ce970aa7b67e36f24a0fef8a694cbac098a (patch) | |
| tree | 161d98b9cc9a165b0d185bcc3d1d3649844c8115 /gamemode | |
| parent | 755b58de20df6151a63d99c5baf6191c499f0b87 (diff) | |
| parent | 99faf35965c51e9b5340ffaaab102718a875d7d8 (diff) | |
| download | gmstranded-98e22ce970aa7b67e36f24a0fef8a694cbac098a.tar.gz gmstranded-98e22ce970aa7b67e36f24a0fef8a694cbac098a.tar.bz2 gmstranded-98e22ce970aa7b67e36f24a0fef8a694cbac098a.zip | |
Merge branch 'master' of ssh://cogarr.net:43/home/git/gmstranded
Diffstat (limited to 'gamemode')
| -rw-r--r-- | gamemode/cl_deathmenu.lua | 223 | ||||
| -rw-r--r-- | gamemode/client/cl_inventory.lua | 12 | ||||
| -rw-r--r-- | gamemode/craftablesystem/playermade/concrete.lua | 1 | ||||
| -rw-r--r-- | gamemode/craftablesystem/playermade/dough.lua | 3 | ||||
| -rw-r--r-- | gamemode/craftablesystem/playermade/flour.lua | 1 | ||||
| -rw-r--r-- | gamemode/craftablesystem/playermade/medicine.lua | 1 | ||||
| -rw-r--r-- | gamemode/craftablesystem/playermade/rope.lua | 1 | ||||
| -rw-r--r-- | gamemode/craftablesystem/playermade/spice.lua | 1 | ||||
| -rw-r--r-- | gamemode/craftablesystem/playermade/urine.lua | 3 | ||||
| -rw-r--r-- | gamemode/itemsystem/items/deaddroppable.lua | 1 |
10 files changed, 168 insertions, 79 deletions
diff --git a/gamemode/cl_deathmenu.lua b/gamemode/cl_deathmenu.lua index 0a3474b..e206ff3 100644 --- a/gamemode/cl_deathmenu.lua +++ b/gamemode/cl_deathmenu.lua @@ -46,13 +46,6 @@ local function receive_message(len) res = net.ReadTable() wep = net.ReadTable() -for k,v in pairs(wep) do - print("death weapon: "..k.." : "..v) - end - for k,v in pairs(res) do - print("death resource: "..k.." : "..v) - end - if (active == 0) then dmFrame = vgui.Create("dmFrame") active = 1 end end @@ -65,6 +58,7 @@ local PANEL = {} width = 100 height = 100 + function PANEL:Init() self:SetSize( 440, 400 ) @@ -139,7 +133,7 @@ function PANEL:Init() local img = vgui.Create("DImage", wepPNL) img:SetPos(0, 0) img:SetSize(wepPNL:GetSize()) - img:SetImage("gms_icons/gms_weapon.png") + img:SetImage("items/gms_weapon.png") end @@ -159,6 +153,7 @@ function PANEL:Init() for k,v in pairs(res) do local resPNL = vgui.Create( "DButton", DScrollPanel ) resPNL:SetSize( width, height ) + resPNL:SetText("") if (k/4 <= column2) then resPNL:SetPos( (row2-1)*(width+2) + XOffset,(column2-1)*(height+2) + (column*height + 50)) row2=row2+1 @@ -176,20 +171,166 @@ function PANEL:Init() resPNL.DoClick = function() local mb = DermaMenu() + mb:AddOption("Take x1", function() + + if (amount - 1 <= 0) then + + if (amount - 1 == 0) then + amount = 0 + for i,o in pairs(res) do + if (getResName(v) == getResName(o)) then + giveRes(getResName(o), 1, i) + table.remove(res, i) + end + end + resPNL:Remove() + else + + num1 = amount - 1 + num2 = 1 + num1 + amount = 0 + + + for i,o in pairs(res) do + if (getResName(v) == getResName(o)) then + giveRes(getResName(o), num2, i) + table.remove(res,i) + end + end + + resPNL:Remove() + end + + else + + amount = amount - 1 + + + for i,o in pairs(res) do + if (getResName(v) == getResName(o)) then + giveRes(getResName(o), 1, i) + res[i] = getResName(o) .. " x" .. amount + v = res[i] + end + end + + end + + end) + mb:AddOption("Take x5", function() + + if (amount - 5 <= 0) then + + if (amount - 5 == 0) then + amount = 0 + for i,o in pairs(res) do + if (getResName(v) == getResName(o)) then + giveRes(getResName(o), 5, i) + table.remove(res, i) + end + end + resPNL:Remove() + else + + num1 = amount - 5 + num2 = 5 + num1 + amount = 0 + + + for i,o in pairs(res) do + if (getResName(v) == getResName(o)) then + giveRes(getResName(o), num2, i) + table.remove(res,i) + end + end + + resPNL:Remove() + end + + else + + amount = amount - 5 + + + for i,o in pairs(res) do + if (getResName(v) == getResName(o)) then + giveRes(getResName(o), 5, i) + res[i] = getResName(o) .. " x" .. amount + v = res[i] + end + end + + end + + end) + mb:AddOption("Take x10", function() + + if (amount - 10 <= 0) then + + if (amount - 10 == 0) then + amount = 0 + for i,o in pairs(res) do + if (getResName(v) == getResName(o)) then + giveRes(getResName(o), 10, i) + table.remove(res, i) + end + end + resPNL:Remove() + else + + num1 = amount - 10 + num2 = 10 + num1 + amount = 0 + + + for i,o in pairs(res) do + if (getResName(v) == getResName(o)) then + giveRes(getResName(o), num2, i) + table.remove(res,i) + end + end + + resPNL:Remove() + end + + else + + amount = amount - 10 + + + for i,o in pairs(res) do + if (getResName(v) == getResName(o)) then + giveRes(getResName(o), 10, i) + res[i] = getResName(o) .. " x" .. amount + v = res[i] + end + end + + end + + end) + mb:AddOption("Take All", function() + + for i,o in pairs(res) do + if (getResName(v) == getResName(o)) then + giveRes(getResName(o), amount, i) + table.remove(res, i) + end + end + amount = 0 + resPNL:Remove() + + end) + + mb:Open() - addMenuButton(mb, resPNL, "Take x1", amount, 1, v) - addMenuButton(mb, resPNL, "Take x5", amount, 5, v) - addMenuButton(mb, resPNL, "Take x10", amount, 10, v) - addMenuButton(mb, resPNL, "Take All", amount, amount, v) - mb:Open() end resPNL.Paint = function() draw.RoundedBox( 0, 0, 0, resPNL:GetWide(), resPNL:GetTall(), Color( 69, 69, 69, 125 ) ) - surface.SetFont("Items") surface.SetTextColor( 0,0,0 ) surface.SetTextPos( (width/2)-(surface.GetTextSize(v)/2), height-20 ) @@ -198,9 +339,9 @@ function PANEL:Init() end local img = vgui.Create("DImage", resPNL) - img:SetPos(0, 0) - img:SetSize(resPNL:GetSize()) - img:SetImage("gms_icons/gms_resourcepack.png") + img:SetPos(20, 10) + img:SetSize(resPNL:GetWide()-40, resPNL:GetTall()-40) + if (GMS.GetResourceByName(getResName(v)).Icon != nil) then img:SetImage(GMS.GetResourceByName(getResName(v)).Icon) else img:SetImage("vgui/avatar_default") end end end @@ -211,54 +352,6 @@ function getResName(str) return string.Implode(" ", spl) end -function addMenuButton(mb, resPNL, name, amount, remove, v) - mb:AddOption(name, function() - - if (amount - remove <= 0) then - - if (amount - remove == 0) then - amount = 0 - for i,o in pairs(res) do - if (getResName(v) == getResName(o)) then - giveRes(getResName(o), remove, i) - table.remove(res, i) - end - end - resPNL:Remove() - else - - num1 = amount - remove - num2 = remove + num1 - amount = 0 - - - for i,o in pairs(res) do - if (getResName(v) == getResName(o)) then - giveRes(getResName(o), num2, i) - table.remove(res,i) - end - end - - resPNL:Remove() - end - - else - - amount = amount - remove - - - for i,o in pairs(res) do - if (getResName(v) == getResName(o)) then - giveRes(getResName(o), remove, i) - res[i] = getResName(o) .. " x" .. amount - v = res[i] - end - end - - end - - end) -end function PANEL:Close() active = 0 diff --git a/gamemode/client/cl_inventory.lua b/gamemode/client/cl_inventory.lua index 9a19fa7..c178f4f 100644 --- a/gamemode/client/cl_inventory.lua +++ b/gamemode/client/cl_inventory.lua @@ -406,9 +406,15 @@ function PANEL:Init() local img = vgui.Create("DImage", slot) img:SetPos(20, 10) img:SetSize(slot:GetWide()-40, slot:GetTall()-40) - if (v.Icon != nil) then img:SetImage(v.Icon) else img:SetImage("vgui/avatar_default") end - - + // for some reason has stone twice? v + for j,k in SortedPairs(v.Results) do + if (j != "Stone") then + icon = GMS.GetResourceByName(j).Icon + if (icon != nil && icon != "test.png") then img:SetImage(icon) else img:SetImage("vgui/avatar_default") end + end + end + + i=i+1 end diff --git a/gamemode/craftablesystem/playermade/concrete.lua b/gamemode/craftablesystem/playermade/concrete.lua index 55c0165..a173ee3 100644 --- a/gamemode/craftablesystem/playermade/concrete.lua +++ b/gamemode/craftablesystem/playermade/concrete.lua @@ -3,7 +3,6 @@ local COMBI = {} COMBI.Name = "Concrete" COMBI.Description = "Concrete can be used for spawning concrete props." -COMBI.Icon = "items/concrete.png" COMBI.Req = {} COMBI.Req["Sand"] = 5 diff --git a/gamemode/craftablesystem/playermade/dough.lua b/gamemode/craftablesystem/playermade/dough.lua index e839de1..bb0e5b4 100644 --- a/gamemode/craftablesystem/playermade/dough.lua +++ b/gamemode/craftablesystem/playermade/dough.lua @@ -1,11 +1,9 @@ -img = "items/dough.png" /* Dough */ local COMBI = {} COMBI.Name = "Dough" COMBI.Description = "Dough is used for baking." -COMBI.Icon = img COMBI.Req = {} COMBI.Req["Water Bottles"] = 1 @@ -21,7 +19,6 @@ local COMBI = {} COMBI.Name = "Dough 10x" COMBI.Description = "Dough is used for baking." -COMBI.Icon = img COMBI.Req = {} COMBI.Req["Water Bottles"] = 7 diff --git a/gamemode/craftablesystem/playermade/flour.lua b/gamemode/craftablesystem/playermade/flour.lua index 3a9891e..4ebd77d 100644 --- a/gamemode/craftablesystem/playermade/flour.lua +++ b/gamemode/craftablesystem/playermade/flour.lua @@ -2,7 +2,6 @@ local COMBI = {} COMBI.Name = "Flour" COMBI.Description = "Flour can be used for making dough." -COMBI.Icon = "items/flour.png" COMBI.Req = {} COMBI.Req["Stone"] = 1 diff --git a/gamemode/craftablesystem/playermade/medicine.lua b/gamemode/craftablesystem/playermade/medicine.lua index 998c1a2..223cc1c 100644 --- a/gamemode/craftablesystem/playermade/medicine.lua +++ b/gamemode/craftablesystem/playermade/medicine.lua @@ -2,7 +2,6 @@ local COMBI = {} COMBI.Name = "Medicine" COMBI.Description = "To restore your health." -COMBI.Icon = "items/medicine.png" COMBI.Req = {} COMBI.Req["Herbs"] = 7 diff --git a/gamemode/craftablesystem/playermade/rope.lua b/gamemode/craftablesystem/playermade/rope.lua index e2f50e5..4e6e15e 100644 --- a/gamemode/craftablesystem/playermade/rope.lua +++ b/gamemode/craftablesystem/playermade/rope.lua @@ -3,7 +3,6 @@ local COMBI = {} COMBI.Name = "Rope" COMBI.Description = "Allows you to use Rope tool ( Using Rope Tool will consume the Rope ) and used in fishing rod crafting." -COMBI.Icon = "items/rope.png" COMBI.Req = {} COMBI.Req["Herbs"] = 5 diff --git a/gamemode/craftablesystem/playermade/spice.lua b/gamemode/craftablesystem/playermade/spice.lua index f6f39e2..3172ed5 100644 --- a/gamemode/craftablesystem/playermade/spice.lua +++ b/gamemode/craftablesystem/playermade/spice.lua @@ -3,7 +3,6 @@ local COMBI = {} COMBI.Name = "Spices" COMBI.Description = "Spice can be used for various meals." -COMBI.Icon = "items/spices.png" COMBI.Req = {} COMBI.Req["Stone"] = 1 diff --git a/gamemode/craftablesystem/playermade/urine.lua b/gamemode/craftablesystem/playermade/urine.lua index ae05626..bd60c50 100644 --- a/gamemode/craftablesystem/playermade/urine.lua +++ b/gamemode/craftablesystem/playermade/urine.lua @@ -3,7 +3,6 @@ local COMBI = {} COMBI.Name = "Urine" COMBI.Description = "Drink some water and wait, used in gunpowder production." -COMBI.Icon = "items/bottle_urine.png" COMBI.Req = {} COMBI.Req["Water Bottles"] = 2 @@ -18,7 +17,6 @@ local COMBI = {} COMBI.Name = "Urine 10x" COMBI.Description = "Drink loads of water and wait, messy, but used in gunpowder production." -COMBI.Icon = "items/bottle_urine.png" COMBI.Req = {} COMBI.Req["Water Bottles"] = 20 @@ -33,7 +31,6 @@ local COMBI = {} COMBI.Name = "Urine 50x" COMBI.Description = "Drink loads of water and wait, messy, but used in gunpowder production." -COMBI.Icon = "items/bottle_urine.png" COMBI.Req = {} COMBI.Req["Water Bottles"] = 100 diff --git a/gamemode/itemsystem/items/deaddroppable.lua b/gamemode/itemsystem/items/deaddroppable.lua index 8eea468..4661e3f 100644 --- a/gamemode/itemsystem/items/deaddroppable.lua +++ b/gamemode/itemsystem/items/deaddroppable.lua @@ -58,6 +58,7 @@ local tbl = { {"Trout","A flippy floppy fish!","test.png"}, {"Urine Bottles","Something you can craft with!","items/bottle_urine.png"}, {"Water Rune","Whenever you touch it, your hand feels slightly damp.","rune_water.png"}, + {"Welder","Something you can craft with!","test.png"}, {"Wood","Something you can craft with!","items/wood.png"}, {"Wrist Watch","See the time wherever you go!","test.png"}, } |
