Main planet
Issue #221, part of the Classic features (#222). The owner’s request of 2026-11-15 and the answers to D1 to D6 in the comment „Geklärt“ (owner, 2026-11-16).
Decisions
Section titled “Decisions”- [E] The first (oldest) planet is the main planet by default and does not change by itself; the player switches it to another own planet in the options (owner, 2026-11-15). The main purpose: the link „zum Heimatsystem“ of the Sternenkarte leads where the player wants.
- [E] D1, what the main planet decides: navigation plus research
(owner, 2026-11-16).
- The link „zum Heimatsystem“ on the Sternenkarte leads to its system.
- It is the planet shown when none is selected.
- The research view uses it as its planet.
- Rewards (achievements and the daily reward), the Endzeit gift and the
field rule stay with the first planet (
planets.home()).
- [E] D2, name (owner, 2026-11-16): „Hauptplanet“ for the chosen planet; „Heimatplanet“ stays the name of the first planet.
- [E] D3, lock (owner, 2026-11-16): set by the admin per round, 7 days by default, like the other round values (see Admin).
- [E] D4 and D5 (owner, 2026-11-16): every switch starts the lock, the first one too and a switch back to the first planet too. The first switch is always possible, since nothing locked it before.
- [E] D6 (owner, 2026-11-16): if the main planet is no longer the player’s, it falls back to the oldest planet the player still has, without a lock. Today no game path causes this; it is only a safeguard.
- [E] The chosen main planet cannot be given up (#224 D3, see Abandon a colony); the player changes the main planet first.
- [V] A moon cannot be the main planet (a moon is never the home planet, Moons).
- [V] Fields: the 163 fields stay with the planet that got them; a switch moves no fields, buildings or resources (out of scope of the issue).
- [V] What „research“ of D1 covers: the two places where research used the home planet: research started before #49 has no planet, so its cancel refunds the main planet and the research view names the main planet as its place; and research without a selection starts on the main planet. Research still starts on the shown planet (#49, see Requirements); the Endzeit refunds overtaken research of before #49 on the first planet, as part of its gift.
- [V] Stored per player:
users.main_planet(the chosen planet, null for the first planet) andusers.main_switched(the time of the last switch), migration20261116T2211-main-planet(see SQLite storage). Existing players start without a choice and without a lock. A new round forgets the choice and its lock, because a planet id is its place and could come back. - [V] The lock is a setting of the round,
roundMainLock, in whole days from 1 to 30, read byroundRules()(7 without the setting). The dialog „Neue Runde“ has a number field „Sperre nach einem Wechsel des Hauptplaneten (Tage)“, preselected with the current round, like the guild switch (#191) changed only there; the choice is part of the audit entry of the round reset. The lock runs in real time, not with the speed of the universe. - [E] The lock can also be set during the round (#366, owner,
2026-11-22):
roundMainLockislive, so it is a row of the tab „Universum“ under the heading „Hauptplanet“ and changes in the running round; „Neue Runde“ still offers it. Its change is part of the audit entry of the settings (the universe before and after it). - [E] A change counts only for later switches; a running lock keeps its
end (owner, 2026-11-22): the end is stored at the switch, in the column
users.main_lock_end(migration20261124T1114-main-lock-end), andmainOftakes it instead of computing it from the current setting. [V] The migration gives every lock that exists at the upgrade the end it has by the rule before (the switch plus the days of the round then, 7 without a setting), so nothing changes for a player at the upgrade; a lock that has already ended stays ended whatever the setting becomes. A new round clears the end with the choice. - [V] The rules are pure functions in
src/core/main-planet.ts(patterns, section 7):canBeMain,mainOf(D6),mainLockEnd,mainLocked(the lock holds while now < end) andmainSwitchError(codesunknown,moon,same,locked, in this order). The server (src/server/game/main-planet.ts, actionmainPlanetwithmain, the planet id) turns them into German messages; the options view asksmainLockedtoo. - [V] The state carries
mainPlanetandmainLock(the end of a lock that still holds) besidehomePlanet, which stays the first planet. The link „zum Heimatsystem“ (handlerghomeinsrc/client/main.ts), the refresh without a planet and the research place readmainPlanet; the Sternenkarte’s files are unchanged. - [V] The options („Hilfe & Optionen“) have a box „Hauptplanet“ below „Optionen“: a short explanation with the lock of the round, a selection of the own planets (never moons; the first planet with „ – Heimatplanet“, the main planet preselected) and „Ändern“. While the lock holds, both are disabled and the box says „Wieder änderbar ab <Datum, Uhrzeit>“ in the browser’s time.
- [V] Messages: „<Name> ist jetzt dein Hauptplanet.“; refusals „Der Hauptplanet ist gesperrt. Wieder änderbar ab <Datum, Uhrzeit>.“ (in the time of Berlin, like the mails), „Ein Mond kann nicht Hauptplanet sein.“, „Das ist keiner deiner Planeten.“, „Das ist bereits dein Hauptplanet.“; for the admin „Bitte für die Sperre des Hauptplaneten 1 bis 30 ganze Tage angeben.“.
- Unit:
src/core/main-planet.test.ts(the lock boundaries, D4, D5, D6, the refusals),src/client/logic/main-planet.test.ts(the box),src/client/views/misc.test.ts(the field of the dialog). - Server:
src/server/game/main-planet.test.ts(the action, the lock per round, the new round, D6, the planet shown, actions and research without a selection, the daily reward and the Endzeit gift on the first planet),src/server/http/app.routes.test.ts(the audit of an action without a selection). - Upgrade:
src/server/db/upgrades/20261116T2211-main-planet.test.ts. - E2E:
e2e/main-planet.spec.ts, desktop and phone, with axe on the options.