mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 10:53:44 +00:00
feat(ugc): icon light matched to the game, debounce, shared car icons, purge, icon editor
Brighter icons: a world light, a fill from the camera, a highlight, exposure and contrast; with the defaults the icons' mean luminance matches the game's own model icons (118 against 120 on a scratch set). Every icon parameter is listed once (UgcIconParams: key, setting, range, default); the settings, the dashboard's settings entries and the icon editor come from that list. Presets per kind (player models, each car or rocket build type from ModularBuildComponent) and overrides per model or module combination are in ugc_icon_settings. Saved models wait ugc_debounce_seconds (sharedconfig) after the owner's last save before they're made (ugc.process_after); a client asking for one, the owner leaving the world or a reset ends the wait. Cars and rockets: one icon per combination of modules (sorted LOTs), shared by every build of it; builds of a combination made already are marked made right away, the client's per-blueprint downloads serve the shared files. The dashboard can delete one item's files, purge by filter or all, preview icons with any values on the UGC server (/admin routes, master password), save presets and overrides, and draw a kind's icons again (icons only). Migrations dlu/mysql/86 and dlu/sqlite/69. Not done yet: the dashboard editor's lighting controls in the page script (routes are there), docs for it, the empty-model state, /ugc?item= links, the shared fetch helper; the storage size and property loading bugs are next. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -87,3 +87,28 @@ std::vector<std::pair<IUgc::eProcessState, uint64_t>> SQLiteDatabase::GetModular
|
||||
}
|
||||
return counts;
|
||||
}
|
||||
|
||||
std::vector<std::pair<std::string, uint64_t>> SQLiteDatabase::GetModularBuildConfigCounts() {
|
||||
auto [_, result] = ExecuteSelect("SELECT ldf_config, COUNT(*) AS count FROM ugc_modular_build GROUP BY ldf_config;");
|
||||
std::vector<std::pair<std::string, uint64_t>> counts;
|
||||
while (!result.eof()) {
|
||||
counts.emplace_back(result.getStringField("ldf_config", ""), static_cast<uint64_t>(result.getInt64Field("count")));
|
||||
result.nextRow();
|
||||
}
|
||||
return counts;
|
||||
}
|
||||
|
||||
std::optional<std::string> SQLiteDatabase::GetUgcIconSettings(const std::string_view target) {
|
||||
auto [_, result] = ExecuteSelect("SELECT params FROM ugc_icon_settings WHERE target = ? LIMIT 1;", target);
|
||||
if (result.eof()) return std::nullopt;
|
||||
return std::string(result.getStringField("params", ""));
|
||||
}
|
||||
|
||||
void SQLiteDatabase::SetUgcIconSettings(const std::string_view target, const std::string_view params) {
|
||||
ExecuteInsert("INSERT INTO ugc_icon_settings (target, params, updated_at) VALUES (?, ?, ?) "
|
||||
"ON CONFLICT(target) DO UPDATE SET params = excluded.params, updated_at = excluded.updated_at;", target, params, UnixNow());
|
||||
}
|
||||
|
||||
void SQLiteDatabase::DeleteUgcIconSettings(const std::string_view target) {
|
||||
ExecuteDelete("DELETE FROM ugc_icon_settings WHERE target = ?;", target);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user