PlayerLikeSpectralGhost
A class in Root.Township, Alta.Intelligence.
A Phantom that looks like a player: the server dresses it in random cosmetics from the dev-free items and syncs that look to clients, which give it a see-through ghost material.
- Listed in Creatures and AI
- Inherits or implements
Phantom - Documented in Other creatures, Creature data, Creatures and AI
Constructors
| Member | What it is |
|---|---|
PlayerLikeSpectralGhost() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
7 private and internal fields
| Member | What it is |
|---|---|
private List<Material> animatingMaterials | The ghost materials made for this ghost, cleaned up on destroy. |
private Material baseMaterial | The ghost material copied for each renderer. |
private PlayerCustomizationHandler handler | Customization handler for the ghost's character dummy. |
private static Logger logger | Class logger, used when syncing or randomizing fails. |
private PlayerCharacterCustomizationManager manager | Cosmetics manager holding the ghost's outfit. |
private static Dictionary<PlayerCosmeticCategory, List<uint>> owned | Static map from cosmetic category to the dev-free item hashes the ghost can pick from. |
private MethodSync syncBody | Network sync for the ghost's cosmetics. |
Properties
2 private and internal properties
Methods
| Member | What it is |
|---|---|
override void Initialize() | Sets up an empty cosmetics manager on the customization handler and the body sync. Off headless, also the material list. |
override void OnConnected(Player player) | Sends the ghost's cosmetics to the joining player. |
protected override void InitializeAi() | Server: randomizes the cosmetics. Off headless, sets up the ghost materials once the cosmetics are packed. |
protected override void InitializeStatic() | Once per class, loads every Purchasable marked free for devs and groups their hashes by cosmetic category. |
protected override void OnDestroy() | Cleans up the ghost materials. The list is only made off headless, so on a headless server this probably throws. |
4 private and internal methods
| Member | What it is |
|---|---|
private void ProcessRenderer(Renderer renderer) | Gives a renderer a ghost material, using a new one with its main texture as the cutout if it has one. |
private async void Randomize(PlayerCosmeticWrapper cosmeticWrapper) | Async: clears the cosmetics and adds one random item from each category in owned, then runs the post-randomize step. |
private void SetupMaterials() | Makes the base ghost material and applies ghost materials to every main renderer of the character dummy. |
private async void SyncBody(IPlayer player, Stream stream) | Network handler (SyncA) that sends the cosmetics and, on a remote client, sets up the ghost materials after packing. |