feat(admin): region page redesign, resource ledger, drip and dark mode
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (postgres) (push) Successful in 4s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 4m40s
Foundation / postgres-tools (push) Successful in 30s
Foundation / server-image (push) Successful in 4m46s
Foundation / image (push) Successful in 5m34s
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (postgres) (push) Successful in 4s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 4m40s
Foundation / postgres-tools (push) Successful in 30s
Foundation / server-image (push) Successful in 4m46s
Foundation / image (push) Successful in 5m34s
The region view adds the rules-13 drip and complete counts and totals over every life and deposit. The region page is rebuilt around the map: a KPI strip (tick pace, population, deposit capacity, region energy and matter, spent pool, next drip), layer toggles that double as the legend, zoom and a scale, and tabs for inspecting cells and deposits, resources (where each channel sits, the spent pool and each channel's next drip), actions, the running tuning and session access. The admin API serves the region tuning file read only (--region-tuning). Light and dark themes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -810,6 +810,8 @@ OpsResponse AdminApi::tuning() {
|
||||
out += "{\"text\":" + json_string(config_.baseline_tuning) + ",\"rules_sha256\":" +
|
||||
(checked ? "\"" + hex(checked->digest) + "\"" : std::string{"null"}) + "}";
|
||||
}
|
||||
out += ",\"region_file\":";
|
||||
out += config_.region_tuning.empty() ? std::string{"null"} : json_string(config_.region_tuning);
|
||||
out += ",\"newest\":";
|
||||
if (newest->empty())
|
||||
out += "null";
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "evo/server/lifecycle/cellular_admin_view.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
@@ -17,6 +18,25 @@ void append_inventory(std::string& out, const accounting::Inventory& inventory)
|
||||
append(out, channel.value);
|
||||
}
|
||||
}
|
||||
// Energy then the four matter channels, summed without the inventory's overflow checks: a
|
||||
// region's stock is far below 2^64 in every channel.
|
||||
using Totals = std::array<std::uint64_t, 5>;
|
||||
void add(Totals& totals, const accounting::Inventory& inventory) {
|
||||
totals[0] += inventory.energy.value;
|
||||
for (std::size_t i = 0; i < inventory.matter.size(); ++i)
|
||||
totals[i + 1] += inventory.matter[i].value;
|
||||
}
|
||||
void append_totals(std::string& out, std::string_view name, const Totals& totals) {
|
||||
out += "\"";
|
||||
out += name;
|
||||
out += "\":[";
|
||||
for (std::size_t i = 0; i < totals.size(); ++i) {
|
||||
if (i != 0)
|
||||
out.push_back(',');
|
||||
append(out, totals[i]);
|
||||
}
|
||||
out.push_back(']');
|
||||
}
|
||||
} // namespace
|
||||
|
||||
std::string cellular_account_text(const LifeAccount& account) {
|
||||
@@ -60,11 +80,56 @@ std::string render_cellular_admin_view(const CellularLives& state,
|
||||
append(out, state.area().height_um);
|
||||
out += "],\"spent\":[";
|
||||
append_inventory(out, state.spent());
|
||||
out += "],\"cells_total\":";
|
||||
out.push_back(']');
|
||||
if (state.rules_version() >= cellular_lives_revamp_rules) {
|
||||
const auto& rules = state.revamp_rules();
|
||||
out += ",\"drip\":[";
|
||||
append(out, rules.drip_interval_ticks);
|
||||
out.push_back(',');
|
||||
append(out, rules.drip_bubble_pj);
|
||||
out.push_back(',');
|
||||
append(out, rules.drip_bubble_fg);
|
||||
out.push_back(']');
|
||||
}
|
||||
out += ",\"cells_total\":";
|
||||
append(out, lives.size());
|
||||
out += ",\"deposits_total\":";
|
||||
append(out, patches.size());
|
||||
|
||||
// Counts and stock over every life and deposit, beyond the listing limits.
|
||||
std::array<std::uint64_t, 5> counts{}; // Players, wildlife, patches, pools, bubbles.
|
||||
Totals reserve{}, body{};
|
||||
std::array<Totals, 3> deposits_by_kind{};
|
||||
for (const auto& life : lives) {
|
||||
++counts[life.account == LifeAccount{} ? 1 : 0];
|
||||
add(reserve, life.reserve);
|
||||
add(body, life.body);
|
||||
}
|
||||
for (const auto& patch : patches) {
|
||||
const auto kind = static_cast<std::size_t>(patch.kind);
|
||||
if (kind < deposits_by_kind.size()) {
|
||||
++counts[2 + kind];
|
||||
add(deposits_by_kind[kind], patch.stock);
|
||||
}
|
||||
}
|
||||
out += ",\"counts\":[";
|
||||
for (std::size_t i = 0; i < counts.size(); ++i) {
|
||||
if (i != 0)
|
||||
out.push_back(',');
|
||||
append(out, counts[i]);
|
||||
}
|
||||
out += "],\"totals\":{";
|
||||
append_totals(out, "reserve", reserve);
|
||||
out.push_back(',');
|
||||
append_totals(out, "body", body);
|
||||
out.push_back(',');
|
||||
append_totals(out, "patches", deposits_by_kind[0]);
|
||||
out.push_back(',');
|
||||
append_totals(out, "pools", deposits_by_kind[1]);
|
||||
out.push_back(',');
|
||||
append_totals(out, "bubbles", deposits_by_kind[2]);
|
||||
out.push_back('}');
|
||||
|
||||
// Lives are kept in ascending life id; a prefix is the lowest ids.
|
||||
out += ",\"cells\":[";
|
||||
const auto cells = std::min(lives.size(), limits.cells);
|
||||
|
||||
Reference in New Issue
Block a user