Organize Entity header

Probably the third or fourth pass of this darn header...  Just keep making it better every time
Rename some functions to make more sense to a reader
Use different method for Observing/subscribing to component events
Get rid of abomination of overloading GetParentUser
This commit is contained in:
David Markowitz
2023-06-16 01:56:02 -07:00
parent 92006123b8
commit 891648288a
23 changed files with 126 additions and 102 deletions

View File

@@ -3,7 +3,7 @@
#include "Entity.h"
void ActPlayerDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target) {
if (!target->IsPlayer() || target->GetIsDead() || !target->GetPlayerReadyForUpdates()) return; //Don't kill already dead players or players not ready
if (!target->IsPlayer() || target->IsDead() || !target->GetPlayerReadyForUpdates()) return; //Don't kill already dead players or players not ready
target->Smash(self->GetObjectID(), eKillType::SILENT);
}

View File

@@ -11,7 +11,7 @@ void ActSharkPlayerDeathTrigger::OnFireEventServerSide(Entity* self, Entity* sen
missionComponent->Progress(eMissionTaskType::SCRIPT, 8419);
if (sender->GetIsDead() || !sender->GetPlayerReadyForUpdates()) return; //Don't kill already dead players or players not ready
if (sender->IsDead() || !sender->GetPlayerReadyForUpdates()) return; //Don't kill already dead players or players not ready
if (sender->GetCharacter()) {
sender->Smash(self->GetObjectID(), eKillType::VIOLENT, u"big-shark-death");

View File

@@ -2,7 +2,7 @@
#include "Entity.h"
void AgShipPlayerDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target) {
if (target->GetLOT() == 1 && !target->GetIsDead()) {
if (target->GetLOT() == 1 && !target->IsDead()) {
target->Smash(self->GetObjectID(), eKillType::VIOLENT, u"electro-shock-death");
}
}

View File

@@ -28,7 +28,7 @@ void TriggerGas::OnTimerDone(Entity* self, std::string timerName) {
if (timerName != this->m_TimerName) return;
auto players = self->GetVar<std::vector<Entity*>>(u"players");
for (auto player : players) {
if (player->GetIsDead() || !player){
if (player->IsDead() || !player){
auto position = std::find(players.begin(), players.end(), player);
if (position != players.end()) players.erase(position);
continue;

View File

@@ -45,7 +45,7 @@ void PetDigBuild::OnDie(Entity* self, Entity* killer) {
return;
// If the quick build expired and the treasure was not collected, hide the treasure
if (!treasure->GetIsDead()) {
if (!treasure->IsDead()) {
treasure->Smash(self->GetObjectID(), eKillType::SILENT);
}
}

View File

@@ -27,7 +27,7 @@ void NsConcertInstrument::OnRebuildNotifyState(Entity* self, eRebuildState state
}
void NsConcertInstrument::OnRebuildComplete(Entity* self, Entity* target) {
if (!target->GetIsDead()) {
if (!target->IsDead()) {
self->SetVar<LWOOBJID>(u"activePlayer", target->GetObjectID());
self->AddCallbackTimer(0.2f, [self, target]() {