mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 10:53:44 +00:00
fix(destroyable): take template factions from factionList, keeping -1
The client reads an object's factions only from the DestructibleComponent factionList (LWODestroyableComponent::LoadDataFromTemplate 0x00c9f900: one atol per comma-separated token, -1 kept; the faction column is not read), and live replicated that list: [-1] on 12,829 constructions (vendors, quickbuilds, bouncers). DLU added the faction column and dropped -1, so those objects were sent with no factions, and the four rows with faction 6 but factionList "-1" were sent as [6]. -1 has no Factions row, so it adds no friends or enemies. Test: ReplicaConstructionTest.TemplateFactionMinusOneIsReplicated. Check in game: vendors, quickbuilds, bouncers and NPCs still can't be attacked; enemies still fight players and pets; smashables still smash. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -357,6 +357,18 @@ void DestroyableComponent::SetIsShielded(bool value) {
|
||||
m_IsShielded = value;
|
||||
}
|
||||
|
||||
void DestroyableComponent::AddTemplateFactions(const std::string& factionList) {
|
||||
// The client (LWODestroyableComponent::LoadDataFromTemplate) and live took the factions from the row's factionList,
|
||||
// -1 included (live replicated it as [-1]); the faction column is not used.
|
||||
std::stringstream ss(factionList);
|
||||
std::string token;
|
||||
|
||||
while (std::getline(ss, token, ',')) {
|
||||
const auto faction = GeneralUtils::TryParse<int32_t>(token);
|
||||
if (faction) AddFaction(faction.value(), faction.value() == -1);
|
||||
}
|
||||
}
|
||||
|
||||
void DestroyableComponent::AddFaction(const int32_t factionID, const bool ignoreChecks) {
|
||||
// Ignore factionID -1
|
||||
if (factionID == -1 && !ignoreChecks) return;
|
||||
|
||||
Reference in New Issue
Block a user