Magical gene / no coat effect

Eyesight locus

Whether the horse was built for the dark or for the daylight. A caveborn horse moves better in the gloom and worse in the light; a daywalker is the opposite; the wild type does not care. It reads the actual light level, so a cave at noon counts — and so do your own torches.

Built, and not yet seen in game

The gene, its inheritance and its founder table exist and are covered by the test suite; the translator that turns it into behaviour was written against the 26.1.2 sources and is flagged unverified in its own comments. Nothing on this page has been watched happening to a horse. What to look at, and what is most likely to be wrong, is on To be verified.

What it does

CombinationOutcome
Cav/Cavcaveborn — faster in the dark, slower in the light
Day/Daydaywalker — faster in the light, slower in the dark
Cav/Daynothing — the two cancel out
anything with an nnothing

Your torches slow your caveborn horse down

This is the consequence of reading light rather than the clock, and it is kept rather than fixed. A mining horse bred for the dark gets worse the more you light the tunnel, which is a genuine trade-off in a game where lighting a tunnel is also how you stop things spawning in it.

Health

None. It is a trade, not a cost — whichever way it falls, the horse is better somewhere and worse somewhere else.

Gene key
horsegenetics.eyesight
Alleles
Cav caveborn, Day daywalker, n
Inheritance
recessive; both variants recessive to n and to each other
Reaches the game as
two attribute effects on movement_speed, oppositely gated on light_level
Coat effect
none, ever
Needs one new condition flag, and it does a world lookup

light_level is a new entry in CONDITION_FLAGS and a new branch in flagHolds — two files, added in the same change as the list says. It reads block light at the horse’s position, so it must be interval-sampled and cached rather than evaluated per tick per horse. Every other flag in the list is a field read; this one is the first that touches the world.

The compound heterozygote needs no rule

Cav/Day cancels by arithmetic, not by a special case: they are opposite-signed modifiers on one attribute, gated on opposite conditions, so exactly one is ever active and the two average out across a day. Nothing in the translator has to know.

Removal is already solved

A modifier gated on a condition that stops holding would otherwise stay on the horse for ever. clearAttributes already takes off every gene modifier the horse is not currently asking for, which is why this gene needs no cleanup code of its own.

Why light level and not the clock

“Caveborn” that keys off night is a horse which is no faster in a cave, and that reads as a bug on the first mining trip. The existing night and sky_visible flags could be combined to approximate “underground”, and that was the cheaper design; it was rejected because it cannot tell a lit tunnel from a dark one, and the lit tunnel is where the interesting trade-off lives.

The cheapest gene on the behaviour list

One condition flag and a gene file. Everything else — the attribute verb, its per-gene modifier scoping, the reconcile, the removal — already ships. It is the sensible first build of the batch for exactly that reason.

A locus with no wrong answer

Most magical loci are ladders: one allele is better and the breeding project is to find it. This one has two alleles that are each better somewhere, so the question a breeder faces is not “which is stronger” but “what is this horse for”. The mod has very few of those and wants more.

Cancelling as a statement

A Cav/Day horse is not a broken horse or a compromise horse. It is a horse whose two answers to the same question happen to sum to the wild type — which is what a real incompletely-dominant pair of opposite-effect alleles does, and it costs nothing to represent honestly.

Planned source: common/genetics/genes/EyesightGene.java