feat(ecology): make photosynthesis regions playable on DEV
Foundation / checks (ecs) (push) Successful in 2m19s
Foundation / checks (deploy) (push) Successful in 4m47s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (checks) (push) Canceled after 16m48s
Foundation / checks (network) (push) Canceled after 16m46s
Foundation / checks (postgres) (push) Canceled after 16m47s
Foundation / checks (client) (push) Canceled after 16m53s
Foundation / checks (tsan) (push) Canceled after 14m33s
Foundation / checks (ecs) (push) Successful in 2m19s
Foundation / checks (deploy) (push) Successful in 4m47s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (checks) (push) Canceled after 16m48s
Foundation / checks (network) (push) Canceled after 16m46s
Foundation / checks (postgres) (push) Canceled after 16m47s
Foundation / checks (client) (push) Canceled after 16m53s
Foundation / checks (tsan) (push) Canceled after 14m33s
ADR-0176 and schema 57 admit raw cellular bundle 13 (rules 11 on owner format 9) through parser-local normalization to bundle 12, and a fenced no-tick 12 -> 13 upgrade that declares the region's light; recovery reads the light from the target and re-derives the whole target from the source. The resumable cellular-v8 opening provisions a cellular-v7 genesis, one empty tick and the durable upgrades to bundle 13. Session v12 adds the owner's captured light and the producers it can see to its perception, and lets offers name photosynthesis; older sessions keep their layouts and never receive photosynthesis candidates. The client draws chloroplasts by efficiency, shows sunlight in the HUD and offers photosynthesis cards. DEV now provisions and serves region 9 with the trial light; region 8 stays stored but unserved. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2202,6 +2202,7 @@ CellularLives::advance_tick_with_mutations(std::span<const CellularLifeIntent> i
|
||||
next->captured = state_->captured;
|
||||
// ADR-0175: light, from this tick's own intentions, credited to every active,
|
||||
// unfrozen photosynthetic survivor's reserve and to the boundary inflow together.
|
||||
std::vector<std::pair<std::uint64_t, std::uint64_t>> lit_lives;
|
||||
if (next->light.numerator != 0) {
|
||||
for (auto& life : next->lives) {
|
||||
const auto left = next->light.entitlement.value - next->captured.value;
|
||||
@@ -2240,6 +2241,8 @@ CellularLives::advance_tick_with_mutations(std::span<const CellularLifeIntent> i
|
||||
next->boundary.incoming.energy.value += granted;
|
||||
next->current_total.energy.value += granted;
|
||||
next->captured.value += granted;
|
||||
if (granted != 0)
|
||||
lit_lives.emplace_back(life.identity.life, granted);
|
||||
}
|
||||
}
|
||||
std::vector<CellularLifeTickFeedback> feedback;
|
||||
@@ -2289,6 +2292,11 @@ CellularLives::advance_tick_with_mutations(std::span<const CellularLifeIntent> i
|
||||
entry->resume_blocked =
|
||||
std::ranges::find(resume_blocked, life.identity.life) != resume_blocked.end();
|
||||
}
|
||||
for (const auto& [life, energy] : lit_lives) {
|
||||
const auto entry = std::ranges::find(feedback, life, &CellularLifeTickFeedback::life_id);
|
||||
if (entry != feedback.end())
|
||||
entry->light = {energy};
|
||||
}
|
||||
std::ranges::sort(feedback, {}, &CellularLifeTickFeedback::life_id);
|
||||
state_.swap(next);
|
||||
last_tick_feedback_ = std::move(feedback);
|
||||
|
||||
@@ -157,7 +157,15 @@ struct RegionSessions::Impl {
|
||||
if (c.state != State::established ||
|
||||
!network::cellular_v10_family(c.protocol_version) || c.account_id != account)
|
||||
continue;
|
||||
const auto bytes = network::encode_session(message, c.protocol_version);
|
||||
auto delivered = message;
|
||||
// ADR-0176: before v12 an offer cannot name photosynthesis; its other choices
|
||||
// stay valid, so those candidates alone are withheld.
|
||||
if (auto* offer = std::get_if<network::CellularMutationOffer>(&delivered))
|
||||
std::erase_if(offer->candidates, [&](const auto& candidate) {
|
||||
return candidate.capability >
|
||||
network::cellular_offer_capability_limit(c.protocol_version);
|
||||
});
|
||||
const auto bytes = network::encode_session(delivered, c.protocol_version);
|
||||
return !bytes.empty() && endpoint->send_message(c.id, bytes).has_value();
|
||||
}
|
||||
return false;
|
||||
@@ -620,7 +628,7 @@ struct RegionSessions::Impl {
|
||||
wire_version == network::session_protocol_v9 ||
|
||||
network::cellular_v10_family(wire_version)) &&
|
||||
!cellular_actions) ||
|
||||
wire_version > network::session_protocol_v11)
|
||||
wire_version > network::session_protocol_v12)
|
||||
return close(c, SessionCloseReason::unsupported_version, now);
|
||||
} else if (wire_version != c.protocol_version) {
|
||||
return close(c, SessionCloseReason::unsupported_version, now);
|
||||
@@ -941,11 +949,17 @@ bool RegionSessions::send_cellular_perception(const network::AccountId& account,
|
||||
continue;
|
||||
c.perceived_tick = perception.tick;
|
||||
auto delivered = perception;
|
||||
// v11 sees deposits (ADR-0136), earlier versions square patches; never both.
|
||||
if (c.protocol_version == network::session_protocol_v11)
|
||||
// v11+ see deposits (ADR-0136), earlier versions square patches; never both.
|
||||
if (network::cellular_deposit_version(c.protocol_version))
|
||||
delivered.patches.clear();
|
||||
else
|
||||
delivered.deposits.clear();
|
||||
// Only v12 carries captured light and visible producers (ADR-0176).
|
||||
if (c.protocol_version != network::session_protocol_v12) {
|
||||
delivered.producers.clear();
|
||||
if (delivered.diagnostics)
|
||||
delivered.diagnostics->light_pj = 0;
|
||||
}
|
||||
if (c.protocol_version == network::session_protocol_v8)
|
||||
delivered.diagnostics.reset();
|
||||
if (c.protocol_version == network::session_protocol_v9 && delivered.diagnostics) {
|
||||
|
||||
Reference in New Issue
Block a user