--- Holds the data new players should be spawned with. -- If new inventories central to the gamemode are added, -- players should probably spawn with them. Add the -- inventory to np.data. --@server sv_newplayer.lua --@alias np local np = {} local inv = nrequire("inventory/inventory.lua") nrequire("inventorysystem/equipment/sh_equipment.lua") nrequire("inventorysystem/shapedinventory/sh_shaped.lua") nrequire("inventorysystem/abilities/sh_abilities.lua") nrequire("inventorysystem/skills/sh_skills.lua") nrequire("inventorysystem/quests/sh_quests.lua") local log = nrequire("log.lua") --local itm = nrequire("inventory/item.lua") --- The data that players spawn with. -- @table data -- @field inventories -- @usage -- local np = nrequire("config/sv_newplayer.lua") -- local inv = nrequire("inventory/inventory.lua") -- local invtbl = np.data.inventories -- invtbl[#invtbl + 1] = {"My New Inventory",inv.CreateInventory("MyInventory"):Serialize()} np.data = { inventories = { {"Equipment", inv.CreateInventory("Equipment"):Serialize()}, {"Shaped Inventory",inv.CreateInventory("Shaped Inventory"):Serialize()}, {"Abilities",inv.CreateInventory("Abilities"):Serialize()}, {"Skills",inv.CreateInventory("Skills"):Serialize()}, {"Quests",inv.CreateInventory("Quests"):Serialize()}, }, } --- Function called with a new player needs default data. -- By default, this function just returns np.data -- You can overwrite it to return any other table though. -- @treturn table The new data to return np.newdata = function() log.debug("newdata asked for") log.debug(table.ToString(np.data,"data",true)) return np.data end --- Function to return metadata for a player. -- This just returns a server and location for the player to spawn. np.newmeta = function() log.debug("newmeta asked for") return { lastserver = "67.163.245.187:27015", lastlocation = "-1209 1544 -1770" } end return np