Skip to main content

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.

Constructors​

MemberWhat it is
PlayerLikeSpectralGhost()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

7 private and internal fields
MemberWhat it is
private List<Material> animatingMaterialsThe ghost materials made for this ghost, cleaned up on destroy.
private Material baseMaterialThe ghost material copied for each renderer.
private PlayerCustomizationHandler handlerCustomization handler for the ghost's character dummy.
private static Logger loggerClass logger, used when syncing or randomizing fails.
private PlayerCharacterCustomizationManager managerCosmetics manager holding the ghost's outfit.
private static Dictionary<PlayerCosmeticCategory, List<uint>> ownedStatic map from cosmetic category to the dev-free item hashes the ghost can pick from.
private MethodSync syncBodyNetwork sync for the ghost's cosmetics.

Properties​

2 private and internal properties
MemberWhat it is
private static int _Cutout { get; }Shader property ID for _Cutout.
private static int _MainTex { get; }Shader property ID for _MainTex.

Methods​

MemberWhat 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
MemberWhat 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.