mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-12-12 19:18:28 +00:00
move IsDead to the DestroyableComponent
This commit is contained in:
@@ -1378,7 +1378,7 @@ void Entity::OnCollisionPhantom(const LWOOBJID otherEntity) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!other->GetIsDead()) {
|
||||
if (!other->GetComponent<DestroyableComponent>()->GetIsDead()) {
|
||||
if (GetComponent<BaseCombatAIComponent>() != nullptr) {
|
||||
const auto index = std::find(m_TargetsInPhantom.begin(), m_TargetsInPhantom.end(), otherEntity);
|
||||
|
||||
@@ -1606,13 +1606,6 @@ void Entity::AddQuickBuildCompleteCallback(const std::function<void(Entity* user
|
||||
}
|
||||
}
|
||||
|
||||
bool Entity::GetIsDead() const {
|
||||
DestroyableComponent* dest = GetComponent<DestroyableComponent>();
|
||||
if (dest && dest->GetArmor() == 0 && dest->GetHealth() == 0) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Entity::AddLootItem(const Loot::Info& info) {
|
||||
if (!IsPlayer()) return;
|
||||
|
||||
|
||||
@@ -82,8 +82,6 @@ public:
|
||||
|
||||
const std::vector<LDFBaseData*>& GetNetworkSettings() const { return m_NetworkSettings; }
|
||||
|
||||
bool GetIsDead() const;
|
||||
|
||||
bool GetPlayerReadyForUpdates() const { return m_PlayerIsReadyForUpdates; }
|
||||
|
||||
bool GetIsGhostingCandidate() const;
|
||||
|
||||
@@ -227,7 +227,7 @@ void BasicAttackBehavior::DoBehaviorCalculation(BehaviorContext* context, RakNet
|
||||
|
||||
bitStream.Write(armorDamageDealt);
|
||||
bitStream.Write(healthDamageDealt);
|
||||
bitStream.Write(targetEntity->GetIsDead());
|
||||
bitStream.Write(targetEntity->GetComponent<DestroyableComponent>()->GetIsDead());
|
||||
}
|
||||
|
||||
bitStream.Write(successState);
|
||||
|
||||
@@ -116,7 +116,7 @@ void TacArcBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitS
|
||||
for (auto validTarget : validTargets) {
|
||||
if (targets.size() >= this->m_maxTargets) break;
|
||||
if (std::find(targets.begin(), targets.end(), validTarget) != targets.end()) continue;
|
||||
if (validTarget->GetIsDead()) continue;
|
||||
if (validTarget->GetComponent<DestroyableComponent>()->GetIsDead()) continue;
|
||||
|
||||
const auto targetPos = validTarget->GetPosition();
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ void BaseCombatAIComponent::Update(const float deltaTime) {
|
||||
m_SoftTimer -= deltaTime;
|
||||
}
|
||||
|
||||
if (m_Disabled || m_Parent->GetIsDead())
|
||||
if (m_Disabled || m_Parent->GetComponent<DestroyableComponent>()->GetIsDead())
|
||||
return;
|
||||
bool stunnedThisFrame = m_Stunned;
|
||||
CalculateCombat(deltaTime); // Putting this here for now
|
||||
|
||||
@@ -160,7 +160,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream& inStream, const System
|
||||
}
|
||||
|
||||
//Kill player if health == 0
|
||||
if (entity->GetIsDead()) {
|
||||
if (entity->GetComponent<DestroyableComponent>()->GetIsDead()) {
|
||||
entity->Smash(entity->GetObjectID());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user