{"id":"thehehfocus/replicador","name":"replicador","scope":"thehehfocus","platform":"roblox","description":"Simple library for replication structure.","version":"0.1.27","latest":"0.1.27","versions":["0.1.1","0.1.2","0.1.3","0.1.5","0.1.6","0.1.7","0.1.8","0.1.9","0.1.10","0.1.11","0.1.12","0.1.13","0.1.14","0.1.20","0.1.21","0.1.22","0.1.23","0.1.24","0.1.25","0.1.26","0.1.27"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{},"integrity":"1172cd96d098d0e48ffce96c0f6dce5b8108cb2f6398bda0925cbd9d2d9e3ea9","likes":0,"downloads":0,"install":"forest install thehehfocus/replicador","url":"https://forest.dev/p/roblox/thehehfocus/replicador","files":"https://api.forest.dev/ai/package/roblox/thehehfocus/replicador/files","readme":"# Replicador\r\nAdvanced library for server authoritative to reactive-client replication.\r\n\r\nModule constructs auto replication, types and methods on paths of any depth.\r\n\r\nHas proper tag/identifier management, replication settings, parent-child hierarchy and tagged groups.\r\n\r\nWally link: [here](https://wally.run/package/thehehfocus/replicador) <br>\r\nDocs: soon, maybe?\r\n\r\n\r\n## Example use\r\nServer:\r\n```luau\r\nlocal Replicador = require(game.ReplicatedStorage.Replicador)\r\nlocal Data = { -- Define data type, anything replicatable\r\n\tEquippedSlot = nil :: number?,\r\n\tSlots = {} :: {string},\r\n\tEquipment = {\r\n\t\tHead = nil :: string?,\r\n\t\tBody = nil :: string?,\r\n\t\tLegs = nil :: string?\r\n\t},\r\n}\r\n\r\nlocal Object = Replicador.Server.Register({ -- Register the object, set Data, Identifier, Tags.\r\n\tIdentifier = \"Test\", \r\n\tData = Data, \r\n})\r\n\r\nlocal Success = Replicador.Server.WaitForReadyPlayer(Plr) -- Error handling.\r\nif Success then\r\n\tObject:Subscribe(Plr)\r\nend\r\n\r\n-- Simple set!\r\n-- No manual path typing + Autocompletion and Intellisense.\r\nObject.Data.EquippedSlot = 1\r\nObject.Data.Equipment.Head = \"Helmet\"\r\nObject.Data.Slots:Insert({Name = \"Potion\"}, 1)\r\n\r\ntask.wait(3)\r\n\r\nObject.Data.Slots[1] = {\r\n\tName = \"PotionOverride\"\r\n}\r\n```\r\n\r\nClient:\r\n```luau\r\nlocal Replicador = require(game.ReplicatedStorage.Replicador)\r\n\r\nlocal Data = {\r\n\tEquippedSlot = nil :: number?,\r\n\tSlots = {} :: {string},\r\n\tEquipment = {\r\n\t\tHead = nil :: string?,\r\n\t\tBody = nil :: string?,\r\n\t\tLegs = nil :: string?\r\n\t},\r\n}\r\n\r\nlocal Object = Replicador.Client.AwaitFor(\"Test\", Data)\r\n\r\nObject.Data.Slots:OnKeySet(function(Value, Action, Path) -- Runs when a child of the table changed value.\r\n\tprint(`Made a change at path: {Path}, with action: {Action}, and value: {Value}`)\r\nend)\r\n\r\nObject.Data.Equipment.Head:OnChange(function(Value, OldValue) -- Runs when value at the path changes.\r\n\tprint(`Set head equipment from {OldValue} to {Value}`)\r\nend)\r\n\r\nObject.Data.Slots:OnInsert(function(Value, Index) -- Runs whenever an insertion method is called on the table.\r\n\tprint(`Inserted a slot {Value} at {Index}`)\r\nend)\r\n\r\nlocal Name = Object.Data.Slots[1].Name -- We can cache the path proxies, even if they dont have a value yet.\r\nName:OnChange(function(Value, OldValue)\r\n\tprint(Value, OldValue)\r\nend)\r\n```\r\n\r\n## Or using special singleton function (ensures there's only one object target, handles wait for player loading):\r\nServer\r\n```luau\r\nlocal Object = Replicador.Singleton(\"Test\", Data, Player) -- Player argument - overload and get ServerClass.\r\nif not Object then\r\n\treturn\r\nend\r\n```\r\n\r\nClient\r\n```luau\r\nlocal Object = Replicador.Singleton(\"Test\", Data) -- ClientClass with DataTemplate\r\n```\r\n","readmeTruncated":false}