Genetics¶
文档版本:1.21.50.25
Defines the way a mob's genes and alleles are passed on to it's offspring, and how those traits manifest in the child. Compatible parent genes are crossed together, the alleles are handed down from the parents to the child, and any matching genetic variants fire off JSON events to modify the child and express the traits.
架构¶
genetics:
{
number "mutation_rate" : opt
array "genes" : opt
{
object "<any array element>" : opt
{
integer "allele_range" : opt
object "allele_range" : opt
{
integer "range_min" : opt
integer "range_max" : opt
}
array "genetic_variants" : opt
{
object "<any array element>" : opt
{
event_object "birth_event"
"both_allele" : opt
integer "either_allele" : opt
integer "hidden_allele" : opt
"main_allele" : opt
number "mutation_rate" : opt
}
}
string "name" : opt
}
}
}
mutation_rate
:number- Chance that an allele will be replaced with a random one instead of the parent's allele during birth.
genes
:array- The list of genes that this entity has and will cross with a partner during breeding.
genes
<any array element>
:object- The list of genes that this entity has and will cross with a partner during breeding.
<any array element>
allele_range
:integer- The range of positive integer allele values for this gene. Spawned mobs will have a random number in this range assigned to them.
allele_range
:object- The range of positive integer allele values for this gene. Spawned mobs will have a random number in this range assigned to them.
allele_range
range_min
:integer- Lower bound of the vaues.
range_max
:integer- Upper bound of the vaues.
genetic_variants
:array- The list of genetic variants for this gene. These check for particular allele combinations and fire events when all of them are satisfied.
genetic_variants
<any array element>
:object- The genetic variant for this gene. These check for particular allele combinations and fire events when all of them are satisfied.
<any array element>
birth_event
:event_object- Event to run when this mob is created and matches the above allele conditions.
both_allele
- If this value is non-negative, compare both the mob's main and hidden alleles with this value for a match with both. Can also be a range of integers.
either_allele
:integer- If this value is non-negative, compare both the mob's main and hidden alleles with this value for a match with either. Can also be a range of integers.
hidden_allele
:integer- If this value is non-negative, compare the mob's hidden allele with this value for a match. Can also be a range of integers.
main_allele
- If this value is non-negative, compare the mob's main allele with this value for a match. Can also be a range of integers.
mutation_rate
:number- If this value is non-negative, overrides the chance for this gene that an allele will be replaced with a random one instead of the parent's allele during birth. Non-negative values greater than 1 will be the same as the value 1.
name
:string- The name of the gene.