Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved handling of class tokens #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/ServerScriptService/ReplicaService.lua
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,8 @@ function Replica:Destroy()
rev_ReplicaDestroy:FireClient(player, id)
end
end
local class_name = self.Class
CreatedClassTokens[class_name] = false
-- Recursive destruction
DestroyReplicaAndDescendantsRecursive(self)
end
Expand All @@ -827,6 +829,18 @@ function ReplicaService.NewClassToken(class_name) --> [ReplicaClassToken]
}
end

function ReplicaService.ReturnClassToken(class_name) --> [ReplicaClassToken]
if type(class_name) ~= "string" then
error("[ReplicaService]: class_name must be a string")
end

if CreatedClassTokens[class_name] == true then
return {
Class = class_name
}
end
end

function ReplicaService.NewReplica(replica_params) --> [Replica]
local class_token = replica_params.ClassToken
local replica_tags = replica_params.Tags or {}
Expand Down