mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-20 19:52:48 +00:00
fix(factions): override_faction 0 keeps the template's factions
The client (LWODestroyableComponent::LoadConfigData 0x00c44cb0) uses a level object's set_faction only when override_faction is absent or true; with override_faction=0 LoadDataFromTemplate (0x00c9f900) puts the DestructibleComponent factionList back. 2948 level objects have override_faction=0, and DLU applied their set_faction anyway. The resolution is now DestroyableComponent::GetLevelFactions, with tests. No wire change. In game: enemies and smashables placed in levels with a set_faction but override_faction=0 (most smashables, many enemies) are targeted and aggro as before for the common case; check a few enemies in AG/GF/FV still fight you and friendly objects are not attacked, and that smashables still smash and give credit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#define DESTROYABLECOMPONENT_H
|
||||
|
||||
#include "RakNetTypes.h"
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
#include "tinyxml2.h"
|
||||
#include "Entity.h"
|
||||
@@ -368,6 +369,14 @@ public:
|
||||
|
||||
void SetCurrencyIndex(int32_t currencyIndex) { m_CurrencyIndex = currencyIndex; }
|
||||
|
||||
/**
|
||||
* The factions a level object's set_faction gives it in place of the template's, resolved as the client does
|
||||
* (LWODestroyableComponent::LoadConfigData 0x00c44cb0, LoadDataFromTemplate 0x00c9f900): set_faction is used
|
||||
* unless override_faction is present and false. The value is split on ';' and ' '.
|
||||
* @return the factions, or nullopt when the template's factions stay
|
||||
*/
|
||||
static std::optional<std::vector<int32_t>> GetLevelFactions(const Entity& entity);
|
||||
|
||||
/**
|
||||
* Returns the ID of the entity that killed this entity, if any
|
||||
* @return the ID of the entity that killed this entity, if any
|
||||
|
||||
Reference in New Issue
Block a user