From 6811d5a5ff525bfa37ef5199a7166a521a99ce66 Mon Sep 17 00:00:00 2001 From: hoontee Date: Wed, 8 Jan 2025 21:47:21 -0600 Subject: [PATCH] Add Destroy function to server remotes --- Pronghorn/Remotes/init.luau | 11 +++++++++++ Pronghorn/init.luau | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Pronghorn/Remotes/init.luau b/Pronghorn/Remotes/init.luau index 2cc3142..f5c7dc9 100644 --- a/Pronghorn/Remotes/init.luau +++ b/Pronghorn/Remotes/init.luau @@ -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); @@ -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, ...) @@ -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) diff --git a/Pronghorn/init.luau b/Pronghorn/init.luau index 9981bcc..19de1df 100644 --- a/Pronghorn/init.luau +++ b/Pronghorn/init.luau @@ -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 ║ ║ ║