Mounts v2 (#726)

* Mounts -v2

* fix stun state and make comments a bit nicer

* remove extra serilization

* update the char position a bit more correctly

* make vehicles face thr player's direction

* address feedback

* fix compiling for real this time

* removed uneeded check
This commit is contained in:
Aaron Kimbrell
2022-09-02 13:49:19 -05:00
committed by GitHub
parent 1af3e59348
commit 26f2eb409f
22 changed files with 480 additions and 245 deletions

View File

@@ -26,6 +26,8 @@
#include "MissionComponent.h"
#include "CharacterComponent.h"
#include "PossessableComponent.h"
#include "PossessorComponent.h"
#include "dZoneManager.h"
DestroyableComponent::DestroyableComponent(Entity* parent) : Component(parent) {
@@ -608,6 +610,24 @@ void DestroyableComponent::Damage(uint32_t damage, const LWOOBJID source, uint32
SetHealth(health);
SetIsShielded(absorb > 0);
// Dismount on the possessable hit
auto possessable = m_Parent->GetComponent<PossessableComponent>();
if (possessable && possessable->GetDepossessOnHit()) {
possessable->Dismount();
}
// Dismount on the possessor hit
auto possessor = m_Parent->GetComponent<PossessorComponent>();
if (possessor) {
auto possessableId = possessor->GetPossessable();
if (possessableId != LWOOBJID_EMPTY) {
auto possessable = EntityManager::Instance()->GetEntity(possessableId);
if (possessable) {
possessor->Dismount(possessable);
}
}
}
if (m_Parent->GetLOT() != 1) {
echo = true;
}