diff options
| -rw-r--r-- | config.ld | 16 | ||||
| -rw-r--r-- | gamemode/client/cl_inventory.lua | 11 | ||||
| -rw-r--r-- | gamemode/core/clienteffects/cl_effects.lua | 8 | ||||
| -rw-r--r-- | gamemode/core/clienteffects/sv_effects.lua | 8 | ||||
| -rw-r--r-- | gamemode/core/combat/cl_weaponswing.lua | 4 | ||||
| -rw-r--r-- | gamemode/core/combat/sv_weaponswing.lua | 22 | ||||
| -rw-r--r-- | gamemode/core/database/sv_queries.lua | 17 | ||||
| -rw-r--r-- | gamemode/core/database/sv_setup.lua | 28 | ||||
| -rw-r--r-- | gamemode/core/dataloader/sv_loadglobals.lua | 12 | ||||
| -rw-r--r-- | gamemode/core/inventory/common/items.lua | 9 | ||||
| -rw-r--r-- | gamemode/core/inventory/common/weapons.lua | 15 | ||||
| -rw-r--r-- | gamemode/core/inventory/inventory.lua | 22 | ||||
| -rw-r--r-- | gamemode/core/inventory/item.lua | 18 | ||||
| -rw-r--r-- | gamemode/core/inventory/sv_invtracker.lua | 65 | ||||
| -rw-r--r-- | gamemode/core/mapstich/sv_mapstich.lua | 7 | ||||
| -rw-r--r-- | gamemode/core/npc/sv_huntingspawner.lua | 2 | ||||
| -rw-r--r-- | gamemode/core/npc/sv_npcsystem.lua | 7 | ||||
| -rw-r--r-- | gamemode/core/pac/sv_pac.lua | 4 |
18 files changed, 244 insertions, 31 deletions
@@ -14,3 +14,19 @@ format = 'markdown' sort_modules = true new_type("domain","Domain") new_type("concommand","Console commands", false, ...) +new_type("metamethod","Meta Methods", false) +custom_tags = { + {'reqadmin', hidden=false}, + {'domain', hidden=false} +} + +custom_display_name_handler = function(item,default_handeler) + if item.type == "function" then + if item.tags.reqadmin then + return item.name .. "<strong>Requires Admin</strong>" + elseif item.tags.domain then + return item.name .. "Domain:" + end + end + return default_handeler(item) +end diff --git a/gamemode/client/cl_inventory.lua b/gamemode/client/cl_inventory.lua index 2135fc4..105f1b3 100644 --- a/gamemode/client/cl_inventory.lua +++ b/gamemode/client/cl_inventory.lua @@ -1,6 +1,7 @@ ---[[ - Displays the inventory, for more information see /gamemode/shared/inventory.lua -]] +---Functions for hiding and showing inventory panels. +-- Deals with most the the things needed for inventory panels +--@module cl_inventory.lua + --[[ Reserved inventory id's 1 - Equipment @@ -100,6 +101,8 @@ local function BuildInventory() CreateSheetTree(clt.known_inventories,initalsheet) end +---Shows the player's inventory. +-- If the player's inventory hasn't been built yet, builds the inventory, then displays it. function inv.ShowInventory() --print("qframe is ", qframe) if not qframe then BuildInventory() @@ -119,6 +122,8 @@ function inv.ShowInventory() end,{}) end +---Hides the players inventory. +-- If the player's inventory is already hidden, does nothing function inv.HideInventory() droppanel:Remove() state.invopen = false diff --git a/gamemode/core/clienteffects/cl_effects.lua b/gamemode/core/clienteffects/cl_effects.lua index 368c34a..db84b24 100644 --- a/gamemode/core/clienteffects/cl_effects.lua +++ b/gamemode/core/clienteffects/cl_effects.lua @@ -1,7 +1,15 @@ +---A registry of client-side effects. +-- Use this to register effects to be called with sv_effects.lua +--@module cl_effects.lua + local log = nrequire("log.lua") local er = {} --master table of effects local effects = {} +---Register an effect. +-- Registers an effect that can later be applied to the player +--@tparam string name The name of the effect +--@tparam function func The function to call when the effect is applied function er.RegisterEffect(name,func) if effects[name] ~= nil then log.warn("Effect \"" .. name .. "\" already registered, replaceing...") diff --git a/gamemode/core/clienteffects/sv_effects.lua b/gamemode/core/clienteffects/sv_effects.lua index cc3039f..d364068 100644 --- a/gamemode/core/clienteffects/sv_effects.lua +++ b/gamemode/core/clienteffects/sv_effects.lua @@ -1,6 +1,14 @@ +---A way to apply effects on players. +-- Also see cl_effects.lua +--@module sv_effects.lua local ed = {} +---Apply an effect to the player. +-- Send a message to a player, saying they should have an effects +--@tparam player ply The player to apply the effect to +--@tparam string name The name of the effect to apply +--@tparam string data Data to send for the effect (can be "") function ed.SendEffect(ply,name,data) net.Start("art_clienteffect") local dlen = #data diff --git a/gamemode/core/combat/cl_weaponswing.lua b/gamemode/core/combat/cl_weaponswing.lua index ec5b954..7f2c927 100644 --- a/gamemode/core/combat/cl_weaponswing.lua +++ b/gamemode/core/combat/cl_weaponswing.lua @@ -82,6 +82,10 @@ net.Receive("artery_doanimation",function() end) end) +---Force the player to do an animation. +-- The animation must have been already registered to animbonelib  +--@usage artery_startanimation <animation name> +--@concommand artery_startanimation concommand.Add("artery_startanimation",function(ply,cmd,args) if not ply:IsAdmin() then return end swingtbl = {} diff --git a/gamemode/core/combat/sv_weaponswing.lua b/gamemode/core/combat/sv_weaponswing.lua index 2d45d31..b02c8fc 100644 --- a/gamemode/core/combat/sv_weaponswing.lua +++ b/gamemode/core/combat/sv_weaponswing.lua @@ -1,3 +1,6 @@ +---Automatically re-calculates swing arcs for weapons. +-- This files helps you create mele weapons that need to be swung +--@module sv_weaponswing.lua --[[ This file tells you what weapons need their swings recalculated ]] @@ -41,6 +44,9 @@ net.Receive("artery_notifyserverofswing",function() file.Write("artery/dynamic/swingdata/" .. weapon .. ".txt",util.Compress(util.TableToJSON(olddata))) end) +---Make a weapons swingable. +-- Make a new weapon that needs swing arcs, this function checks to make sure the table has a .Name, .attacks, and .pacname +--@tparam swingitem tbl A swingable item. function ws.makeSwingable(tbl) --print("Makeing a swingable out of:") --PrintTable(tbl) @@ -50,6 +56,11 @@ function ws.makeSwingable(tbl) swingable[tbl.Name] = tbl end +---Actually swings a weapon. +-- Makes a player swing their weapon, and dammages anything in the swing arc +--@tparam swingitem The item the player swung +--@tparam player ply The player swinging the weapon +--@tparam function callback The function to call when the swing arc hit something. function ws.doSwing(weapon,ply,callback) local dir = wep.playermovedir(ply) local fdata = file.Read("artery/dynamic/swingdata/" .. weapon.Name .. ".txt") @@ -92,7 +103,9 @@ function ws.doSwing(weapon,ply,callback) end) end ---Create a fake thing in front of the player, do the swing animations, and record them. +---Records animations for swingables. +-- Records the player doing swings  +--@concommand artery_Recordanimations concommand.Add("artery_recordanimations",function(ply,cmd,args) if not ply:IsAdmin() then return end local e = ply @@ -162,7 +175,9 @@ concommand.Add("artery_recordanimations",function(ply,cmd,args) end) - +---Command to check that all swingable weapons have been recorded. +-- Check the console for output +--@concommand artery_checkSwingable concommand.Add("artery_checkSwingable",function(ply,cmd,args) local nitms = 0 local noswingdata = {} @@ -180,6 +195,9 @@ concommand.Add("artery_checkSwingable",function(ply,cmd,args) print("Scanned ",nitms,"swingable items, could not find data for:\n\t",table.concat(noswingdata,"\n\t")) end) +---Clears the swingable cache, usefull for developers. +-- Clears the list of items the gamemode knows about that are swingable  +--@concommand artery_clearswingable concommand.Add("artery_clearswingable",function(ply,cmd,args) if not ply:IsAdmin() then return end swingable = {} diff --git a/gamemode/core/database/sv_queries.lua b/gamemode/core/database/sv_queries.lua index 6ef1201..3c5f309 100644 --- a/gamemode/core/database/sv_queries.lua +++ b/gamemode/core/database/sv_queries.lua @@ -1,12 +1,15 @@ ---[[ - Some helper functions for building sql queries -]] +---Helper functions for saveing and loading players. +-- Defines functions for saveing/loading the player +--@module sv_queries.lua local fn = nrequire("utility/fn.lua") local track = nrequire("core/inventory/sv_invtracker.lua") local log = nrequire("log.lua") local q = {} +---Creats a string representation of a player. +-- The string can be used to re-create the player's data with teh deserialize_player function +--@tparam player ply The player to serialize function q.serialize_player(ply) if not IsValid(ply) and ply.data and ply.data.inventories then return "" end local sdata = {} @@ -24,6 +27,10 @@ function q.serialize_player(ply) return ret end +---Loads a player from a serialized string. +-- Loads a player's data form the string given. The string can be created with the serialize_player() function +--@tparam player ply The player to load data for +--@tparam string str The string representation of the data function q.deserialize_player(ply,str) log.debug("Deserializing player's data : " .. ply:Nick() .. "\n" .. str) track.ClearInventories(ply) @@ -49,6 +56,10 @@ function q.deserialize_player(ply,str) track.SendPlayerData(ply) end +---Formats for an sql query. +-- Kind of like string.format, but arguments are pasesd through SQL sanitization  +--@tparam string fmt The string.format function +--@tparam varargs ... The parameters to format the string with function q.s_fmt(fmt,...) local args = {...} fn.map(args,MySQLite.SQLStr) diff --git a/gamemode/core/database/sv_setup.lua b/gamemode/core/database/sv_setup.lua index 1fac11f..3fa1823 100644 --- a/gamemode/core/database/sv_setup.lua +++ b/gamemode/core/database/sv_setup.lua @@ -1,3 +1,7 @@ +---Functions for working the the mysqlite module. +-- Helps load players into their correct instance +--@module sv_setup.lua + --Adds the MySQLite global nrequire("sv_mysqlite.lua") local config = nrequire("config/sv_sql.lua") @@ -46,8 +50,10 @@ hook.Add("Initialize","initalizedbconnection",function() connect() end) - ---Retruns (PlayerData, MetaData) or nil +---Gets a player's data from the database. +-- Finds a player's data, returns nil if not found. Players are found off their steamid +--@tparam player ply The player to look for's data +--@treturn table|nil {PlayerData, MetaData} function sql.GetPlayerData(ply) local s64 = ply:SteamID64() local q_str = q.s_fmt(fetch_player_query,s64) @@ -82,11 +88,18 @@ function sql.GetPlayerData(ply) MySQLite.query(q_str,q_suc,q_fai) end +---Manually loads data for the caller. +-- Forefully loads a player's data.  +--@concommand artery_loadplayer concommand.Add("artery_loadplayer",function(ply,cmd,args) if not ply:IsAdmin() then return end sql.GetPlayerData(ply) end) +---Creates a new row for the player in the database. +-- Creates a new row for a player, works off the configuration in sv_newplayer.lua +--@see sv_newplayer.lua +--@tparam player ply The player to create the new row for function sql.CreatePlayerTable(ply) --print("Createing player table....") local s64 = ply:SteamID64() @@ -110,6 +123,11 @@ function sql.CreatePlayerTable(ply) MySQLite.query(q_str,q_suc,q_fai) end +---Sends a player to another server. +-- Usually when a player disconnects, their location & server are saved, this overrides that and sends them to another instance when they reconnect. +--@tparam player ply The player to send to a different instace +--@tparam string ls The server to send the player to +--@tparam vector3 ll The location to send the player to on that server function sql.SendPlayerToInstance(ply,ls,ll) local s64 = ply:SteamID64() local plydata = q.serialize_player(ply) @@ -124,7 +142,11 @@ function sql.SendPlayerToInstance(ply,ls,ll) MySQLite.query(q_str,q_suc,q_fai) end -concommand.Add("DoQuery",function(ply,cmd,args) +---Do queries related to the player creation. +-- Create the caller's data, Reload the coller's data, or Send the caller to another instance  +--@usage artery_DoQuery (create|get|send <server> <location>) +--@concommand artery_DoQuery +concommand.Add("artery_DoQuery",function(ply,cmd,args) if not ply:IsAdmin() then return end if args[1] == "create" then sql.CreatePlayerTable(ply) diff --git a/gamemode/core/dataloader/sv_loadglobals.lua b/gamemode/core/dataloader/sv_loadglobals.lua index 7689c54..bb74572 100644 --- a/gamemode/core/dataloader/sv_loadglobals.lua +++ b/gamemode/core/dataloader/sv_loadglobals.lua @@ -1,3 +1,7 @@ +---Loads code from the data directory. +-- Simple data loader, loads code from the data directory, sv_* files only get loaded server side, cl_* files only get loaded client-side, other files are loaded shared +--@module sv_loadglobals.lua + print("Load globals called") local log = nrequire("log.lua") local function ExecuteOnFolder(dir, recursive, func) @@ -109,10 +113,18 @@ net.Receive("artery_requestcsfile",function(ln,ply) net.WriteString(toload[which]) net.Send(ply) end) + +---Reloads client-side files. +-- Reloads all files that have been downloaded client side, does not re-download files. +--@concommand artery_reloadglobals_cs concommand.Add("artery_reloadglobals_cs",function(ply,cmd,args) load_cs_files(ply) state = "loading_cl" end) + +---Reloads all global/ files on all clients. +-- Tells all clients to reload their client-side files, and reloads server-side files.  +--@concommand artery_reloadglobals concommand.Add("artery_reloadglobals",function(ply,cmd,args) if not ply:IsAdmin() then return end loadglobals() diff --git a/gamemode/core/inventory/common/items.lua b/gamemode/core/inventory/common/items.lua index 868d940..a7a1858 100644 --- a/gamemode/core/inventory/common/items.lua +++ b/gamemode/core/inventory/common/items.lua @@ -1,3 +1,6 @@ +---Some common functions for working with items. +-- Just one function for now +--@module items.lua local items = {} @@ -10,7 +13,11 @@ local items = {} -- net.SendToServer() -- end ---Client requests the item be droped from the ent, invid, and inv position +---Drops an item. +-- Client side only, will error if you try to use it server side +--@tparam entity ent_or_tbl the entity that wants to drop the item +--@tparam number invid The inventory number the entity wants to drop from +--@tparam table frompos The position in the inventory the item was in. function items.DropItem(ent_or_tbl,invid,frompos) --[[ if type(ent_or_tbl) == "table" then diff --git a/gamemode/core/inventory/common/weapons.lua b/gamemode/core/inventory/common/weapons.lua index 0a86f00..3ced3b1 100644 --- a/gamemode/core/inventory/common/weapons.lua +++ b/gamemode/core/inventory/common/weapons.lua @@ -1,6 +1,6 @@ ---[[ - Some common functionality that many weapons need -]] +---Common functionality used in a lot of weapons. +-- Bits an peices that most weapons need +--@module weapons.lua local com = {} @@ -25,7 +25,7 @@ end --- The arc swing of a weapon. -- Finds anything that a weapon should hit in it's swing, and calls a function on it. -- @param player The player that's swinging the weapon --- @param tiems A table of times that the trace calculations should be done at, this table needs to be the same length as the positions table +-- @param times A table of times that the trace calculations should be done at, this table needs to be the same length as the positions table -- @param positions The position offsets from the player that swung that should be the start/end points of the arc -- @param onhit A function to call on any entities that were hit in the swing of the weapon. function com.swingarc(player,times,positions,onhit) @@ -62,8 +62,11 @@ function com.swingarc(player,times,positions,onhit) end) end ---Creates a table of ["forward|backward|left|right"] = function() ---When called, the function does an attack. +---Creates a new attack table +-- Creates a table of ["forward|backward|left|right"] = function() +-- This is done before hand so that table is not re-generated on the fly each time a player attacks +--@tparam attacktbl tbl_attackdata The attack data to use +--@tparam entity attacker The entity attacking function com.createattackstable(tbl_attackdata,attacker) local movementtbl = {} for k,v in pairs(tbl_attackdata) do diff --git a/gamemode/core/inventory/inventory.lua b/gamemode/core/inventory/inventory.lua index 4624819..69e8181 100644 --- a/gamemode/core/inventory/inventory.lua +++ b/gamemode/core/inventory/inventory.lua @@ -1,3 +1,7 @@ +---The main file needed to register create new inventory types. +-- Helps you register inventories that work with the rest of artery +--@module inventory.lua + --[[ Public functions: RegisterInventory(tbl_inventory) ::nil @@ -111,6 +115,10 @@ local required_fields = { {"Serialize","function"}, {"DeSerialize","function"}, } +---Registers a new inventory. +-- Register a new inventory prototype from the table passed in +--@see invtbl +--@tparam invtbl tbl The table inventory function inv.RegisterInventory(tbl) assert(type(tbl) == "table", "Attempted to register inventory that was not a table") @@ -136,7 +144,11 @@ function inv.RegisterInventory(tbl) --print("Registered inventory: " .. tbl.Name) end ---Create an inventory +---Create an inventory. +-- Creates a new inventory that you can give to an item. +-- Consider carefully if you want to use this method, or the CreateInventoryFromData method. +--@see invtbl +--@tparam string name The name of the inventory type when it was registered function inv.CreateInventory(name) --print("Createing inventory", name) assert(inventories[name] ~= nil, string.format("Tried to create a copy of inventory that does not exist:%s\nValid inventories are:\n\t%s",name,table.concat(table.GetKeys(inventories),"\n\t"))) @@ -145,7 +157,11 @@ function inv.CreateInventory(name) return ret end ---Recreates an inventory from data +---Creates an inventory from data. +-- This is what you useually want to use when createing inventories +--@tparam string name The name of the inventory type you want to instanciate +--@tparam string data The data the inventory needs to deserialize, most inventories will work if this is empty +--@tparam entity owner The owning entity of this inventory, does not have to be a player (ex when createing crates players can put items into) function inv.CreateInventoryFromData(name,data,owner) local tinv = inv.CreateInventory(name) tinv.Owner = owner @@ -158,7 +174,7 @@ function inv.CreateInventoryFromData(name,data,owner) return ret end ---Must be called in a coroutine. +---To Be Depriciated. function inv.DeriveInventory(name) while inventories[name] == nil do coroutine.yield() diff --git a/gamemode/core/inventory/item.lua b/gamemode/core/inventory/item.lua index 2eb2fb3..1e6a0cf 100644 --- a/gamemode/core/inventory/item.lua +++ b/gamemode/core/inventory/item.lua @@ -1,3 +1,6 @@ +---The main module to use when createing new items. +-- Registers items that will work with the inventory system +--@module item.lua --[[ An itemsystem public functions: @@ -25,6 +28,11 @@ local required_fields = { } local items = items or {} --Master table of all item prototypes + +---Registers an item. +-- Registers an item that can be gotten later. It usually dosn't make sense for only parts of the level to have an item (the player probably can travel between all the parts of your world with the item in their inventory), therefore you should make sure items are loaded globally. +--@see itemtbl +--@tparam table tbl The table to register for the item prototype function itm.RegisterItem(tbl) for k,v in pairs(required_fields) do assert(tbl[v] ~= nil, string.format("Attempted to register item without field %q",v)) @@ -39,6 +47,10 @@ function itm.RegisterItem(tbl) --print("Registered item: " .. tbl.Name) end +---Gets an instance of an item. +-- Gets an instanced copy of an item registered with RegisterItem() +--@tparam string name The name of the item +--@treturn itemtbl item The item function itm.GetItemByName(name) assert(type(name) == "string",string.format("Attempted to get an item by name with a %s.",type(name))) assert(items[name] ~= nil,string.format("Attempted to get item with invalid name %q Valid item names are:\n\t%s",name,table.concat(table.GetKeys(items),"\n\t"))) @@ -51,6 +63,10 @@ function itm.GetItemByName(name) return item end +---Gets an item, with data. +-- Just gets the item, then calls DeSerialize(), returning whatever deserialize returned +--@tparam string name The name of the item +--@tparam string data The data to instantiate the item with function itm.GetItemFromData(name,data) assert(items[name] ~= nil,string.format("Attempted to get item with invalid name %q",name)) return items[name]:DeSerialize(data) @@ -64,7 +80,7 @@ local function printitems() print(table.concat(tbl,"\n")) end ---Must be called in a coroutine. +---To be depriciated. function itm.DeriveItem(tbl,name) print("Attempting to derive item",name) while items[name] == nil do diff --git a/gamemode/core/inventory/sv_invtracker.lua b/gamemode/core/inventory/sv_invtracker.lua index 310af0f..67e32a1 100644 --- a/gamemode/core/inventory/sv_invtracker.lua +++ b/gamemode/core/inventory/sv_invtracker.lua @@ -1,3 +1,7 @@ +---Utilities to help deal with inventories. +-- Helps you display, manage, and manipulate inventories +--@module sv_invtracker.lua + --[[ some accessability functions ]] @@ -57,6 +61,10 @@ net.Receive("art_RequestInvMove",function(len,ply) toinv:Put(topos,item) end) +---Drops an item at the position. +-- Creates a droped item at the given position, gives the player that walks over it the item. +--@tparam itmtbl item The item to drop +--@tparam vector3 pos The position to drop the item function track.DropItem(item,pos) local e = ents.Create("art_droppeditem") e.Item = {Name = item.Name, Data = item:Serialize()} @@ -100,11 +108,16 @@ net.Receive("art_RequestInvDrop",function(len,ply) track.DropItem(item,placetodrop) end) +---To be depriciated. +-- Also broken function track.ClearInventories(ply) ply.data = {} end ---Updates the client side inventory whenever the inventory is updated server side +---Updates clients. +-- Updates the clients, to let them know an inventory was manipulated whenever the server-side representation was manipulated +--@tparam player ply The player we want to provide the updates to +--@tparam number invid The inventory number on the player we want to provide the updates to function track.MakeInventoryObserver(ply,invid) print("Making observer...") local observer = {} @@ -133,6 +146,10 @@ function track.MakeInventoryObserver(ply,invid) return observer end +---Tell a player to display an inventory. +-- Tells a player they should display an inventory, and to expect changes to the inventory. +--@tparam player ply The player we want to see the inventory +--@tparam invtbl tinv The inventory we want the player to see function track.NotifyPlayerOfInventory(ply,tinv) local initaldat = tinv:Serialize() net.Start("art_ObserveInventory") @@ -146,6 +163,12 @@ function track.NotifyPlayerOfInventory(ply,tinv) net.Send(ply) end +---Gives an inventory to a player. +-- Gives a new inventory type to a player +--@see inventory_higharchy +--@tparam entity ply The player to give an inventory to +--@tparam string name The name of the inventory to give +--@tparam table|nil higharchy The higharchy where to put the table function track.GiveInventoryTo(ply,name,higharchy) local hi = higharchy or {} local i = inv.CreateInventory(name) @@ -167,6 +190,13 @@ function track.GiveInventoryTo(ply,name,higharchy) net.Send(ply) end +---Gives an inventory to a palyer & deserializes data. +-- Gives an inventory to a player, and then deserializes it with some data. +--@see inventory_higharchy +--@tparam entity ply The player to give the inventory to +--@tparam string name The name of the inventory to give +--@tparam string data The data to deserialize the inventory with +--@tparam table|nil higharchy The spot in the higharchy to place the inventory. function track.GiveInventoryWithData(ply,name,data,higharchy) local hi = higharchy or {} print("Giveing inventory with data") @@ -197,9 +227,12 @@ end ---A shortcut for finding if a player has an item local plymeta = FindMetaTable("Player") - +---A shortcut to check if a player has an item. +-- Checks if a player has an item +--@metamethod player:HasItem(str) +--@tparam string str The name of the item to look for +--@treturn table|false Returns the position if the player has the item, false if they don't function plymeta:HasItem(str) for k,v in pairs(self.data.inventories) do local p = v:Has(str) @@ -210,6 +243,11 @@ function plymeta:HasItem(str) return false end +---A shortcut to remove an item from a player. +-- Removes an item from a player and returns the item +--@metamethod plymeta:RemoveItem(tbl) +--@tparam table tbl The position the item is in (returned by plymeta:HasItem()) +--@treturn itemtbl The item that was removed function plymeta:RemoveItem(tbl) print("Got remove table, it was",tbl) PrintTable(tbl) @@ -222,6 +260,11 @@ function plymeta:RemoveItem(tbl) return item end +---A shortcut for giving an item to a player. +-- Gives an item to a player +--@metamethod plymeta:GiveItem(tbl) +--@param itemtbl tbl The item to give the player +--@raises "Uanble to find place to put item" Raises an exception if we cannot find a location to put the item. function plymeta:GiveItem(tbl) for k,v in pairs(self.data.inventories) do local p = v:FindPlaceFor(tbl) @@ -236,10 +279,14 @@ function plymeta:GiveItem(tbl) error("Unable to find place to put item") end +---Gets a player's credits. +-- To be depriciated function plymeta:GetCredits() return self.data.credits end +---Sets a player's credits. +-- To be depriciated function plymeta:SetCredits(num) print("Set credits called") self.data.credits = num @@ -250,6 +297,8 @@ function plymeta:SetCredits(num) net.Send(self) end +---Sends a player's data. +-- To be depriciated function track.SendPlayerData(ply) net.Start("art_load_player_data") net.WriteTable({ @@ -264,15 +313,25 @@ end -- track.SendPlayerData(ply) -- end) +---Prints a player's inventory to the console. +--@concommand artery_ShowMyInventories concommand.Add("artery_ShowMyInventories",function(ply,cmd,args) PrintTable(ply.data.inventories) end) +---Gives an inventory to a player. +-- Gives a new inventory to a player  +--@usage artery_AddInventory <inventory name> +--@concommand artery_AddInventory concommand.Add("artery_AddInventory",function(ply,cmd,args) if not ply:IsAdmin() then return end track.GiveInventoryTo(ply,args[1]) end) +---Gives an item to the player. +-- Gives a new item to the player  +--@usage artery_GiveItem <item name> +--@concommand artery_GiveItem concommand.Add("artery_GiveItem",function(ply,cmd,args) if not ply:IsAdmin() then return end xpcall(function() diff --git a/gamemode/core/mapstich/sv_mapstich.lua b/gamemode/core/mapstich/sv_mapstich.lua index 91b4ec2..5fd8129 100644 --- a/gamemode/core/mapstich/sv_mapstich.lua +++ b/gamemode/core/mapstich/sv_mapstich.lua @@ -1,3 +1,7 @@ +---Bits to help with transfering players. +-- Transfers players between areas when they hit a art_serverchange zone +--@module sv_mapstich.lua + --Make sure zones are loaded already nrequire("sv_mysqlite.lua") if not nrequire("sh_zones.lua") then return end @@ -39,6 +43,9 @@ local function SavePlayerData(ply) end) end +---Saves the player. +-- Saves the player as if they had disconnected, or transfered to another level +--@concommand artery_saveplayer concommand.Add("artery_saveplayer",function(ply,cmd,args) SavePlayerData(ply) end) diff --git a/gamemode/core/npc/sv_huntingspawner.lua b/gamemode/core/npc/sv_huntingspawner.lua index 0fe4aa0..f86fb59 100644 --- a/gamemode/core/npc/sv_huntingspawner.lua +++ b/gamemode/core/npc/sv_huntingspawner.lua @@ -1,4 +1,4 @@ ----Lets huntable monsters drop loot! +---Lets huntable monsters drop loot. -- Register what monsters drop what loot --@module sv_huntingspawner.lua diff --git a/gamemode/core/npc/sv_npcsystem.lua b/gamemode/core/npc/sv_npcsystem.lua index 0ed21d2..ac8ddc0 100644 --- a/gamemode/core/npc/sv_npcsystem.lua +++ b/gamemode/core/npc/sv_npcsystem.lua @@ -120,7 +120,7 @@ hook.Add("InitPostEntity", "artery_spawnmapnpcs", function() loadMap() end) ----Reloads the entities on the map +---Reloads the entities on the map. -- Removes and then reload all of the entities on the level  --@concommand artery_reloadmap concommand.Add("artery_reloadmap", function(ply,cmd,args) @@ -136,9 +136,10 @@ concommand.Add("artery_reloadmap", function(ply,cmd,args) loadMap() end) ----Create a new npc +---Create a new npc. -- Creates a new npc a the point the player is looking  ---@concommand artery_makenpc <npc_name> +--@usage artery_makenpc <npc_name> +--@concommand artery_makenpc concommand.Add("artery_makenpc", function(ply, cmd, args) if not ply:IsAdmin() then return end local na = args[1] diff --git a/gamemode/core/pac/sv_pac.lua b/gamemode/core/pac/sv_pac.lua index 0764162..d06ef35 100644 --- a/gamemode/core/pac/sv_pac.lua +++ b/gamemode/core/pac/sv_pac.lua @@ -132,8 +132,8 @@ function p3.RemovePac(what, name) net.Broadcast() end ----Find the pacs applied to an entity --- Find all the pacs applied to a certain entity. +---Find the pacs applied to an entity. +-- Returns an array of the names of all the pacs applied to a certain entity function p3.GetPacs(what) return appliedpacs[what] or {} end |
