From e014b7940d59c791c4a6e96ec27aa3232d3a39a1 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Sun, 22 May 2016 14:18:52 -0400 Subject: Cleaned up the comments in the itemsystem --- gamemode/itemsystem/common_dropable.lua | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'gamemode/itemsystem/common_dropable.lua') diff --git a/gamemode/itemsystem/common_dropable.lua b/gamemode/itemsystem/common_dropable.lua index 046d628..b77b336 100644 --- a/gamemode/itemsystem/common_dropable.lua +++ b/gamemode/itemsystem/common_dropable.lua @@ -1,10 +1,11 @@ ---Adds a function to to allow the player to drop this item, in quantities of 1, half, all, or X, which brings up a menu asking the player how many they would like to drop --[[ - genericMakeDroppable(ITEM) + Provides: + genericMakeDroppable(table_item) + Adds a function to to allow the player to drop this item, in quantities of 1, half, all, or X, which brings up a menu asking the player how many they would like to drop ]] function genericMakeDroppable(tbl) - if(SERVER) then return end + if (SERVER) then return end local drop1 = function(player) genericDropResource(player,tbl.Name,1) end @@ -12,10 +13,10 @@ function genericMakeDroppable(tbl) genericDropResource(player,tbl.Name,Resources[tbl.Name]) end local drophalf = function(player) - genericDropResource(player,tbl.Name,math.ceil(Resources[tbl.Name]/2.0)) + genericDropResource(player,tbl.Name,math.ceil(Resources[tbl.Name] / 2.0)) end local dropx = function(player) - if(SERVER) then return end + if (SERVER) then return end local frame = vgui.Create( "DFrame" ) frame:SetSize( 400, 60 ) frame:Center() @@ -26,16 +27,16 @@ function genericMakeDroppable(tbl) TextEntry:SetSize( 360, 20 ) TextEntry:SetText( "Number to drop:" ) TextEntry.OnEnter = function( self ) - if(tonumber(self:GetValue(),10) == nil) then return end + if (tonumber(self:GetValue(),10) == nil) then return end genericDropResource(player,tbl.Name,self:GetValue()) frame:Close() end end - if(tbl.Actions == nil) then + if (tbl.Actions == nil) then tbl.Actions = {} end - if(tbl.Actions["Drop"] == nil) then + if (tbl.Actions["Drop"] == nil) then tbl.Actions["Drop"] = {} end tbl.Actions["Drop"]["Drop 1"] = drop1 @@ -45,18 +46,18 @@ function genericMakeDroppable(tbl) end -if(SERVER) then +if (SERVER) then util.AddNetworkString( "gms_dropresources" ) end function genericDropResource(player, resource, ammount) - if(CLIENT) then + if (CLIENT) then net.Start("gms_dropresources") net.WriteString(resource) net.WriteInt(ammount,GMS.NETINT_BITCOUNT) net.SendToServer() end - if(SERVER) then - if(player.Resources[resource] < ammount) then + if (SERVER) then + if (player.Resources[resource] < ammount) then player:SendMessage("You don't have that many to drop!", 3, Color(255, 255, 255, 255)) return end -- cgit v1.2.3-70-g09d2