Apartments and tenants
This is the full list of what the API gives you, one section for each part. Text in brackets at the end of a note is extra detail you can skip on a first read.
Housing lists the apartments in the tenement and the tenants in them, and tells you when tenants move or pay rent. An apartment’s number is the number the game shows (for example “Apartment: 2”).
Housing apartments, tenants and rent events
This is the class you start from. It lists apartments and their tenants, starts and cancels evictions, and raises the tenant and rent events.
public static class Housing
{
public static List<ApartmentInfo> AllApartments();
public static ApartmentInfo Get(int apartmentId);
public static TenantInfo GetTenant(int apartmentId);
public static event Action<TenantArgs> TenantMovedIn;
public static event Action<TenantArgs> TenantMovedOut;
public static event Action<RentPayment> RentPaid;
public static event Action<TenementEventArgs> TenementEventStarted;
public static event Action<TenantArgs> EvictionStarted;
public static event Action<TenantArgs> EvictionCancelled;
public const float DefaultEvictionHours = 18f;
public static bool StartEviction(int apartmentId);
public static bool StartEviction(int apartmentId, float hours);
public static bool CancelEviction(int apartmentId);
public static bool IsAvailable { get; }
}
| Method | Returns | What it does |
|---|---|---|
AllApartments() | List<ApartmentInfo> | Every apartment in the building, empty or not. |
Get(apartmentId) | ApartmentInfo | The apartment with this number. null when there is none. |
GetTenant(apartmentId) | TenantInfo | Who lives there. null when the apartment is vacant. |
StartEviction(apartmentId) | bool | Starts an eviction with the default hours. true when it started. |
StartEviction(apartmentId, hours) | bool | Starts an eviction with your hours. true when it started. |
CancelEviction(apartmentId) | bool | Clears a pending eviction. true when it was cleared. |
| Property | Type | What it means |
|---|---|---|
DefaultEvictionHours | float | The hours the game’s own eviction button uses. |
IsAvailable | bool | false when a tenant or rent event could not be set up. |
| Event | Gives you | When it fires |
|---|---|---|
TenantMovedIn | TenantArgs | A tenant has just finished moving in. |
TenantMovedOut | TenantArgs | A tenant has just left. |
RentPaid | RentPayment | A rent payment has just been credited. |
TenementEventStarted | TenementEventArgs | A random tenement event has just started. |
EvictionStarted | TenantArgs | An eviction timer has just been set. |
EvictionCancelled | TenantArgs | A pending eviction has just been cleared. |
ApartmentInfo a snapshot of one apartment
AllApartments() and Get(apartmentId) give you this, one per apartment. It is a copy taken when you asked, so ask again for a current Tenant or Rent. (It is filled from the game’s apartment object, using its apartmentNumber and apartmentFloor.)
public sealed class ApartmentInfo
{
public int Id { get; }
public int Floor { get; }
public string Name { get; }
public TenantInfo Tenant { get; }
public bool MovingIn { get; }
public RentPayment Rent { get; }
public bool EvictionPending { get; }
public float EvictionHoursLeft { get; }
public float MoveInHoursLeft { get; }
public ApartmentType Type { get; }
public string ManagerGuid { get; }
}
| Property | Type | What it means |
|---|---|---|
Id | int | The apartment’s number. |
Floor | int | The floor it is on. |
Name | string | The name the game shows, like “Apartment: 2”. |
Tenant | TenantInfo | Who lives there. null when vacant. |
MovingIn | bool | true when a tenant is assigned and the move-in timer is still running. |
Rent | RentPayment | The rent owed for each payment round. Zero when vacant or still moving in. |
EvictionPending | bool | true when an eviction timer is running. |
EvictionHoursLeft | float | The game hours left on the eviction timer. 0 when none. |
MoveInHoursLeft | float | The game hours left on the move-in timer. 0 when nobody is moving in. |
Type | ApartmentType | The apartment’s size. |
ManagerGuid | string | The id of the apartment’s furniture area, which PlayerShops.Ensure takes. null when there is none. |
TenantInfo one tenant
ApartmentInfo.Tenant and GetTenant(apartmentId) give you this. Both are null when the apartment is vacant.
public sealed class TenantInfo
{
public int Id { get; }
public string Name { get; }
}
| Property | Type | What it means |
|---|---|---|
Id | int | The tenant’s character number (NPC id). |
Name | string | The tenant’s name. |
TenantArgs what the tenant and eviction events tell you
TenantMovedIn, TenantMovedOut, EvictionStarted and EvictionCancelled give you this. ApartmentId says which apartment it is, and Tenant is the tenant the event is about.
public sealed class TenantArgs
{
public int ApartmentId { get; }
public TenantInfo Tenant { get; }
}
| Property | Type | What it means |
|---|---|---|
ApartmentId | int | The apartment’s number. |
Tenant | TenantInfo | The tenant the event is about. |
RentPayment an amount of rent
RentPaid gives you this, and ApartmentInfo.Rent holds the rent owed next. Hotel prices use the same type.
public sealed class RentPayment
{
public int Oc { get; }
public float Rm { get; }
}
| Property | Type | What it means |
|---|---|---|
Oc | int | The OC amount. |
Rm | float | The RM amount. |
TenementEventArgs what TenementEventStarted tells you
TenementEventStarted gives you this, once for each random tenement event that starts. Kind says which kind it is, and TenantId is the tenant it is about, or 0 for none.
public sealed class TenementEventArgs
{
public string Id { get; }
public TenementEventKind Kind { get; }
public int TenantId { get; }
}
| Property | Type | What it means |
|---|---|---|
Id | string | The event’s id from the game’s data. May be null. |
Kind | TenementEventKind | What sort of event it is. |
TenantId | int | The character number of the tenant the event is about. 0 when none. |
TenementEventKind the kinds of tenement event
Kind in TenementEventArgs holds one of these. (It is cast from the game’s own event type number.)
public enum TenementEventKind
{
None,
SpawnTrash,
PlayMusic,
MakeNoise,
BreakApartment,
Die,
SpawnCrazyTeddies,
Complain
}
| Value | Meaning |
|---|---|
None | The game’s None event type. |
SpawnTrash | The game’s SpawnTrash event type. |
PlayMusic | The game’s PlayMusic event type. |
MakeNoise | The game’s MakeNoise event type. |
BreakApartment | The game’s BreakApartment event type. |
Die | The game’s Die event type. |
SpawnCrazyTeddies | The game’s SpawnCrazyTeddies event type. |
Complain | The game’s Complain event type. |
ApartmentType the apartment's size
ApartmentInfo.Type holds one of these, the apartment’s size from the game’s data. (It is cast from the game’s apartment type.size.)
public enum ApartmentType
{
Small,
Medium,
Large,
Shop,
Unknown
}
| Value | Meaning |
|---|---|
Small | A small apartment. |
Medium | A medium apartment. |
Large | A large apartment. |
Shop | A shop space. |
Unknown | The game gives this apartment no size. |
Things to know
- The apartment number is the one the game shows, and it is unique in the building.
AllApartments()gives every apartment, empty or not, in the game’s own order.Getgivesnullfor a number that does not exist. (The number is the game’sapartmentNumber.) GetTenantgivesnullwhen the apartment is vacant, or when the tenant has moved out and left their furniture behind.ApartmentInfo.ManagerGuidis the id you pass toPlayerShops.Ensure(see Player shops). It isnullwhen the game links no furniture area to the apartment, and also for a short time after a save loads, before the game links it. (It is the GUID of the apartment’s furniture manager.)- Rent is paid in rounds, not per tenant. The game does not keep a paid or unpaid mark for each room, so use
ApartmentInfo.Rentfor what is owed next, andRentPaidfor when it is paid. TenantMovedInfires when the move-in timer has finished and the tenant is in.Tenantis the new tenant.TenantMovedOutfires when a tenant leaves, through an eviction or when a new tenant replaces them.Tenantis the tenant who left.RentPaidfires when a rent round is credited.OcandRmare the totals for all apartments together, the same amounts the game adds to the wallet. A round is only announced when the game really pays.TenementEventStartedfires when a random tenement event happens, such as noise or trash. The scene sets what an event does: the game triggers the relay and optional spawner that the scene lists for that kind and tenant, and the event can also send mail and change dialogue variables.TenementEventStartedfires after the random chance for that event succeeded. It also fires for an event started withTenants.TriggerEvent(see Tenants).EvictionStartedfires when an eviction timer is set. That coversStartEviction, the game’s own button, and anything else that sets one.Tenantis the tenant being evicted. The tenant does not leave until the timer ends, and thenTenantMovedOutfires.EvictionCancelledfires when a pending eviction is cleared. That coversCancelEvictionand the game’s button.Tenantis the tenant who stays.ApartmentInfo.Typeis the apartment’s size from the game’s data. AShopis a shop space.Unknownmeans the game gives the apartment no size, so its size is not known.Housing.IsAvailableisfalsewhen a tenant or rent event could not be set up. See “If something fails to set up” below.- Renovation cost and build-time tweaks are in
TweaksRenovations. This page does not change them.