Skip to content

Life component documentation

Peter Crew edited this page Dec 31, 2018 · 5 revisions

This page covers the LifeComponent class, along with all of the Death, Requirement, and EnvironmentFactor types.


LifeComponent

The component required in order for an entity to be alive.

Constructor

The constructor for LifeComponent takes a single JavaScript object with the properties for the component:

Name Type Required? Description
averagePopulation float No The average size of the population of the entity.
averageLifeLength float No The average number of hours that the entity will live for.
defencePoints int No The number of defence points that the entity has. Damage taken is divided by the number of points.
isAnimal boolean No True if the entity is an animal, false otherwise (for plants, etc).
populationFactors float[] No This is somewhat complicated, and for most cases [0] should suffice. These factors determine how the population of the entity is counted, with each item in the array stepping up one classification node (ahl -> ah -> a).
death Death Yes The type of death that should occur when the entity dies.
breeding {} Yes The properties regarding how the entity breeds, along with any evolutionary parents.
environment EnvironmentFactor[] No The factors regarding how the environment affects the entity's wellbeing.

Settings object for breeding

The breeding property takes a JavaScript object which can have the following properties:

Name Type Required? Description
maturityAge float Yes The number of in-game hours before the entity can breed.
averageBreedTime float Yes The average number of in-game hours an entity has to wait after breeding before it can breed again.
parentId int No The ID of the entity type which can evolve to produce this entity.
requiredPoints int No The number of evolution points that are required to evolve this entity from its parent.
secret boolean No True if the species is secret and should be hidden from the evolution tree.
requirements Requirement[] No The requirements that need to be met in order for the entity's parent to be evolved into the entity.

Deaths

These types describe what happens when an entity dies.

FadeDeath

Slowly fades away the entity until it disappears.

Constructor

The constructor takes a single float argument defining the number of seconds it takes the entity to disappear, e.g. new FadeDeath(5) for 5 seconds.

ParticleDeath

Emits a single pulse of particles as the entity dies.

Constructor

The constructor takes a single ParticleSystem argument defining the properties of the particles that will be spawned.

FloatDeath

Causes the entity to turn upside-down and float to the surface of the water. This should only be used for under-water entities. There are no arguments for the constructor.

SpawnDeath

Replaces the dying entity with a number of new other entities.

Constructor

The constructor takes a single JavaScript object with the following properties:

Name Type Description
id int The ID of the entity type that will be spawned.
min int The minimum number of entities that should be spawned.
max int The maximum number of entities that should be spawned.

Requirements

These types describe the requirements needed in order for an entity type to be evolved.

AltitudeRequirement

Requires that the parent species be within a specific altitude range.

Constructor

The constructor takes two float arguments defining the minimum and maximum altitudes respectively, e.g. new AltitudeRequirement(20, 40) requires that the entity be between 20m and 40m.

BiomeRequirement

Requires that the parent species be within a a biome of a certain strength.

Constructor

The constructor takes an integer and a float argument stating the ID of the biome and the target percentage for the biome's strength, e.g. new BiomeRequirement(BiomeCodes.JUNGLE, 50) requires that the entity be in a jungle biome with a strength of at least 50%.

EatingRequirement

Requires that the parent species has a diet consisting primarily of one specific food type.

Constructor

The constructor takes a single String argument stating the classification of the desired food type, e.g. new EatingRequirement("png11") requires that the entity be predominantly eating wheat.

FruitProductivityRequirement

Requires that the parent species has a certain productivity level for its fruit production.

Constructor

The constructor takes a single float argument stating the desired productivity level, e.g. new FruitProductivityRequirement(1.3) requires that the entity has at least 1.3x productivity.

MaterialRequirement

Requires that the parent species has a specific colour.

Constructor

The constructor takes a String and a Colour argument stating the name of the desired colour (only used for the GUI) and the desired colour respectively, e.g. new MaterialRequirement("Red", new Colour(0.945f, 0.569f, 0.569f)) requires that the entity be red (this specific shade is the default red used by Equilinox).

NearbySpeciesRequirement

Requires that there be a certain number of other species near the parent species.

Constructor

The constructor takes a String and an integer argument stating the classification of the nearby species and the required number of them, e.g. new NearbySpeciesRequirement("ahl", 10) requires that the entity be near at least 10 other large herbivores.

NotBiomeRequirement

Requires that the parent species not be in a certain biome.

Constructor

The constructor takes a single integer argument stating the ID of the undesired biome, e.g. new NotBiomeRequirement(BiomeCodes.DESERT) requires that the entity not be in the desert biome.

SatisfactionRequirement

Requires that the parent species have a certain level of satisfaction.

Constructor

The constructor takes a single float argument stating the desired percentage satisfaction, e.g. new SatisfactionRequirement(80) requires that the entity have a satisfaction of 80%.


Environment factors

These factors can be used to change how an entity's satisfaction is affected by its environment.

AltitudeFactor

States the altitudes at which an entity is satisfied.

Constructor

The constructor takes a single JavaScript object with the following properties:

Name Type Description
min int The minimum altitude at which the entity is satisfied.
max int The maximum altitude at which the entity is satisfied.
influence float Describes how important this factor is, from a scale of 0-1.

DislikedSpeciesFactor

States the species which an entity does not like to be near.

Constructor

The constructor takes a String[] and float argument, stating the classifications of all of the species that the entity does not like, and how important this factor is, from a scale of 0-1 respectively, e.g. new DislikedSpeciesFactor(["abs8", "ahs41"], 0.8) states that the entity does not like chickens or rabbits, with the factor being fairly important.

FavouriteBiomeFactor

States a biome in which the entity likes to live.

Constructor

The constructor takes an integer and float argument, stating the ID of the biome, and how important this factor is, from a scale of 0-1 respectively, e.g. new FavouriteBiomeFactor(BiomeCodes.LUSH, 0.8) states that the entity likes the lush biome, with the factor being fairly important.

LikedSpeciesFactor

States the species which an entity likes to be near.

Constructor

The constructor takes a String[] and float argument, stating the classifications of all of the species that the entity likes, and how important this factor is, from a scale of 0-1 respectively, e.g. new LikedSpeciesFactor(["abs8", "ahs41"], 0.8) states that the entity likes chickens or rabbits, with the factor being fairly important.

SuitableBiomesFactor

States the biomes which are suitable for the entity to live in.

Constructor

The constructor takes a single JavaScript object with the following properties:

Name Type Description
barren boolean True if the entity can survive in barren land.
idealFactor float The ideal percentage strength of a suitable biome.
ids int[] The IDs of all of the biomes that are suitable for the entity to live in.
influence float Describes how important this factor is, from a scale of 0-1.

UnsuitableBiomesFactor

States the biomes which the entity does not like to live in.

Constructor

The constructor takes an int[] and float argument, stating the IDs of all of the biomes that the entity does not like, and how important this factor is, from a scale of 0-1 respectively, e.g. new UnsuitableBiomesFactor([BiomeCodes.SWAMP, BiomeCodes.SNOW], 0.8) states that the entity does not like the swamp or snow biomes, with the factor being fairly important.

Clone this wiki locally