summaryrefslogtreecommitdiff
path: root/gamemode/itemsystem/common_dropable.lua
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2016-05-22 14:18:52 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2016-05-22 14:18:52 -0400
commite014b7940d59c791c4a6e96ec27aa3232d3a39a1 (patch)
tree515ff14cf73b236d2159ea2703502abce0f3781f /gamemode/itemsystem/common_dropable.lua
parenteea3fcb40b4a52e5985859bf6bb77d3384d4d0f7 (diff)
downloadgmstranded-e014b7940d59c791c4a6e96ec27aa3232d3a39a1.tar.gz
gmstranded-e014b7940d59c791c4a6e96ec27aa3232d3a39a1.tar.bz2
gmstranded-e014b7940d59c791c4a6e96ec27aa3232d3a39a1.zip
Cleaned up the comments in the itemsystem
Diffstat (limited to 'gamemode/itemsystem/common_dropable.lua')
-rw-r--r--gamemode/itemsystem/common_dropable.lua25
1 files changed, 13 insertions, 12 deletions
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