diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2018-03-23 15:20:30 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2018-03-23 15:20:30 -0400 |
| commit | d2868db28210b8c4debab2b70dca2833d582fdfd (patch) | |
| tree | 17ad5beb46e3b1c3c17d520a71a4c1ea12c47f51 /gamemode/config/sv_newplayer.lua | |
| parent | a7f7bed257dd96b1027c6343cd59eea4eee9fc3b (diff) | |
| download | artery-d2868db28210b8c4debab2b70dca2833d582fdfd.tar.gz artery-d2868db28210b8c4debab2b70dca2833d582fdfd.tar.bz2 artery-d2868db28210b8c4debab2b70dca2833d582fdfd.zip | |
Refactored the inventory system
Inventory system now uses flyweight pattern with metatables.
Diffstat (limited to 'gamemode/config/sv_newplayer.lua')
| -rw-r--r-- | gamemode/config/sv_newplayer.lua | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/gamemode/config/sv_newplayer.lua b/gamemode/config/sv_newplayer.lua index 1385bf5..229c11e 100644 --- a/gamemode/config/sv_newplayer.lua +++ b/gamemode/config/sv_newplayer.lua @@ -1,20 +1,31 @@ local np = {} local inv = nrequire("inventory/inventory.lua") +nrequire("inventorysystem/equipment/sh_equipment.lua") +nrequire("inventorysystem/shapedinventory/sh_shaped.lua") +nrequire("inventorysystem/prayers/sh_prayers.lua") +nrequire("inventorysystem/skills/sh_skills.lua") +nrequire("inventorysystem/quests/sh_quests.lua") +local log = nrequire("log.lua") --local itm = nrequire("inventory/item.lua") +local data = { + inventories = { + {"Equipment", inv.CreateInventory("Equipment"):Serialize()}, + {"Shaped Inventory",inv.CreateInventory("Shaped Inventory"):Serialize()}, + {"Prayers",inv.CreateInventory("Prayers"):Serialize()}, + {"Skills",inv.CreateInventory("Skills"):Serialize()}, + {"Quests",inv.CreateInventory("Quests"):Serialize()}, + }, +} + np.newdata = function() - return { - inventories = { - {"Equipment", inv.CreateInventory("Equipment"):Serialize()}, - {"Shaped Inventory",inv.CreateInventory("Shaped Inventory"):Serialize()}, - {"Prayers",inv.CreateInventory("Prayers"):Serialize()}, - {"Skills",inv.CreateInventory("Skills"):Serialize()}, - }, - quests = {}, - } + log.debug("newdata asked for") + log.debug(table.ToString(data,"data",true)) + return data end np.newmeta = function() + log.debug("newmeta asked for") return { lastserver = "67.163.245.187:27015", lastlocation = "-1209 1544 -1770" |
