From 26f185f8f83667cb2a2d4dc45559ac91d0fcd36c Mon Sep 17 00:00:00 2001 From: Scott Date: Thu, 5 May 2016 22:42:51 -0400 Subject: Added medicine as a resource and added images to combinations menu --- content/materials/items/medicine.png | Bin 0 -> 702 bytes gamemode/client/cl_inventory.lua | 8 ++++---- gamemode/craftablesystem/playermade/medicine.lua | 1 + gamemode/itemsystem/items/medicine.lua | 19 +++++++++++++++++++ 4 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 content/materials/items/medicine.png create mode 100644 gamemode/itemsystem/items/medicine.lua diff --git a/content/materials/items/medicine.png b/content/materials/items/medicine.png new file mode 100644 index 0000000..c73c646 Binary files /dev/null and b/content/materials/items/medicine.png differ diff --git a/gamemode/client/cl_inventory.lua b/gamemode/client/cl_inventory.lua index 076dd2a..d3d10be 100644 --- a/gamemode/client/cl_inventory.lua +++ b/gamemode/client/cl_inventory.lua @@ -418,14 +418,14 @@ function PANEL:Init() surface.SetFont( "ButtonText" ) surface.SetTextColor( 255,255,255 ) - surface.SetTextPos( (slot:GetWide()/2) - ( surface.GetTextSize(k)/2 ), (slot:GetTall()/2) + (select( 2, surface.GetTextSize( k ) )/2) ) + surface.SetTextPos( (slot:GetWide()/2) - ( surface.GetTextSize(k)/2 ), (slot:GetTall()/2) + (select( 2, surface.GetTextSize( k ) )-5) ) surface.DrawText( v.Name ) end local img = vgui.Create("DImage", slot) - img:SetPos(0, 0) - img:SetSize(slot:GetWide(), slot:GetTall()-20) - img:SetImage("gms_icons/gms_weapon.png") + 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 i=i+1 diff --git a/gamemode/craftablesystem/playermade/medicine.lua b/gamemode/craftablesystem/playermade/medicine.lua index 223cc1c..998c1a2 100644 --- a/gamemode/craftablesystem/playermade/medicine.lua +++ b/gamemode/craftablesystem/playermade/medicine.lua @@ -2,6 +2,7 @@ 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/itemsystem/items/medicine.lua b/gamemode/itemsystem/items/medicine.lua new file mode 100644 index 0000000..7b178f8 --- /dev/null +++ b/gamemode/itemsystem/items/medicine.lua @@ -0,0 +1,19 @@ + +ITEM = {} + +ITEM.Name = "Medicine" +ITEM.Description = "Heals you!" +ITEM.Icon = "items/medicine.png" +ITEM.UniqueData = false + +local use_medicine = function(ln, player) + + LocalPlayer():ConCommand( "gms_takemedicine" ) + +end + +ITEM.Actions = {} +genericMakeDroppable(ITEM) +ITEM.Actions["Use"] = use_medicine + +GMS.RegisterResource(ITEM) \ No newline at end of file -- cgit v1.2.3-70-g09d2 From 39542102d1f601189a8a9f3b8163521adde97bf4 Mon Sep 17 00:00:00 2001 From: Scott Date: Thu, 5 May 2016 22:45:06 -0400 Subject: Change to combinations menu --- gamemode/client/cl_inventory.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/gamemode/client/cl_inventory.lua b/gamemode/client/cl_inventory.lua index d3d10be..598ca97 100644 --- a/gamemode/client/cl_inventory.lua +++ b/gamemode/client/cl_inventory.lua @@ -396,6 +396,7 @@ function PANEL:Init() local slot = vgui.Create("DButton", dpnl) slot:SetSize(dPanelWidth/5, 100) + slot:SetText("") slot:SetTooltip(createTooltipTextFor(v.Req)) slot.DoClick = function() --print("I want to combine a " .. v.Name) -- cgit v1.2.3-70-g09d2 From 45392b8691d82bafe1aa405c44ed7fe5808ca293 Mon Sep 17 00:00:00 2001 From: Scott Date: Thu, 5 May 2016 22:54:46 -0400 Subject: Added image to urine in combinations menu and 50x urine recipe --- gamemode/craftablesystem/playermade/urine.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/gamemode/craftablesystem/playermade/urine.lua b/gamemode/craftablesystem/playermade/urine.lua index aed7d35..ae05626 100644 --- a/gamemode/craftablesystem/playermade/urine.lua +++ b/gamemode/craftablesystem/playermade/urine.lua @@ -3,6 +3,7 @@ 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 @@ -17,6 +18,7 @@ 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 @@ -25,3 +27,19 @@ COMBI.Results = {} COMBI.Results["Urine Bottles"] = 10 GMS.RegisterCombi( COMBI, "Combinations" ) + +/* Urine 50x */ +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 + +COMBI.Results = {} +COMBI.Results["Urine Bottles"] = 50 + +GMS.RegisterCombi( COMBI, "Combinations" ) + -- cgit v1.2.3-70-g09d2