So, I've been creating a plugin that creates an equipable gear system similar to Clockwork's clothes, but with more slots to equip to. Currently, everything seems to be working fine, the only issue I'm running across is networking to the client. I've scoured Clockwork and the forums, but came up with nothing that works. What I want to do is network a table between the server and client, so whenever I change something in the gear table (that contains several slots that are tables, each with itemID and uniqueID values) the client also changes its own gear table. Here's the code that I have related to the networking:
Code:
-- A function to network the player's gear data.
function playerMeta:NetworkGearData()
local gearData = self:GetGearData(); //This'll be a table
self:SetSharedVar("Gear", gearData); //Tried using the shared table method, doesn't work. The Network Proxy doesn't seem to notice any changes
end;
Code:
function GEARSLOTS:LocalPlayerCreated()
Clockwork.kernel:RegisterNetworkProxy(Clockwork.Client, "Gear", function(entity, name, oldValue, newValue)
if (oldValue != newValue) then
if (newValue != {}) then
Clockwork.GearData = newValue;
//print("POOF")
else
//print("GOOF")
Clockwork.GearData.headSlot = {itemID = nil, uniqueID = nil};
Clockwork.GearData.chestOneSlot = {itemID = nil, uniqueID = nil};
Clockwork.GearData.chestTwoSlot = {itemID = nil, uniqueID = nil};
Clockwork.GearData.legSlot = {itemID = nil, uniqueID = nil};
Clockwork.GearData.bagOneSlot = {itemID = nil, uniqueID = nil};
Clockwork.GearData.bagTwoSlot = {itemID = nil, uniqueID = nil};
end;
end;
end);
end;
To really get an idea of how I got this structured, just take a look at the clothes stuff in base clockwork. I really am stumped at this point.