summaryrefslogtreecommitdiff
path: root/gamemode/itemsystem/loaditems.lua
blob: 225e56d26ae6f2ef5862643def176c87c359b293 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//Loads Loads all the items in the gamemode, these should go into gamemode/itemsystem/itmes folder.
//Also adds a console command gms_printrestable, that prints all the (base) resource tables and their values.
//Keep in mind that if an item has UniqueData set to true, it's instance may be different than that shown in gms_printrestable

GMS.Resources = {}

function GMS.RegisterResource( tbl )
  assert(tbl != nil,"Attempted to register a nil entity! This might be a bug!")
  assert(tbl.Name != nil,"Attempted to register an item with no name:")
  if(tbl.UniqueData) then
    tbl.UniqueDataID = -1
  end
	GMS.Resources[tbl.Name] = tbl
end

function GMS.GetResourceByName(name)
  assert(GMS.Resources[name] != nil, "Resource " .. name .. " does not exist! This might be a bug!")
  return GMS.Resources[name]
end

concommand.Add("gms_printrestable",function(ply,cmd,args)
  PrintTable(GMS.Resources)
end)