mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 10:53:44 +00:00
fix(ugc): served player models keep the client's own collision
With ugc_manifest_models the world left made models out of the LXFML it sends when a property loads, so the client never built them and had no HKX: the UGC server makes no physics, and the HKX request got a 404, so served models had no collision. Now every model's LXFML is sent and the client builds each one (NIF and HKX). For the models whose mesh the UGC server made, once the client has loaded and 3 seconds after, the world sends it the served NIF's checksum and NotifyClientUGCModelReady: the client drops what it cached for the model and asks again, downloads the served mesh (its own NIF no longer matches) and keeps its own HKX (still matching). An HKX request is answered with the LXFML too, followed by the same switch, at most 3 times per client and model. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1033,8 +1033,8 @@ void LoadPlayer(const SystemAddress& sysAddr) {
|
||||
}
|
||||
|
||||
// The models' LXFML, for the client to build each model's NIF and HKX itself. With ugc_manifest_models
|
||||
// the models whose mesh the UGC server made are left out: the client asks for their files and downloads
|
||||
// the mesh (UgcManifest, docs/UgcServer.md).
|
||||
// the models whose mesh the UGC server made are then switched to the served mesh, keeping the client's
|
||||
// own physics (UgcManifest, docs/UgcServer.md).
|
||||
|
||||
auto bbbModels = Database::Get()->GetUgcModels(propertyId);
|
||||
if (bbbModels.empty()) {
|
||||
@@ -1047,10 +1047,7 @@ void LoadPlayer(const SystemAddress& sysAddr) {
|
||||
response.reasonCode = eBlueprintSaveResponseType::EverythingWorked;
|
||||
size_t served = 0;
|
||||
for (auto& bbbModel : bbbModels) {
|
||||
if (!UgcManifest::ClientBuildsModel(bbbModel.id)) {
|
||||
served++;
|
||||
continue;
|
||||
}
|
||||
if (UgcManifest::ScheduleServedMesh(sysAddr, bbbModel.id)) served++;
|
||||
LOG("Getting lxfml ugcID: %llu", bbbModel.id);
|
||||
|
||||
bbbModel.lxfmlData.seekg(0, std::ios::end);
|
||||
@@ -1062,7 +1059,7 @@ void LoadPlayer(const SystemAddress& sysAddr) {
|
||||
model.blueprintId = bbbModel.id;
|
||||
model.data = bbbModel.lxfmlData.str().substr(0, lxfmlSize);
|
||||
}
|
||||
if (served > 0) LOG("%zu of the property's %zu models come from the UGC server", served, bbbModels.size());
|
||||
if (served > 0) LOG("%zu of the property's %zu models get their mesh from the UGC server once built", served, bbbModels.size());
|
||||
if (!response.models.empty()) response.Send(sysAddr);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user