Skip to main content

PlayerDrinkingMouth

A class in Root.Township, the global namespace.

The player's mouth as a liquid container. On the server, liquid poured in is drunk at once: it's emptied, its effects are applied and an event is synced to clients.

Constructors​

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

Fields​

6 private and internal fields
MemberWhat it is
private MethodSync callLiquidConsumedMethod sync used to send the drink message to clients.
private ConsumptionManager consumerThe consumption manager that checks liquids and applies their effects.
private ILiquidContainer containerThe liquid container on this object.
private float effectHandlingStrengthSerialized value that nothing in the class reads.
private static Logger loggerNLog logger; logs each drink at info level.
private AltaEvent onLiquidConsumedClient: event run when the player drinks, such as a sound or effect.

Methods​

MemberWhat it is
override void Initialize()Sets up the drink event sync and, on the server, listens for the content level going up.
4 private and internal methods
MemberWhat it is
private void Awake()Gets the liquid container and adds a filter that only lets in liquids the player can consume.
private void HandleLiquidAdd(LiquidData liquidData, ref bool result)Liquid filter that refuses liquids consumer can't consume.
private void LiquidAmountChanged(ILiquidContainer container, int oldLevel, int newLevel)Server: when liquid goes in, empties the container, applies its effects, adds ingredient pages and tells clients.
private void SyncLiquidConsumedEvent(IPlayer player, Stream stream)Client: runs onLiquidConsumed when the server sends the drink message.

Used in​

Members of other types that take, return or hold a PlayerDrinkingMouth: