mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-14 11:28:08 +00:00
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:
@@ -16,7 +16,7 @@ void BaseEnemyApe::OnStartup(Entity* self) {
|
||||
|
||||
void BaseEnemyApe::OnDie(Entity* self, Entity* killer) {
|
||||
auto* anchor = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"QB"));
|
||||
if (anchor != nullptr && !anchor->GetIsDead()) {
|
||||
if (anchor != nullptr && !anchor->IsDead()) {
|
||||
anchor->Smash(self->GetObjectID(), eKillType::SILENT);
|
||||
}
|
||||
}
|
||||
|
@@ -152,13 +152,13 @@ void AmSkullkinDrill::FreezePlayer(Entity* self, Entity* player, bool bFreeze) {
|
||||
auto StateChangeType = eStateChangeType::POP;
|
||||
|
||||
if (bFreeze) {
|
||||
if (player->GetIsDead()) {
|
||||
if (player->IsDead()) {
|
||||
return;
|
||||
}
|
||||
|
||||
StateChangeType = eStateChangeType::PUSH;
|
||||
} else {
|
||||
if (player->GetIsDead()) {
|
||||
if (player->IsDead()) {
|
||||
//
|
||||
}
|
||||
}
|
||||
|
@@ -54,7 +54,7 @@ void AgSurvivalBuffStation::OnTimerDone(Entity* self, std::string timerName) {
|
||||
auto team = self->GetVar<std::vector<LWOOBJID>>(u"BuilderTeam");
|
||||
for (auto memberID : team) {
|
||||
auto member = EntityManager::Instance()->GetEntity(memberID);
|
||||
if (member != nullptr && !member->GetIsDead()) {
|
||||
if (member != nullptr && !member->IsDead()) {
|
||||
GameMessages::SendDropClientLoot(member, self->GetObjectID(), powerupToDrop, 0, self->GetPosition());
|
||||
} else {
|
||||
// If player left the team or left early erase them from the team variable.
|
||||
|
@@ -312,7 +312,7 @@ bool BaseSurvivalServer::CheckAllPlayersDead() {
|
||||
|
||||
for (const auto& playerID : state.players) {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
if (player == nullptr || player->GetIsDead()) {
|
||||
if (player == nullptr || player->IsDead()) {
|
||||
deadPlayers++;
|
||||
}
|
||||
}
|
||||
|
@@ -310,7 +310,7 @@ bool BaseWavesServer::CheckAllPlayersDead() {
|
||||
|
||||
for (const auto& playerID : state.players) {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
if (player == nullptr || player->GetIsDead()) {
|
||||
if (player == nullptr || player->IsDead()) {
|
||||
deadPlayers++;
|
||||
}
|
||||
}
|
||||
@@ -430,7 +430,7 @@ void BaseWavesServer::SpawnWave(Entity* self) {
|
||||
|
||||
for (const auto& playerID : state.players) {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
if (player && player->GetIsDead()) {
|
||||
if (player && player->IsDead()) {
|
||||
player->Resurrect();
|
||||
}
|
||||
}
|
||||
@@ -500,7 +500,7 @@ bool BaseWavesServer::UpdateSpawnedEnemies(Entity* self, LWOOBJID enemyID, uint3
|
||||
|
||||
for (const auto& playerID : state.players) {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
if (player != nullptr && !player->GetIsDead()) {
|
||||
if (player != nullptr && !player->IsDead()) {
|
||||
SetActivityValue(self, playerID, 1, currentTime);
|
||||
SetActivityValue(self, playerID, 2, state.waveNumber);
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
#include "SkillComponent.h"
|
||||
|
||||
void CoilBackpackBase::OnFactionTriggerItemEquipped(Entity* itemOwner, LWOOBJID itemObjId) {
|
||||
itemOwner->Subscribe(itemObjId, this, "HitOrHealResult");
|
||||
itemOwner->Subscribe(this, "HitOrHealResult");
|
||||
itemOwner->SetVar<uint8_t>(u"coilCount", 0);
|
||||
}
|
||||
|
||||
@@ -21,5 +21,5 @@ void CoilBackpackBase::NotifyHitOrHealResult(Entity* self, Entity* attacker, int
|
||||
}
|
||||
|
||||
void CoilBackpackBase::OnFactionTriggerItemUnequipped(Entity* itemOwner, LWOOBJID itemObjId) {
|
||||
itemOwner->Unsubscribe(itemObjId, "HitOrHealResult");
|
||||
itemOwner->Unsubscribe(this, "HitOrHealResult");
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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");
|
||||
|
@@ -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");
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -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]() {
|
||||
|
Reference in New Issue
Block a user