RockCluster
A class in Root.Township, the global namespace.
A Cluster of Rock parts that all share one BoulderDefinition. The server picks the definition and syncs it and the part list to clients; saved with RockClusterSaveData.
- Listed in Global namespace: Q to R
- Inherits or implements
Cluster,ISavable<RockClusterSaveData>,ISavableSave<RockClusterSaveData>,ISavableSaveBase - Derived types
RockClusterSaveData
Constructors
| Member | What it is |
|---|---|
RockCluster() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
4 private and internal fields
| Member | What it is |
|---|---|
private BoulderDefinition definition | The BoulderDefinition shared by every rock in the cluster. Saved. |
private static Logger logger | NLog logger for this class. |
private ObjectPipeline options | Object pipeline that picks a BoulderDefinition for a freshly generated cluster. |
private MethodSyncStruct<ClusterEntitiesRegisterArguments> sync | Method sync that sends the definition and part list to clients. |
Methods
| Member | What it is |
|---|---|
override void AddingFinished(SpawnData spawnData) | Server: after all parts are added, sets them up and sends the definition and part IDs to the chunks. |
override void Initialize() | Creates the sync method sync on SyncA. |
override void InitializeAsServer(SpawnData spawnData) | Server: for newly generated spawns, picks a definition from options. |
override void OnConnected(Player player) | Server: sends the definition and part IDs to a joining player. |
protected override void AddInternal(NetworkEntity part) | Adds a part and, if the definition is known, defines the rock and makes the cluster its chunking parent. |
4 private and internal methods
| Member | What it is |
|---|---|
private int GetTemporaryPartsIdentifiers() | Writes the part entity IDs into the shared TemporaryUint256.array and returns how many it wrote. |
private void Setup(NetworkEntity part) | Defines one part's Rock with the cluster's definition and sets the cluster as its chunking parent. |
private void SetupExisting(SpawnData spawnData) | Sets up all current parts. Logs an error and picks a random definition if none is set. |
private void Sync(IPlayer player, Stream stream, ClusterEntitiesRegisterArguments args) | Serializes the definition hash and part IDs. Clients look up the definition and set up each part once it spawns. |