Class Mail
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
-
JsonTypeSafeGenericDataHolderMail
- 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
MapThe Map that this mail should be received on.
receivingLot
GuidThe 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
SentTime
The in-game time that this mail was sent (created) on
[DataMember]
public readonly TimeSpan SentTime
Field Value
Properties
Map
The map that this mail is on.
protected Map Map { get; }
Property Value
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
MapThe map that this mail is on.
appliedMigrations
AppliedMigrationsThe set of migrations that have already been applied for this object.
Returns
- bool
Whether this mail is valid.