diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2018-11-03 18:23:45 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2018-11-03 18:23:45 -0400 |
| commit | 28affa22541b9ef251707793f6b1c1a26d663592 (patch) | |
| tree | 622754894d75c74dc5e8516ccf184ad4bf328fef /gamemode/core/inventory | |
| parent | c639e7c7c6ab1595fdce39f56312e3d6a886bbe8 (diff) | |
| download | artery-28affa22541b9ef251707793f6b1c1a26d663592.tar.gz artery-28affa22541b9ef251707793f6b1c1a26d663592.tar.bz2 artery-28affa22541b9ef251707793f6b1c1a26d663592.zip | |
Started on new npc system
Started work on the new npc system
Diffstat (limited to 'gamemode/core/inventory')
| -rw-r--r-- | gamemode/core/inventory/cl_invtracker.lua | 23 | ||||
| -rw-r--r-- | gamemode/core/inventory/common/items.lua | 40 |
2 files changed, 23 insertions, 40 deletions
diff --git a/gamemode/core/inventory/cl_invtracker.lua b/gamemode/core/inventory/cl_invtracker.lua index e6633f9..2591e96 100644 --- a/gamemode/core/inventory/cl_invtracker.lua +++ b/gamemode/core/inventory/cl_invtracker.lua @@ -4,6 +4,7 @@ local inv = nrequire("inventory/inventory.lua") local itm = nrequire("item.lua") +local log = nrequire("log.lua") -- nrequire("cl_loadglobals.lua") --local state = nrequire("cl_state.lua") @@ -122,4 +123,26 @@ concommand.Add("PrintKnownInventories",function(ply,cmd,args) PrintTable(known_inventories) end) +---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 q.DropItem(ent_or_tbl,invid,frompos) + --[[ + if type(ent_or_tbl) == "table" then + drop_self(ent_or_tbl) + else + drop_provided(ent_or_tbl,invid,frompos) + end + ]] + assert(CLIENT,"requested to drop an item when we are not the client!") + log.debug("Drop item was requested, ent_or_tbl is" .. tostring(ent_or_tbl)) + net.Start("art_RequestInvDrop") + net.WriteEntity(ent_or_tbl) + net.WriteUInt(invid,32) + net.WriteTable(frompos) + net.SendToServer() +end + return q diff --git a/gamemode/core/inventory/common/items.lua b/gamemode/core/inventory/common/items.lua deleted file mode 100644 index 65d8e4a..0000000 --- a/gamemode/core/inventory/common/items.lua +++ /dev/null @@ -1,40 +0,0 @@ ----Some common functions for working with items. --- Just one function for now ---@shared items.lua ---@alias items - -local log = nrequire("log.lua") -local items = {} - --- local function drop_provided(ent,invid,frompos) --- assert(CLIENT,"requested to drop an item when we are not the client!") --- net.Start("art_RequestInvDrop") --- net.WriteEntity(ent) --- net.WriteUInt(invid,32) --- net.WriteTable(frompos) --- net.SendToServer() --- end - ----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 - drop_self(ent_or_tbl) - else - drop_provided(ent_or_tbl,invid,frompos) - end - ]] - assert(CLIENT,"requested to drop an item when we are not the client!") - log.debug("Drop item was requested, ent_or_tbl is" .. tostring(ent_or_tbl)) - net.Start("art_RequestInvDrop") - net.WriteEntity(ent_or_tbl) - net.WriteUInt(invid,32) - net.WriteTable(frompos) - net.SendToServer() -end - -return items |
