Skip to main content

PouchSpawner

A class in Root.Township, the global namespace.

Server: spawner that places an item, or a stack of it inside a pouch when the count is more than one and the item can be picked up.

Constructors​

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

Fields​

6 private and internal fields
MemberWhat it is
private AttributeUsage countHow many to spawn, read from chunk attributes.
private int countToSpawnCount worked out for the current spawn.
private Distribution distributionDistribution to pick the item from when prefab is not set.
private static Logger loggerNLog logger for this class.
private NetworkPrefab prefabItem to spawn. Use this or distribution.
private NetworkPrefab prefabToSpawnItem picked for the current spawn.

Methods​

MemberWhat it is
override void Spawn()Server: works out the count from chunk attributes, picks the prefab and spawns it or a pouch. Refuses to put a pouch in a pouch.
protected override void OnSpawn(NetworkEntity spawned)When a pouch spawns, spawns the item and docks countToSpawn of it into the pouch.