aboutsummaryrefslogtreecommitdiff
path: root/gamemode/shared/loaditems.lua
blob: dba80e8937e8eb0c8093824381634471dba7b9d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
-- do return end
-- --[=[
-- --[[
--     This file loads in all the items
-- ]]
-- local concmd = include("concommands.lua")
-- --local autolua = include("../autolua.lua")
-- print("Hello from LoadItems.lua!")
-- ART.Items = {}
-- local requiredfields = {
--     "Name",
--     "Shape",
--     "Serialize",
--     "DeSerialize",
-- }
-- local defaultfields = {
--     ["Serialize"] = function(self) return "" end,
--     ["DeSerialize"] = function(self,string) return self end,
--     ["Shape"] = {{true}},
-- }
-- function ART.RegisterItem(tbl)
--     --print("Registering item:" .. tbl.Name)
--     for k,v in pairs(requiredfields) do
--         assert(tbl[v] ~= nil, "Attempted to register an item without field:" .. v)
--     end
--     assert(ART.Items[tbl.Name] == nil, "Attempted to register 2 items with the same name!")
--     for k,v in pairs(defaultfields) do
--         if tbl[k] == nil then
--             tbl[k] = v
--         end
--     end
--     ART.Items[tbl.Name] = tbl
--     --print("Art is now:")
--     --PrintTable(ART)
-- end
-- 
-- --autolua.AddLuaSHFolder("/shared/itemsystem")
-- 
-- function ART.GiveItem(player,name)
--     assert(ART.Items[name] ~= nil, "Attempted to give a nil item!")
--     player:GiveItem(ART.Items[name])
--     player:SynchronizeInventory()
-- end
-- 
-- function ART.GetItemByName(name)
--     assert(ART.Items[name] ~= nil,"Attempted to get a nil item:" .. name)
--     return ART.Items[name]
-- end
-- 
-- concommand.Add("artery_printitems",function(ply,cmd,args)
--     if not ply:IsAdmin() then return end
--     print("Items table:")
--     PrintTable(ART.Items)
-- end)
-- 
-- concommand.Add("artery_giveitem",function(ply,cmd,args)
--     if not ply:IsAdmin() then return end
--     print("Trying to give an item:" .. args[1])
--     ART.GiveItem(ply,args[1])
-- end, concmd.AutocompleteFunction(table.GetKeys(ART.Items)), "Give an item to the specified player, or yourself if no player is specified.")
-- ]=]