aboutsummaryrefslogtreecommitdiff
path: root/gamemode/core
diff options
context:
space:
mode:
Diffstat (limited to 'gamemode/core')
-rw-r--r--gamemode/core/editor/editor.lua3
-rw-r--r--gamemode/core/inventory/common/items.lua2
-rw-r--r--gamemode/core/inventory/inventory.lua7
-rw-r--r--gamemode/core/inventory/sv_invtracker.lua1
-rw-r--r--gamemode/core/pac/cl_pac.lua18
-rw-r--r--gamemode/core/pac/sv_pac.lua10
6 files changed, 29 insertions, 12 deletions
diff --git a/gamemode/core/editor/editor.lua b/gamemode/core/editor/editor.lua
new file mode 100644
index 0000000..23c5991
--- /dev/null
+++ b/gamemode/core/editor/editor.lua
@@ -0,0 +1,3 @@
+--[[
+ Allow admins to develop the world in-game.
+]]
diff --git a/gamemode/core/inventory/common/items.lua b/gamemode/core/inventory/common/items.lua
index 0a32f27..65d8e4a 100644
--- a/gamemode/core/inventory/common/items.lua
+++ b/gamemode/core/inventory/common/items.lua
@@ -3,6 +3,7 @@
--@shared items.lua
--@alias items
+local log = nrequire("log.lua")
local items = {}
-- local function drop_provided(ent,invid,frompos)
@@ -28,6 +29,7 @@ function items.DropItem(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)
diff --git a/gamemode/core/inventory/inventory.lua b/gamemode/core/inventory/inventory.lua
index ff9cc8c..52443a8 100644
--- a/gamemode/core/inventory/inventory.lua
+++ b/gamemode/core/inventory/inventory.lua
@@ -174,9 +174,12 @@ function inv.CreateInventoryFromData(name,data,owner)
--print("tinv was", tinv)
--PrintTable(tinv)
local ret = tinv:DeSerialize(data)
- --print("is now",tinv)
- --PrintTable(tinv)
+ print("is now",ret)
+ PrintTable(ret)
assert(ret != nil, "Failed to create inventory " .. name .. ", returned nil")
+ assert(ret.Owner != nil, "Creating inventory with no owner!")
+ assert(ret.Owner:IsValid(), "Owner of inventory was not valid!")
+ assert(ret.Owner != Entity(0), "Owner was worldspawn! something went wrong!")
return ret
end
diff --git a/gamemode/core/inventory/sv_invtracker.lua b/gamemode/core/inventory/sv_invtracker.lua
index 257410b..8795d2a 100644
--- a/gamemode/core/inventory/sv_invtracker.lua
+++ b/gamemode/core/inventory/sv_invtracker.lua
@@ -77,6 +77,7 @@ net.Receive("art_RequestInvDrop",function(len,ply)
local froment = net.ReadEntity()
local frominvid = net.ReadUInt(32)
local frompos = net.ReadTable()
+ log.debug("Requesting invdrop from " .. tostring(froment))
assert(not froment:IsPlayer() or froment == ply, "Player tried to drop an item that was from another players inventory")
local frominv = froment.data.inventories[frominvid]
local item = frominv:Get(frompos)
diff --git a/gamemode/core/pac/cl_pac.lua b/gamemode/core/pac/cl_pac.lua
index 490ad31..477d65d 100644
--- a/gamemode/core/pac/cl_pac.lua
+++ b/gamemode/core/pac/cl_pac.lua
@@ -19,22 +19,28 @@ if pac == nil then
return --Don't execute this file!
end
-timer.Simple(0,function()
- net.Start("artery_getworldpacs")
- net.SendToServer()
-end)
-
local CLIENT_PAC_DIR = "artery/client/pacs"
file.CreateDir(CLIENT_PAC_DIR)
local function loadpac(ent,name,hash)
+ if (not ent) or (not ent:IsValid()) then
+ timer.Simple(1,function()
+ loadpac(ent,name,hash)
+ end)
+ return
+ end
print("Told to apply pac", name, "to ent", ent)
local filepath = string.format(CLIENT_PAC_DIR .. "/%s.txt",name)
local filetext = file.Read(filepath,"DATA")
if ent.AttachPACPart == nil then
pac.SetupENT(ent)
- assert(ent.AttachPACPart ~= nil,"Failed to set up ent",ent)
+ if ent.AttachPACPart == nil then
+ timer.Simple(1,function()
+ loadpac(ent,name,hash)
+ end)
+ return
+ end
end
if filetext and (tonumber(util.CRC(filetext)) == hash) then
print("The file on our local system is up to date, applying!")
diff --git a/gamemode/core/pac/sv_pac.lua b/gamemode/core/pac/sv_pac.lua
index 916430c..6c9a731 100644
--- a/gamemode/core/pac/sv_pac.lua
+++ b/gamemode/core/pac/sv_pac.lua
@@ -140,10 +140,12 @@ function p3.GetPacs(what)
end
--If a player joins the server, tell them all about the pacs that are applied
-net.Receive("artery_getworldpacs",function(ln,ply)
- net.Start("artery_giveworldpacs")
- net.WriteTable(appliedpacs)
- net.Send(ply)
+hook.Add("PlayerLoadout","send_world_pacs",function(ply)
+ timer.Simple(1,function()
+ net.Start("artery_giveworldpacs")
+ net.WriteTable(appliedpacs)
+ net.Send(ply)
+ end)
end)
local max_pacs_in_cache = 10