Project - Ellpeck/TinyLifeExampleMod Wiki

Tiny Life


Project Class

A project is a thing that can be done, saved, completed and monetized by a Person.
A project should be used for actions like writing and programming, where there isn't a physical, MapObject-based representation of the projecgt in the world (like with paintings).

public class Project : MLEM.Misc.GenericDataHolder

Inheritance System.Object 🡒 MLEM.Misc.GenericDataHolder 🡒 Project


Project.Project(Person, string, string) Constructor

Creates a new project with the given settings

public Project(TinyLife.Objects.Person person, string type, string name);


person Person
The person that owns this project

type System.String
The type of the project

name System.String
The name of the project


Project.Name Field

The name of this project, which is usually user-entered using OpenTextPrompt(string, Action<string>, Predicate<string>, Rule)

public readonly string Name;

Field Value


Project.Quality Field

The quality of this project, which defaults to Terrible, and does not have to be used

public Quality Quality;

Field Value


Project.Type Field

The type of this project, which is an arbitrary string.
Book writing projects, for example, have the type set to "Book".

public readonly string Type;

Field Value



Project.DailyPay Property

The daily pay value of this project.
If this is set, and DailyPayReductionFactor is also set, daily royalties will be paid to the Person that owns it.

public float DailyPay { get; set; }

Property Value


Project.DailyPayReductionFactor Property

The amount by which the DailyPay of this project is reduced every day.
If this value is set to 0.1, for example, the DailyPay will be multiplied by 1 - 0.1 (= 0.9) every day.

public float DailyPayReductionFactor { get; set; }

Property Value


Project.Person Property

The person that owns this project

public TinyLife.Objects.Person Person { get; set; }

Property Value


Project.Progress Property

The progress of this project, which can be an arbitrary number.
Most projects in the default game use a progress between 0 and 1 or between 0 and 100.

public float Progress { get; set; }

Property Value



Project.CreateActions(ActionSettings) Method

Creates a set of action settings (which can be registered using RegisterAll(IEnumerable<TypeSettings>)) that involve creating, continuing and scrapping projects of a specified type.
It is recommended to use the provided non-default constructor of ActionSettings for this method.

public static System.Collections.Generic.ICollection<TinyLife.Actions.ActionType.TypeSettings> CreateActions(TinyLife.Goals.Project.ActionSettings settings);


settings ActionSettings
The action settings


A set of type settings for a start, continue and scrap action

Project.GetAndReduceDailyPay() Method

Returns the DailyPay value of this project and reduces it by the DailyPayReductionFactor.
By default, this method also Remove()s this project if the daily pay reached 0.
In essence, this method causes one day to pass in the project's eyes.

public virtual float GetAndReduceDailyPay();


The daily pay

Project.GetVarieties(ActionInfo, string, Predicate<Project>, Func<Project,string>) Method

Returns the varieties that a Person has at their disposal for a given project Type.
The varieties returned include all of the projects that the Person has in their project list.

public static System.Collections.Generic.IEnumerable<TinyLife.Actions.ActionVariety> GetVarieties(TinyLife.Actions.ActionInfo info, string type, System.Predicate<TinyLife.Goals.Project> condition=null, System.Func<TinyLife.Goals.Project,string> projectDisplayName=null);


info ActionInfo
The action info

type System.String
The type of projects to return varieties for

condition System.Predicate<Project>
A condition that determines whether a project should be turned into a variety

projectDisplayName System.Func<Project,System.String>
A function that determines the display name of each project, or null to display its Name


A set of action varieties

Project.MakeProgress(float, GameSpeed, SkillType, float) Method

Makes progress on the project, updating the Progress value based on the Person's Skill and general efficiency modifier

public virtual void MakeProgress(float amount, TinyLife.GameSpeed speed, TinyLife.Skills.SkillType skill=null, float levelModifier=0.1f);


amount System.Single
The amount to add to the Progress

speed GameSpeed
The current game speed

skill SkillType
The (optional) skill that influences progress gain using GetEfficiencyModifier(SkillType, float)

levelModifier System.Single
The (optiona) amount that each level of the skill influences progress gain. Defaults to 0.1.

Project.Remove() Method

Removes this project from the Person's project list, effectively deleting it

public virtual void Remove();

Project.SetDailyPay(float, float, bool) Method

Sets the daily pay amount of this project, optionally based on its Quality.
If influencedByQuality is true, the daily pay and daily reduction factor will be modified to suit the quality better.

public void SetDailyPay(float amount, float dailyReductionFactor, bool influencedByQuality=true);


amount System.Single
The amount to pay daily

dailyReductionFactor System.Single
The amount that the daily pay should be reduced by. amount is multiplied with 1 - dailyReductionFactor every day.

influencedByQuality System.Boolean
Whether the current Quality should have an effect on the pay

Project.Validate(Person) Method

Validates this project, setting the Person that owns it after the game is loaded.

public virtual bool Validate(TinyLife.Objects.Person person);


person Person
The person that owns this project


Whether this project is considered valid