Skip to content

Commit

Permalink
Add Destroy function to server remotes
Browse files Browse the repository at this point in the history
  • Loading branch information
hoontee committed Jan 9, 2025
1 parent 8ed3e52 commit 6811d5a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions Pronghorn/Remotes/init.luau
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type ServerRemote = {
FireAllExcept: (self: ServerRemote, ignorePlayer: Player, ...any) -> ();
SetListener: (self: ServerRemote, newFunction: (Player, ...any) -> (...any)) -> ();
AddListener: (self: ServerRemote, newFunction: (Player, ...any) -> ()) -> RBXScriptConnection;
Destroy: (self: ServerRemote) -> ();
}
type ClientRemote = typeof(setmetatable({} :: {
Fire: (self: ClientRemote, ...any) -> (...any);
Expand Down Expand Up @@ -176,6 +177,11 @@ function Remotes.Server:CreateToClient(name: string, requiredParameterTypes: {st
end
Remotes.Server[moduleName][remote.Name] = actions :: ServerRemote

actions.Destroy = function(): ()
remote:Destroy()
Remotes.Server[moduleName][remote.Name] = nil
end

if remoteType == "Returns" then
actions.Fire = function(_, player: Player, ...: any)
TypeChecker(remote, nil, requiredParameterTypes, ...)
Expand Down Expand Up @@ -257,6 +263,11 @@ function Remotes.Server:CreateToServer(name: string, requiredParameterTypes: {st
end
end

actions.Destroy = function(): ()
remote:Destroy()
Remotes.Server[moduleName][remote.Name] = nil
end

if remoteType == "Returns" then
if func then
remote.OnServerInvoke = getTypeCheckedFunction(func)
Expand Down
2 changes: 1 addition & 1 deletion Pronghorn/init.luau
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
║ ██████▀██▓▌▀▌ ▄ ▄▓▌▐▓█▌ ║
║ ║
║ ║
║ Pronghorn Framework Rev. B82
║ Pronghorn Framework Rev. B83
║ https://github.com/Iron-Stag-Games/Pronghorn ║
║ GNU Lesser General Public License v2.1 ║
║ ║
Expand Down

0 comments on commit 6811d5a

Please sign in to comment.