Table of Contents

Class Upgrade

Namespace
TinyLife.Objects
Assembly
Tiny Life.dll

An upgrade is a modification that can be applied to Furniture to change the way it behaves. New upgrades can be registered using Register(Upgrade), and upgrades can be queried for a Furniture object using HasFullUpgrade(Upgrade) and GetAppliedUpgrade(Upgrade).

[JsonConverter(typeof(StaticJsonConverter<Upgrade>), new object[] { typeof(Upgrade), "PrivateUpgrades" })]
public class Upgrade : IEmotionSource
Inheritance
Upgrade
Implements
Inherited Members
Extension Methods

Constructors

Upgrade(string, TextureRegion, int, int, ObjectCategory)

Creates a new upgrade with the given settings.

public Upgrade(string name, TextureRegion icon, int requiredSkillLevel, int price, ObjectCategory validObjects)

Parameters

name string

The name of this upgrade, which should be unique.

icon TextureRegion

The icon of this upgrade.

requiredSkillLevel int

The skill level that is required to be able to apply this upgrade.

price int

The price for applying this upgrade.

validObjects ObjectCategory

A combined flag of ObjectCategory flags that determine which objects this upgrade can be applied on.

Fields

BetterMemory

public static readonly Upgrade BetterMemory

Field Value

Upgrade

BetterPressure

public static readonly Upgrade BetterPressure

Field Value

Upgrade

Bidet

public static readonly Upgrade Bidet

Field Value

Upgrade

ConfigurableShowerHead

public static readonly Upgrade ConfigurableShowerHead

Field Value

Upgrade

FridgeTemperatureControl

public static readonly Upgrade FridgeTemperatureControl

Field Value

Upgrade

Icon

The icon of this upgrade.

public readonly TextureRegion Icon

Field Value

TextureRegion

Name

The name of this upgrade, which should be unique.

public readonly string Name

Field Value

string

Price

The price for applying this upgrade.

public readonly int Price

Field Value

int

ProtectiveCoating

public static readonly Upgrade ProtectiveCoating

Field Value

Upgrade

RequiredSkillLevel

The skill level that is required to be able to apply this upgrade.

public readonly int RequiredSkillLevel

Field Value

int

RgbLights

public static readonly Upgrade RgbLights

Field Value

Upgrade

SofterCushioning

public static readonly Upgrade SofterCushioning

Field Value

Upgrade

SwivelFaucet

public static readonly Upgrade SwivelFaucet

Field Value

Upgrade

TemperatureGauge

public static readonly Upgrade TemperatureGauge

Field Value

Upgrade

Upgrades

The collection of all registered upgrades. New upgrades can be registered using Register(Upgrade).

public static readonly ReadOnlyDictionary<string, Upgrade> Upgrades

Field Value

ReadOnlyDictionary<string, Upgrade>

ValidObjects

A combined flag of ObjectCategory flags that determine which objects this upgrade can be applied on.

public readonly ObjectCategory ValidObjects

Field Value

ObjectCategory

WaterPurifier

public static readonly Upgrade WaterPurifier

Field Value

Upgrade

Properties

HasToLearn

Whether this upgrade has to be discovered, or learned. If this is false, the Memory will be null.

public bool HasToLearn { get; init; }

Property Value

bool

Memory

The memory for this upgrade, which is stored in UpgradeLearned. An upgrade can only be applied by a PersonLike if they have this memory. Note that, if HasToLearn is false, this will return null.

public MemoryType Memory { get; }

Property Value

MemoryType

Requirements

A set of Upgrades that optionally need to be applied first before this upgrade can be applied.

public Func<Upgrade[]> Requirements { get; init; }

Property Value

Func<Upgrade[]>

SourceString

A (localized) string that is displayed when hovering over an EmotionModifier that has this source

public string SourceString { get; }

Property Value

string

Methods

Knows(PersonLike)

Returns whether the given PersonLike knows this upgrade. If HasToLearn is false, this method always returns true.

public bool Knows(PersonLike person)

Parameters

person PersonLike

The person.

Returns

bool

Whether the person knows this upgrade.

Learn(PersonLike)

Causes the given PersonLike to learn this upgrade, adding the appropriate Memory to them and optionally displaying a notification.

public void Learn(PersonLike person)

Parameters

person PersonLike

The person who should learn this upgrade.

Register(Upgrade)

Registers the given Upgrade to the Upgrades collection.

public static Upgrade Register(Upgrade upgrade)

Parameters

upgrade Upgrade

The upgrade to register.

Returns

Upgrade

The upgrade, for chaining.