diff --git a/dDatabase/CDClientDatabase/CDClientTables/CDDestructibleComponentTable.cpp b/dDatabase/CDClientDatabase/CDClientTables/CDDestructibleComponentTable.cpp index b1a6f699f..51df8ce84 100644 --- a/dDatabase/CDClientDatabase/CDClientTables/CDDestructibleComponentTable.cpp +++ b/dDatabase/CDClientDatabase/CDClientTables/CDDestructibleComponentTable.cpp @@ -31,7 +31,7 @@ void CDDestructibleComponentTable::LoadValuesFromDatabase() { entry.armor = tableData.getFloatField("armor", -1.0f); entry.death_behavior = tableData.getIntField("death_behavior", -1); entry.isnpc = tableData.getIntField("isnpc", -1) == 1 ? true : false; - entry.attack_priority = tableData.getIntField("attack_priority", -1); + entry.attack_priority = tableData.getIntField("attack_priority", 1); entry.isSmashable = tableData.getIntField("isSmashable", -1) == 1 ? true : false; entry.difficultyLevel = tableData.getIntField("difficultyLevel", -1); diff --git a/dDatabase/CDClientDatabase/CDClientTables/CDDestructibleComponentTable.h b/dDatabase/CDClientDatabase/CDClientTables/CDDestructibleComponentTable.h index 3319907b1..f446a93e5 100644 --- a/dDatabase/CDClientDatabase/CDClientTables/CDDestructibleComponentTable.h +++ b/dDatabase/CDClientDatabase/CDClientTables/CDDestructibleComponentTable.h @@ -15,7 +15,7 @@ struct CDDestructibleComponent { float armor; //!< The amount of armor of the object uint32_t death_behavior; //!< The behavior ID of the death behavior bool isnpc; //!< Whether or not the object is an NPC - uint32_t attack_priority; //!< ??? + int32_t attack_priority; //!< TacArc target order, lower first; 1 when unset bool isSmashable; //!< Whether or not the object is smashable int32_t difficultyLevel; //!< ??? }; diff --git a/dGame/Entity.cpp b/dGame/Entity.cpp index 0ebd81883..3bc70aa6e 100644 --- a/dGame/Entity.cpp +++ b/dGame/Entity.cpp @@ -439,6 +439,7 @@ void Entity::Initialize() { comp->SetIsSmashable(comp->GetIsSmashable() || destCompData[0].isSmashable); comp->SetIsNPC(destCompData[0].isnpc); + comp->SetAttackPriority(destCompData[0].attack_priority); comp->SetLootMatrixID(destCompData[0].LootMatrixIndex); comp->SetCurrencyIndex(destCompData[0].CurrencyIndex); diff --git a/dGame/dComponents/DestroyableComponent.h b/dGame/dComponents/DestroyableComponent.h index 7fcd439c0..ccb962bf7 100644 --- a/dGame/dComponents/DestroyableComponent.h +++ b/dGame/dComponents/DestroyableComponent.h @@ -253,6 +253,12 @@ public: void SetIsNPC(bool value) { m_IsNPC = value; } bool GetIsNPC() const { return m_IsNPC; } + /** + * The DestructibleComponent's attack_priority: TacArcs that use attack priority target lower values first + */ + void SetAttackPriority(const int32_t value) { m_AttackPriority = value; } + int32_t GetAttackPriority() const { return m_AttackPriority; } + /** * Returns the current is-dead value, this is mostly unused * @return the current is-dead value, this is mostly unused @@ -606,6 +612,9 @@ private: bool m_IsNPC = false; + // The client's LWODestroyableComponent starts at 1 and keeps it when the column is empty + int32_t m_AttackPriority = 1; + /** * Whether this entity is dead. Unused, here for serialization */