Skip to content

Commit

Permalink
Rev. 56
Browse files Browse the repository at this point in the history
  • Loading branch information
hoontee committed Jan 30, 2024
1 parent 6da3eb2 commit 14d9b6d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
23 changes: 19 additions & 4 deletions Pronghorn/Remotes/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,29 @@ local function connectEventClient(remote: RemoteFunction | UnreliableRemoteEvent
end

elseif remote:IsA("UnreliableRemoteEvent") or remote:IsA("RemoteEvent") then
local lastRandom = script:GetAttribute("Random")

actions.Connect = function(_, func: (...any) -> ()): RBXScriptConnection
return (remote :: RemoteEvent).OnClientEvent:Connect(func)
end

actions.Fire = function(_, ...: any?)
Print(getEnvironment(), debugPrintText, {...})
return (remote :: RemoteEvent):FireServer(...)
local nextRandom = script:GetAttribute("Random")
if not remote:IsA("UnreliableRemoteEvent") or nextRandom ~= lastRandom then
lastRandom = nextRandom
Print(getEnvironment(), debugPrintText, {...});
(remote :: RemoteEvent):FireServer(...)
end
end

metaTable.__call = function(_, context: any, ...: any?)
local nextRandom = script:GetAttribute("Random")
if context ~= Remotes[moduleName] then error(`Must call {moduleName}:{remote.Name}() with a colon`, 0) end
Print(getEnvironment(), debugPrintText, {...});
(remote :: RemoteEvent):FireServer(...)
if not remote:IsA("UnreliableRemoteEvent") or nextRandom ~= lastRandom then
lastRandom = nextRandom
Print(getEnvironment(), debugPrintText, {...});
(remote :: RemoteEvent):FireServer(...)
end
end
end
end
Expand Down Expand Up @@ -222,7 +231,13 @@ end
--- @ignore
function Remotes:Init()
if RunService:IsServer() then
local random = Random.new(os.clock())

remotesFolder = New.Instance("Folder", ReplicatedStorage, "__remotes")

RunService.Heartbeat:Connect(function(_dt: number)
script:SetAttribute("Random", random:NextNumber())
end)
else
remotesFolder = ReplicatedStorage:WaitForChild("__remotes") :: Folder

Expand Down
2 changes: 1 addition & 1 deletion Pronghorn/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
║ ██████▀██▓▌▀▌ ▄ ▄▓▌▐▓█▌ ║
║ ║
║ ║
║ Pronghorn Framework Rev. B55
║ Pronghorn Framework Rev. B56
║ https://github.com/Iron-Stag-Games/Pronghorn ║
║ GNU Lesser General Public License v2.1 ║
║ ║
Expand Down

0 comments on commit 14d9b6d

Please sign in to comment.