summaryrefslogtreecommitdiff
path: root/gamemode/items.lua
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2016-05-30 21:01:18 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2016-05-30 21:01:18 -0400
commitd62058fcdea5fc6736a2a373f47dc6c14c70c319 (patch)
tree79a1325190e3f1f1b6d6a2dbcdfc1ba3fa866ac9 /gamemode/items.lua
parentc38f00182ba6c282806eecb39a42e64d5feafa37 (diff)
downloadredead-d62058fcdea5fc6736a2a373f47dc6c14c70c319.tar.gz
redead-d62058fcdea5fc6736a2a373f47dc6c14c70c319.tar.bz2
redead-d62058fcdea5fc6736a2a373f47dc6c14c70c319.zip
Removed exessive whitespace so future commits will be cleaner
Diffstat (limited to 'gamemode/items.lua')
-rw-r--r--gamemode/items.lua64
1 files changed, 29 insertions, 35 deletions
diff --git a/gamemode/items.lua b/gamemode/items.lua
index 7b3a057..f3d802c 100644
--- a/gamemode/items.lua
+++ b/gamemode/items.lua
@@ -5,15 +5,15 @@ local ItemTables = {}
local ID = 1
function Register( tbl )
-
+
tbl.Functions = tbl.Functions or {}
tbl.ID = ID
ItemTables[ ID ] = tbl
-
+
util.PrecacheModel( tbl.Model )
-
+
ID = ID + 1
-
+
end
function GetList()
@@ -25,37 +25,37 @@ end
function GetByID( id )
if not id then return end
-
+
if !ItemTables[ id ] then return end
return ItemTables[ id ]
-
+
end
function GetByModel( model )
-
+
for k,v in pairs( ItemTables ) do
-
+
if string.lower( v.Model ) == string.lower( model ) or ( v.DropModel and string.lower( v.DropModel ) == string.lower( model ) ) then
-
+
return v
-
+
end
-
+
end
end
function GetByClass( class )
-
+
for k,v in pairs( ItemTables ) do
-
+
if v.TypeOverride and string.lower( v.TypeOverride ) == string.lower( class ) then
-
+
return v
-
+
end
-
+
end
end
@@ -63,13 +63,13 @@ end
function GetByName( name )
for k,v in pairs( ItemTables ) do
-
+
if string.lower( v.Name ) == string.lower( name ) then
-
+
return v
-
+
end
-
+
end
end
@@ -77,17 +77,17 @@ end
function GetByType( itemtype )
local tbl = {}
-
+
for k,v in pairs( ItemTables ) do
-
+
if v.Type == itemtype then
-
+
table.insert( tbl, v )
-
+
end
-
+
end
-
+
return tbl
end
@@ -98,19 +98,13 @@ function RandomItem( itemtype )
local tbl = GetByType( itemtype )
local rand = table.Random( tbl )
-
+
while math.Rand(0,1) < rand.Rarity do
-
+
rand = table.Random( tbl )
-
+
end
return rand
end
-
-
-
-
-
-