mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 02:43:44 +00:00
A placed model's client (1.10.64, UGCUSE3DSERVICES=7:0) always loads its blueprint's NIF and HKX (its BlueprintComponent sets renderUserGen and physicsUserGen itself) and its LXFML, asks the world for each file's manifest first and waits for the answer with no timeout. With ugc_manifest=1 and the new ugc_manifest_models=1 (default 0) the world: - leaves the models whose mesh the UGC server made out of the LXFML it sends when a property loads, - answers their NIF with the UGC server's checksum, their LXFML with the stored LXFML's (worked out once and kept) and their HKX as not known, - sends a model that isn't made its LXFML (once for the three requests), so the client builds it itself and no model is left waiting. When the UGC server writes a model's mesh with a new checksum it sends UGC_MODELS_MADE (a new master message, appended) to the master, which passes it to every world; a world with that model placed sends its players the new NIF checksum and NotifyClientUGCModelReady (game message 909, the blueprint id), so clients switch to the served mesh. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
43 lines
1.3 KiB
C++
43 lines
1.3 KiB
C++
#ifndef __UGCMODELSMADE__H__
|
|
#define __UGCMODELSMADE__H__
|
|
|
|
#include <algorithm>
|
|
#include <cstdint>
|
|
#include <vector>
|
|
|
|
#include "BitStream.h"
|
|
#include "BitStreamUtils.h"
|
|
#include "MessageType/Master.h"
|
|
#include "dCommonVars.h"
|
|
|
|
/**
|
|
* UGC_MODELS_MADE payload (UGC server -> master -> every world): the player models (their ugc id, which is the
|
|
* blueprint id) whose mesh the UGC server just made or made again. A world showing one of them tells its clients the
|
|
* new checksum and sends NotifyClientUGCModelReady, so they load the served mesh (docs/UgcServer.md).
|
|
*/
|
|
struct UgcModelsMade : public LUBitStream {
|
|
UgcModelsMade() : LUBitStream(ServiceType::MASTER, MessageType::Master::UGC_MODELS_MADE) {}
|
|
|
|
static constexpr size_t MAX_MODELS = 4096;
|
|
|
|
std::vector<LWOOBJID> blueprintIds;
|
|
|
|
void Serialize(RakNet::BitStream& stream) const override {
|
|
const auto count = static_cast<uint16_t>(std::min(blueprintIds.size(), MAX_MODELS));
|
|
stream.Write(count);
|
|
for (size_t i = 0; i < count; i++) stream.Write(blueprintIds[i]);
|
|
}
|
|
|
|
bool Deserialize(RakNet::BitStream& stream) override {
|
|
uint16_t count{};
|
|
if (!stream.Read(count) || count > MAX_MODELS) return false;
|
|
blueprintIds.resize(count);
|
|
for (auto& id : blueprintIds) {
|
|
if (!stream.Read(id)) return false;
|
|
}
|
|
return true;
|
|
}
|
|
};
|
|
|
|
#endif //!__UGCMODELSMADE__H__
|