Skip to content

Overview

Pheno is Townstead’s shared behaviour language, a bit like the cause and effect engine. It describes conditions, actions, selectors, values, capabilities, and runtime context that other Townstead systems can embed.

AreaPurpose
ConditionsDecide whether something is true in the current context.
ActionsDo something in the world, to an entity, to an item, or at a block position.
SelectorsChoose entities or blocks for actions and conditions.
ValuesProvide numbers from runtime context.
Gene NodesPheno-backed gene nodes used inside Roots gene files.
StructureHow typed nodes, domains, context, wrappers, authoring rules, and validation fit together.
ContextHow Pheno decides the current actor, target, origin, block, item, holder, or cause.
DiagnosticsReport unknown types, malformed fields, and generated reference data for pack authors.

Start with the examples page if you want to see conditions, actions, selectors, and values working together before reading the reference tables.

Pheno is embedded inside other data formats. The outer file owns the schema field and selects the authoring rules for its nested Pheno blocks.

For example, a gene can use a Pheno action:

{
"schema": "townstead:gene/v2",
"type": "pheno:active_ability",
"cooldown": "10s",
"do": {
"type": "pheno:heal",
"amount": 4
}
}

A reaction can use a Pheno condition:

{
"schema": "townstead:reaction/v2",
"when": {
"type": "pheno:environment",
"weather": "clear"
}
}

Nested Pheno objects do not declare their own schema.