Implement solo-cell logic to suppress transform packet sends and remote proxy representation while the local player is in COVault109, allowing first-time character creation to remain visually single-player. One entry location update is sent so other clients can hold stale proxies before suppression begins. Added F4TSoloCell.h helper for load-order-independent solo cell recognition by editor ID and cached FormID.
41 lines
999 B
C++
41 lines
999 B
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <optional>
|
|
#include <string_view>
|
|
|
|
namespace F4T::SoloCell
|
|
{
|
|
inline constexpr auto kVault109EditorId = "COVault109";
|
|
|
|
inline std::optional<std::uint32_t>& GetVault109CellIdCache()
|
|
{
|
|
static std::optional<std::uint32_t> s_vault109CellId;
|
|
return s_vault109CellId;
|
|
}
|
|
|
|
inline bool HasEditorId(const RE::TESObjectCELL& a_cell, std::string_view a_editorId)
|
|
{
|
|
const auto* cellEditorId = a_cell.GetFormEditorID();
|
|
return cellEditorId && a_editorId == cellEditorId;
|
|
}
|
|
|
|
inline bool IsSoloCell(const RE::TESObjectCELL& a_cell)
|
|
{
|
|
if (HasEditorId(a_cell, kVault109EditorId)) {
|
|
return true;
|
|
}
|
|
|
|
auto& vault109CellId = GetVault109CellIdCache();
|
|
if (!vault109CellId) {
|
|
const auto* vault109Cell = RE::TESForm::GetFormByEditorID<RE::TESObjectCELL>(
|
|
RE::BSFixedString{ kVault109EditorId });
|
|
if (vault109Cell) {
|
|
vault109CellId = vault109Cell->GetFormID();
|
|
}
|
|
}
|
|
|
|
return vault109CellId && a_cell.GetFormID() == *vault109CellId;
|
|
}
|
|
}
|