JobType - Ellpeck/TinyLifeExampleMod Wiki

Tiny Life


JobType Class

A job type is a singleton containing various kinds of data for a Job instance.
New jobs can be registered using Register(JobType).

public class JobType : MLEM.Misc.GenericDataHolder

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


JobType.JobType(string, float, Range<int>, DayOfWeek[]) Constructor

Creates a new job type with the given settings

public JobType(string name, float hourlyPay, MonoGame.Extended.Range<int> workHours, params System.DayOfWeek[] offWorkDays);


name System.String
The name of the job

hourlyPay System.Single
The hourly wage that this job yields

workHours MonoGame.Extended.Range<System.Int32>
A range of hours to work each day

offWorkDays System.DayOfWeek[]
The days of the week that are off work


JobType.HourlyPay Field

The amount of dollars that being at the job for an hour pays.
In TinyLife.Actions.WorkAction, this is automatically added to the household funds.

public readonly float HourlyPay;

Field Value


JobType.Name Field

The name of this job type

public readonly string Name;

Field Value


JobType.OffWorkDays Field

A set of System.DayOfWeek values which are days off of this job.
On Weekdays contained in this list, the WorkHours don't apply.

public readonly DayOfWeek[] OffWorkDays;

Field Value


JobType.Types Field

A registry of all JobType instances in the game and mods.
Register new jobs using Register(JobType).

public static readonly IDictionary<string,JobType> Types;

Field Value


JobType.WorkHours Field

A System.Range of hours that this job requires each day.
Note that the MonoGame.Extended.Range<>.Min value is inclusive, but the MonoGame.Extended.Range<>.Max value is exclusive.

public readonly Range<int> WorkHours;

Field Value



JobType.RequiredPromotionSkills Property

A set of skills and their level curves that are required for promotion to the next Level of this job type.
The level curve is a multiplier for the job's current Level that yields the required skill level. Specifically, the required skill level for any given job level is calculated as (curve * (jobLevel + 1)).Floor().

public (TinyLife.Skills.SkillType Type,float LevelCurve)[] RequiredPromotionSkills { get; set; }

Property Value



JobType.Construct(Person) Method

Creates a new Job from this type's information

public TinyLife.Goals.Job Construct(TinyLife.Objects.Person person);


person Person
The person that should have the job


A new job instance

JobType.GetDisplayName(Nullable<int>) Method

Returns the display name of this JobType, based on the given level.
If no level is given, the job's regular name, without the level-based suffix, is returned.

public string GetDisplayName(System.Nullable<int> level=null);


level System.Nullable<System.Int32>
The level


A localized string representing this job's name

JobType.GetRequiredPromotionSkills(int) Method

Returns the set of skills and levels that are required to promote from the given jobLevel to the next level

public System.Collections.Generic.IEnumerable<(TinyLife.Skills.SkillType Type,int Level)> GetRequiredPromotionSkills(int jobLevel);


jobLevel System.Int32
The current job level


A set of skill types and their required levels for promotion

JobType.IsTimeToWork(Nullable<TimeSpan>) Method

Returns whether the given time (or the game's current time) is in the bounds of WorkHours and outside of the bounds of OffWorkDays.
If this method returns true, TinyLife.Actions.WorkAction can be started.

public bool IsTimeToWork(System.Nullable<System.TimeSpan> time=null);


time System.Nullable<System.TimeSpan>
The current time. Defaults to CurrentTime.


true if it is time to work, false otherwise

JobType.Register(JobType) Method

Registers the given job type to the Types registry

public static void Register(TinyLife.Goals.JobType type);


type JobType
The type to register

JobType.ToScheduleString() Method

Returns a string representation of the schedule.
The string includes a line that states the WorkHours and a line that states the OffWorkDays.

public string ToScheduleString();


A string representation of this job's schedule