Fruit Fly
README.md
FirstRun
The card a newcomer meets: four steps that tick themselves off from the state of the network and the fly, ending in the sentence the world is for.
entity.spawn("FirstRun").component.add("FirstRun", { brain = brainEnt, fly = flyEnt })
The steps are read in order, so the card cannot tick ahead of the person reading it:
- Reset the network. Ticks when the network's own clock drops.
- Read out the proboscis motor neurons. Ticks when a group named MN9 exists.
- Taste something sweet. Ticks when MN9 passes 50 Hz.
- Look at the fly. Ticks when the fly's proboscis is out.
Then the line: "MN9 is firing at N Hz and the proboscis is out. You just drove a real connectome.", and a button that opens the experiments panel.
The card drives nothing. It reads describe(), rates() and the fly's
motor(), and every step is something the visitor did at the bench.
Completion is stored as the attribute fruitFly.firstRun on this entity, so
the world remembers rather than one browser, and the card does not come back
for whoever finished it.
The value names who that was. An entity attribute is authored state: it is serialized into the scene and published with it, and the entity is shared by everyone in the world. A value naming somebody else, including one a published scene shipped, leaves the card standing, so a visitor always meets a fresh card whatever the last visitor did.
resetOnAwake forgets it at load, and comp:restart() forgets it now, which
is how the card is met a second time. comp:progress() reports which steps
have ticked.
The card takes the right column above where the experiments panel opens, laid
out from ui.screenSize(), and it yields to the panel: while the panel is
open the card is not drawn.