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 62e1249
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
22 changes: 18 additions & 4 deletions Pronghorn/Remotes/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ local TypeChecker = require(script.TypeChecker)
-- Helper Variables
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

local random = Random.new(os.clock())
local remotesFolder: Folder;

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -69,20 +70,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 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 nextRandom ~= lastRandom then
lastRandom = nextRandom
Print(getEnvironment(), debugPrintText, {...});
(remote :: RemoteEvent):FireServer(...)
end
end
end
end
Expand Down Expand Up @@ -223,6 +233,10 @@ end
function Remotes:Init()
if RunService:IsServer() then
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 62e1249

Please sign in to comment.