Table of Contents

Class Mail

Namespace
TinyLife.World
Assembly
Tiny Life.dll

A class used for sending and receiving mail. To add new mail to be sent to a Household, add it to MailToSend.

[DataContract]
public abstract class Mail : JsonTypeSafeGenericDataHolder, IGenericDataHolder
Inheritance
JsonTypeSafeGenericDataHolder
Mail
Implements
IGenericDataHolder
Derived
Inherited Members
JsonTypeSafeGenericDataHolder.GetDataKeys()
Extension Methods

Constructors

Mail(Map, Guid)

Creates a new mail instance with the given settings.

protected Mail(Map map, Guid receivingLot)

Parameters

map Map

The Map that this mail should be received on.

receivingLot Guid

The Id of the lot that should receive this mail.

Fields

Id

The global, unique id of this mail item. Used for saving and loading from disk.

[DataMember]
public readonly Guid Id

Field Value

Guid

SentTime

The in-game time that this mail was sent (created) on

[DataMember]
public readonly TimeSpan SentTime

Field Value

TimeSpan

Properties

Map

The map that this mail is on.

protected Map Map { get; }

Property Value

Map

Methods

GetReceivingLot()

Returns the Lot that should receive this mail instance

public Lot GetReceivingLot()

Returns

Lot

The lot that should receive this mail

GetReceivingMailbox()

Returns the mailbox Furniture that should receive this mail instance. If there is no valid mailbox, null is returned.

public Furniture GetReceivingMailbox()

Returns

Furniture

The mailbox to receive this mail

OnReceived()

This method is called automatically when this mail item is received by the receiving lot. A custom mail instance can execute its custom action in this method.

public virtual void OnReceived()

Validate(Map, AppliedMigrations)

Validates this mail and returns false if it is somehow invalid. This method is called when a save is loaded.

public virtual bool Validate(Map map, AppliedMigrations appliedMigrations)

Parameters

map Map

The map that this mail is on.

appliedMigrations AppliedMigrations

The set of migrations that have already been applied for this object.

Returns

bool

Whether this mail is valid.