Replicator
Monitors dependencies primarily for replication. Handles the following scenarios.
This system dynamically replicates whatever state exists in the tree except we filter out server-specific assets while any client-side assets are still replicated even if deeper in the tree.
By separating out the replication component of the loader from the loading logic we can more easily support hot reloading and future loading scenarios.
Repliation rules:
- Replicate the whole tree, including any changes
- Module scripts named Server are replaced with a folder
- Module scripts that are in server mode won't replicate unless a client dependency is needed or found.
- Once we hit a "Template" object we stop trying to be smart since Mesh parts are not API accessible.
- References are preserved for ObjectValues.
This system is designed to minimize changes such that hot reloading can be easily implemented.
Right now it fails to be performance friendly with module scripts under another module script.
Functions
new
Constructs a new Replicator which will do the syncing.
isReplicator
Replicator.
isReplicator
(
replicator:
any?
) →
boolean
Returns true if the argument is a replicator
ReplicateFrom
Replicates children from the given root
GetReplicatedDescendantCountValue
Returns the replicated descendant count value.
SetReplicationType
Sets the replication type for this replicator
SetTarget
Sets the target for the replicator where the results will be parented.
GetTarget
Gets the current target for the replicator.
GetHasReplicatedChildrenValue
Gets a value representing if there's any replicated children. Used to avoid leaking more server-side information than needed for the user.
Destroy
Replicator:
Destroy
(
) →
(
)
Cleans up the replicator disconnecting all events and cleaning up created instances.