Make logger automatically put a newline (#675)

at the end of the line
remove all the newlines in log calls
This commit is contained in:
Aaron Kimbrell
2022-07-24 21:26:51 -05:00
committed by GitHub
parent a7fb6eb3f3
commit e97ae92624
86 changed files with 1249 additions and 1252 deletions

View File

@@ -37,7 +37,7 @@ void AreaOfEffectBehavior::Handle(BehaviorContext* context, RakNet::BitStream* b
for (auto target : targets)
{
branch.target = target;
this->m_action->Handle(context, bitStream, branch);
}
}
@@ -48,7 +48,7 @@ void AreaOfEffectBehavior::Calculate(BehaviorContext* context, RakNet::BitStream
if (self == nullptr)
{
Game::logger->Log("TacArcBehavior", "Invalid self for (%llu)!\n", context->originator);
Game::logger->Log("TacArcBehavior", "Invalid self for (%llu)!", context->originator);
return;
}
@@ -81,7 +81,7 @@ void AreaOfEffectBehavior::Calculate(BehaviorContext* context, RakNet::BitStream
if (entity == nullptr)
{
Game::logger->Log("TacArcBehavior", "Invalid target (%llu) for (%llu)!\n", validTarget, context->originator);
Game::logger->Log("TacArcBehavior", "Invalid target (%llu) for (%llu)!", validTarget, context->originator);
continue;
}
@@ -90,7 +90,7 @@ void AreaOfEffectBehavior::Calculate(BehaviorContext* context, RakNet::BitStream
{
continue;
}
auto* destroyableComponent = entity->GetComponent<DestroyableComponent>();
if (destroyableComponent == nullptr)
@@ -120,7 +120,7 @@ void AreaOfEffectBehavior::Calculate(BehaviorContext* context, RakNet::BitStream
});
const uint32_t size = targets.size();
bitStream->Write(size);
if (size == 0)
@@ -133,10 +133,10 @@ void AreaOfEffectBehavior::Calculate(BehaviorContext* context, RakNet::BitStream
for (auto* target : targets)
{
bitStream->Write(target->GetObjectID());
PlayFx(u"cast", context->originator, target->GetObjectID());
}
for (auto* target : targets)
{
branch.target = target->GetObjectID();

View File

@@ -21,7 +21,7 @@ void BasicAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bi
return;
}
bitStream->AlignReadToByteBoundary();
uint16_t allocatedBits;
@@ -69,7 +69,7 @@ void BasicAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bi
this->m_onSuccess->Handle(context, bitStream, branch);
break;
default:
Game::logger->Log("BasicAttackBehavior", "Unknown success state (%i)!\n", successState);
Game::logger->Log("BasicAttackBehavior", "Unknown success state (%i)!", successState);
break;
}
@@ -79,10 +79,10 @@ void BasicAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bi
void BasicAttackBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
auto* self = EntityManager::Instance()->GetEntity(context->originator);
if (self == nullptr) {
Game::logger->Log("BasicAttackBehavior", "Invalid self entity (%llu)!\n", context->originator);
Game::logger->Log("BasicAttackBehavior", "Invalid self entity (%llu)!", context->originator);
return;
}
bitStream->AlignWriteToByteBoundary();
const auto allocatedAddress = bitStream->GetWriteOffset();
@@ -127,7 +127,7 @@ void BasicAttackBehavior::Calculate(BehaviorContext* context, RakNet::BitStream*
this->m_onSuccess->Calculate(context, bitStream, branch);
break;
default:
Game::logger->Log("BasicAttackBehavior", "Unknown success state (%i)!\n", successState);
Game::logger->Log("BasicAttackBehavior", "Unknown success state (%i)!", successState);
break;
}

View File

@@ -175,7 +175,7 @@ Behavior* Behavior::CreateBehavior(const uint32_t behaviorId)
behavior = new SpeedBehavior(behaviorId);
break;
case BehaviorTemplates::BEHAVIOR_DARK_INSPIRATION: break;
case BehaviorTemplates::BEHAVIOR_LOOT_BUFF:
case BehaviorTemplates::BEHAVIOR_LOOT_BUFF:
behavior = new LootBuffBehavior(behaviorId);
break;
case BehaviorTemplates::BEHAVIOR_VENTURE_VISION:
@@ -269,13 +269,13 @@ Behavior* Behavior::CreateBehavior(const uint32_t behaviorId)
case BehaviorTemplates::BEHAVIOR_MOUNT: break;
case BehaviorTemplates::BEHAVIOR_SKILL_SET: break;
default:
//Game::logger->Log("Behavior", "Failed to load behavior with invalid template id (%i)!\n", templateId);
//Game::logger->Log("Behavior", "Failed to load behavior with invalid template id (%i)!", templateId);
break;
}
if (behavior == nullptr)
{
//Game::logger->Log("Behavior", "Failed to load unimplemented template id (%i)!\n", templateId);
//Game::logger->Log("Behavior", "Failed to load unimplemented template id (%i)!", templateId);
behavior = new EmptyBehavior(behaviorId);
}
@@ -298,7 +298,7 @@ BehaviorTemplates Behavior::GetBehaviorTemplate(const uint32_t behaviorId) {
}
if (templateID == BehaviorTemplates::BEHAVIOR_EMPTY && behaviorId != 0) {
Game::logger->Log("Behavior", "Failed to load behavior template with id (%i)!\n", behaviorId);
Game::logger->Log("Behavior", "Failed to load behavior template with id (%i)!", behaviorId);
}
return templateID;
@@ -432,7 +432,7 @@ Behavior::Behavior(const uint32_t behaviorId)
// Make sure we do not proceed if we are trying to load an invalid behavior
if (templateInDatabase.behaviorID == 0)
{
Game::logger->Log("Behavior", "Failed to load behavior with id (%i)!\n", behaviorId);
Game::logger->Log("Behavior", "Failed to load behavior with id (%i)!", behaviorId);
this->m_effectId = 0;
this->m_effectHandle = nullptr;

View File

@@ -33,7 +33,7 @@ uint32_t BehaviorContext::GetUniqueSkillId() const
if (entity == nullptr)
{
Game::logger->Log("BehaviorContext", "Invalid entity for (%llu)!\n", this->originator);
Game::logger->Log("BehaviorContext", "Invalid entity for (%llu)!", this->originator);
return 0;
}
@@ -42,7 +42,7 @@ uint32_t BehaviorContext::GetUniqueSkillId() const
if (component == nullptr)
{
Game::logger->Log("BehaviorContext", "No skill component attached to (%llu)!\n", this->originator);;
Game::logger->Log("BehaviorContext", "No skill component attached to (%llu)!", this->originator);;
return 0;
}
@@ -65,7 +65,7 @@ void BehaviorContext::RegisterSyncBehavior(const uint32_t syncId, Behavior* beha
void BehaviorContext::RegisterTimerBehavior(Behavior* behavior, const BehaviorBranchContext& branchContext, const LWOOBJID second)
{
BehaviorTimerEntry entry;
entry.time = branchContext.duration;
entry.behavior = behavior;
entry.branchContext = branchContext;
@@ -103,7 +103,7 @@ void BehaviorContext::ExecuteUpdates()
auto* entity = EntityManager::Instance()->GetEntity(id);
if (entity == nullptr) continue;
EntityManager::Instance()->SerializeEntity(entity);
}
@@ -111,7 +111,7 @@ void BehaviorContext::ExecuteUpdates()
}
void BehaviorContext::SyncBehavior(const uint32_t syncId, RakNet::BitStream* bitStream)
{
{
BehaviorSyncEntry entry;
auto found = false;
@@ -121,7 +121,7 @@ void BehaviorContext::SyncBehavior(const uint32_t syncId, RakNet::BitStream* bit
for (auto i = 0u; i < this->syncEntries.size(); ++i)
{
const auto syncEntry = this->syncEntries.at(i);
if (syncEntry.handle == syncId)
{
found = true;
@@ -135,7 +135,7 @@ void BehaviorContext::SyncBehavior(const uint32_t syncId, RakNet::BitStream* bit
if (!found)
{
Game::logger->Log("BehaviorContext", "Failed to find behavior sync entry with sync id (%i)!\n", syncId);
Game::logger->Log("BehaviorContext", "Failed to find behavior sync entry with sync id (%i)!", syncId);
return;
}
@@ -145,8 +145,8 @@ void BehaviorContext::SyncBehavior(const uint32_t syncId, RakNet::BitStream* bit
if (behavior == nullptr)
{
Game::logger->Log("BehaviorContext", "Invalid behavior for sync id (%i)!\n", syncId);
Game::logger->Log("BehaviorContext", "Invalid behavior for sync id (%i)!", syncId);
return;
}
@@ -166,7 +166,7 @@ void BehaviorContext::Update(const float deltaTime)
this->timerEntries[i] = entry;
}
if (entry.time > 0)
{
continue;
@@ -174,7 +174,7 @@ void BehaviorContext::Update(const float deltaTime)
entry.behavior->Timer(this, entry.branchContext, entry.second);
}
std::vector<BehaviorTimerEntry> valid;
for (const auto& entry : this->timerEntries)
@@ -226,7 +226,7 @@ void BehaviorContext::InvokeEnd(const uint32_t id)
bool BehaviorContext::CalculateUpdate(const float deltaTime)
{
auto any = false;
for (auto i = 0u; i < this->syncEntries.size(); ++i)
{
auto entry = this->syncEntries.at(i);
@@ -241,7 +241,7 @@ bool BehaviorContext::CalculateUpdate(const float deltaTime)
if (entry.time > 0)
{
any = true;
continue;
}
@@ -267,7 +267,7 @@ bool BehaviorContext::CalculateUpdate(const float deltaTime)
PacketUtils::WriteHeader(message, CLIENT, MSG_CLIENT_GAME_MSG);
message.Write(this->originator);
echo.Serialize(&message);
Game::server->Send(&message, UNASSIGNED_SYSTEM_ADDRESS, true);
}
@@ -293,7 +293,7 @@ bool BehaviorContext::CalculateUpdate(const float deltaTime)
return any;
}
void BehaviorContext::Interrupt()
void BehaviorContext::Interrupt()
{
std::vector<BehaviorSyncEntry> keptSync {};
@@ -303,7 +303,7 @@ void BehaviorContext::Interrupt()
keptSync.push_back(entry);
}
this->syncEntries = keptSync;
}
@@ -330,10 +330,10 @@ std::vector<LWOOBJID> BehaviorContext::GetValidTargets(int32_t ignoreFaction, in
auto* entity = EntityManager::Instance()->GetEntity(this->caster);
std::vector<LWOOBJID> targets;
if (entity == nullptr)
{
Game::logger->Log("BehaviorContext", "Invalid entity for (%llu)!\n", this->originator);
Game::logger->Log("BehaviorContext", "Invalid entity for (%llu)!", this->originator);
return targets;
}
@@ -360,12 +360,12 @@ std::vector<LWOOBJID> BehaviorContext::GetValidTargets(int32_t ignoreFaction, in
{
return targets;
}
auto entities = EntityManager::Instance()->GetEntitiesByComponent(COMPONENT_TYPE_CONTROLLABLE_PHYSICS);
for (auto* candidate : entities)
{
const auto id = candidate->GetObjectID();
if ((id != entity->GetObjectID() || targetSelf) && destroyableComponent->CheckValidity(id, ignoreFaction || includeFaction, targetEnemy, targetFriend))
{
targets.push_back(id);

View File

@@ -15,7 +15,7 @@ void BlockBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStrea
if (entity == nullptr)
{
Game::logger->Log("DamageAbsorptionBehavior", "Failed to find target (%llu)!\n", branch.target);
Game::logger->Log("DamageAbsorptionBehavior", "Failed to find target (%llu)!", branch.target);
return;
}
@@ -52,7 +52,7 @@ void BlockBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branc
if (entity == nullptr)
{
Game::logger->Log("DamageAbsorptionBehavior", "Failed to find target (%llu)!\n", branch.target);
Game::logger->Log("DamageAbsorptionBehavior", "Failed to find target (%llu)!", branch.target);
return;
}

View File

@@ -10,12 +10,12 @@
void BuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch)
{
const auto target = branch.target != LWOOBJID_EMPTY ? branch.target : context->originator;
auto* entity = EntityManager::Instance()->GetEntity(target);
if (entity == nullptr)
{
Game::logger->Log("BuffBehavior", "Invalid target (%llu)!\n", target);
Game::logger->Log("BuffBehavior", "Invalid target (%llu)!", target);
return;
}
@@ -24,7 +24,7 @@ void BuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream
if (component == nullptr)
{
Game::logger->Log("BuffBehavior", "Invalid target, no destroyable component (%llu)!\n", target);
Game::logger->Log("BuffBehavior", "Invalid target, no destroyable component (%llu)!", target);
return;
}
@@ -51,12 +51,12 @@ void BuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream
void BuffBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branch)
{
const auto target = branch.target != LWOOBJID_EMPTY ? branch.target : context->originator;
auto* entity = EntityManager::Instance()->GetEntity(target);
if (entity == nullptr)
{
Game::logger->Log("BuffBehavior", "Invalid target (%llu)!\n", target);
Game::logger->Log("BuffBehavior", "Invalid target (%llu)!", target);
return;
}
@@ -65,7 +65,7 @@ void BuffBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branch
if (component == nullptr)
{
Game::logger->Log("BuffBehavior", "Invalid target, no destroyable component (%llu)!\n", target);
Game::logger->Log("BuffBehavior", "Invalid target, no destroyable component (%llu)!", target);
return;
}
@@ -73,7 +73,7 @@ void BuffBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branch
component->SetMaxHealth(component->GetMaxHealth() - this->m_health);
component->SetMaxArmor(component->GetMaxArmor() - this->m_armor);
component->SetMaxImagination(component->GetMaxImagination() - this->m_imagination);
EntityManager::Instance()->SerializeEntity(entity);
}

View File

@@ -8,7 +8,7 @@
#include "dLogger.h"
#include "PossessableComponent.h"
void CarBoostBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch)
void CarBoostBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch)
{
GameMessages::SendVehicleAddPassiveBoostAction(branch.target, UNASSIGNED_SYSTEM_ADDRESS);
@@ -19,7 +19,7 @@ void CarBoostBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitSt
return;
}
Game::logger->Log("Car boost", "Activating car boost!\n");
Game::logger->Log("Car boost", "Activating car boost!");
auto* possessableComponent = entity->GetComponent<PossessableComponent>();
if (possessableComponent != nullptr) {
@@ -29,7 +29,7 @@ void CarBoostBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitSt
auto* characterComponent = possessor->GetComponent<CharacterComponent>();
if (characterComponent != nullptr) {
Game::logger->Log("Car boost", "Tracking car boost!\n");
Game::logger->Log("Car boost", "Tracking car boost!");
characterComponent->UpdatePlayerStatistic(RacingCarBoostsActivated);
}
}
@@ -43,7 +43,7 @@ void CarBoostBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitSt
});
}
void CarBoostBehavior::Load()
void CarBoostBehavior::Load()
{
m_Action = GetAction("action");

View File

@@ -13,7 +13,7 @@ void DamageAbsorptionBehavior::Handle(BehaviorContext* context, RakNet::BitStrea
if (target == nullptr)
{
Game::logger->Log("DamageAbsorptionBehavior", "Failed to find target (%llu)!\n", branch.target);
Game::logger->Log("DamageAbsorptionBehavior", "Failed to find target (%llu)!", branch.target);
return;
}
@@ -32,7 +32,7 @@ void DamageAbsorptionBehavior::Handle(BehaviorContext* context, RakNet::BitStrea
context->RegisterTimerBehavior(this, branch, target->GetObjectID());
}
void DamageAbsorptionBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch)
void DamageAbsorptionBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch)
{
Handle(context, bitStream, branch);
}
@@ -43,11 +43,11 @@ void DamageAbsorptionBehavior::Timer(BehaviorContext* context, BehaviorBranchCon
if (target == nullptr)
{
Game::logger->Log("DamageAbsorptionBehavior", "Failed to find target (%llu)!\n", second);
Game::logger->Log("DamageAbsorptionBehavior", "Failed to find target (%llu)!", second);
return;
}
auto* destroyable = target->GetComponent<DestroyableComponent>();
if (destroyable == nullptr)
@@ -56,7 +56,7 @@ void DamageAbsorptionBehavior::Timer(BehaviorContext* context, BehaviorBranchCon
}
const auto present = static_cast<uint32_t>(destroyable->GetDamageToAbsorb());
const auto toRemove = std::min(present, this->m_absorbAmount);
destroyable->SetDamageToAbsorb(present - toRemove);

View File

@@ -13,7 +13,7 @@ void DamageReductionBehavior::Handle(BehaviorContext* context, RakNet::BitStream
if (target == nullptr)
{
Game::logger->Log("DamageReductionBehavior", "Failed to find target (%llu)!\n", branch.target);
Game::logger->Log("DamageReductionBehavior", "Failed to find target (%llu)!", branch.target);
return;
}
@@ -26,11 +26,11 @@ void DamageReductionBehavior::Handle(BehaviorContext* context, RakNet::BitStream
}
destroyable->SetDamageReduction(m_ReductionAmount);
context->RegisterTimerBehavior(this, branch, target->GetObjectID());
}
void DamageReductionBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch)
void DamageReductionBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch)
{
Handle(context, bitStream, branch);
}
@@ -41,11 +41,11 @@ void DamageReductionBehavior::Timer(BehaviorContext* context, BehaviorBranchCont
if (target == nullptr)
{
Game::logger->Log("DamageReductionBehavior", "Failed to find target (%llu)!\n", second);
Game::logger->Log("DamageReductionBehavior", "Failed to find target (%llu)!", second);
return;
}
auto* destroyable = target->GetComponent<DestroyableComponent>();
if (destroyable == nullptr)

View File

@@ -12,7 +12,7 @@ void HealBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_strea
if (entity == nullptr)
{
Game::logger->Log("HealBehavior", "Failed to find entity for (%llu)!\n", branch.target);
Game::logger->Log("HealBehavior", "Failed to find entity for (%llu)!", branch.target);
return;
}
@@ -21,11 +21,11 @@ void HealBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_strea
if (destroyable == nullptr)
{
Game::logger->Log("HealBehavior", "Failed to find destroyable component for %(llu)!\n", branch.target);
Game::logger->Log("HealBehavior", "Failed to find destroyable component for %(llu)!", branch.target);
return;
}
destroyable->Heal(this->m_health);
}

View File

@@ -13,7 +13,7 @@ void ImmunityBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitSt
if (target == nullptr)
{
Game::logger->Log("DamageAbsorptionBehavior", "Failed to find target (%llu)!\n", branch.target);
Game::logger->Log("DamageAbsorptionBehavior", "Failed to find target (%llu)!", branch.target);
return;
}
@@ -31,11 +31,11 @@ void ImmunityBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitSt
}
destroyable->PushImmunity();
context->RegisterTimerBehavior(this, branch, target->GetObjectID());
}
void ImmunityBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch)
void ImmunityBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch)
{
Handle(context, bitStream, branch);
}
@@ -46,7 +46,7 @@ void ImmunityBehavior::Timer(BehaviorContext* context, BehaviorBranchContext bra
if (target == nullptr)
{
Game::logger->Log("DamageAbsorptionBehavior", "Failed to find target (%llu)!\n", second);
Game::logger->Log("DamageAbsorptionBehavior", "Failed to find target (%llu)!", second);
return;
}

View File

@@ -8,13 +8,13 @@ void MovementSwitchBehavior::Handle(BehaviorContext* context, RakNet::BitStream*
if (this->m_groundAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY &&
this->m_jumpAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY &&
this->m_fallingAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY &&
this->m_doubleJumpAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY &&
this->m_doubleJumpAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY &&
this->m_airAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY &&
this->m_jetpackAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY)
{
return;
}
uint32_t movementType;
bitStream->Read(movementType);
@@ -40,13 +40,13 @@ void MovementSwitchBehavior::Handle(BehaviorContext* context, RakNet::BitStream*
this->m_jetpackAction->Handle(context, bitStream, branch);
break;
default:
Game::logger->Log("MovementSwitchBehavior", "Invalid movement behavior type (%i)!\n", movementType);
Game::logger->Log("MovementSwitchBehavior", "Invalid movement behavior type (%i)!", movementType);
break;
}
}
void MovementSwitchBehavior::Load()
{
{
this->m_airAction = GetAction("air_action");
this->m_doubleJumpAction = GetAction("double_jump_action");

View File

@@ -12,12 +12,12 @@ void ProjectileAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStrea
LWOOBJID target;
bitStream->Read(target);
auto* entity = EntityManager::Instance()->GetEntity(context->originator);
if (entity == nullptr)
{
Game::logger->Log("ProjectileAttackBehavior", "Failed to find originator (%llu)!\n", context->originator);
Game::logger->Log("ProjectileAttackBehavior", "Failed to find originator (%llu)!", context->originator);
return;
}
@@ -26,7 +26,7 @@ void ProjectileAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStrea
if (skillComponent == nullptr)
{
Game::logger->Log("ProjectileAttackBehavior", "Failed to find skill component for (%llu)!\n", -context->originator);
Game::logger->Log("ProjectileAttackBehavior", "Failed to find skill component for (%llu)!", -context->originator);
return;
}
@@ -44,7 +44,7 @@ void ProjectileAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStrea
LWOOBJID projectileId;
bitStream->Read(projectileId);
branch.target = target;
branch.isProjectile = true;
branch.referencePosition = targetEntity == nullptr ? entity->GetPosition() : targetEntity->GetPosition();
@@ -61,7 +61,7 @@ void ProjectileAttackBehavior::Calculate(BehaviorContext* context, RakNet::BitSt
if (entity == nullptr)
{
Game::logger->Log("ProjectileAttackBehavior", "Failed to find originator (%llu)!\n", context->originator);
Game::logger->Log("ProjectileAttackBehavior", "Failed to find originator (%llu)!", context->originator);
return;
}
@@ -70,7 +70,7 @@ void ProjectileAttackBehavior::Calculate(BehaviorContext* context, RakNet::BitSt
if (skillComponent == nullptr)
{
Game::logger->Log("ProjectileAttackBehavior", "Failed to find skill component for (%llu)!\n", context->originator);
Game::logger->Log("ProjectileAttackBehavior", "Failed to find skill component for (%llu)!", context->originator);
return;
@@ -80,8 +80,8 @@ void ProjectileAttackBehavior::Calculate(BehaviorContext* context, RakNet::BitSt
if (other == nullptr)
{
Game::logger->Log("ProjectileAttackBehavior", "Invalid projectile target (%llu)!\n", branch.target);
Game::logger->Log("ProjectileAttackBehavior", "Invalid projectile target (%llu)!", branch.target);
return;
}

View File

@@ -12,7 +12,7 @@ void RepairBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_str
if (entity == nullptr)
{
Game::logger->Log("RepairBehavior", "Failed to find entity for (%llu)!\n", branch.target);
Game::logger->Log("RepairBehavior", "Failed to find entity for (%llu)!", branch.target);
return;
}
@@ -21,11 +21,11 @@ void RepairBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_str
if (destroyable == nullptr)
{
Game::logger->Log("RepairBehavior", "Failed to find destroyable component for %(llu)!\n", branch.target);
Game::logger->Log("RepairBehavior", "Failed to find destroyable component for %(llu)!", branch.target);
return;
}
destroyable->Repair(this->m_armor);
}

View File

@@ -14,7 +14,7 @@ void SpawnBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStrea
if (origin == nullptr)
{
Game::logger->Log("SpawnBehavior", "Failed to find self entity (%llu)!\n", context->originator);
Game::logger->Log("SpawnBehavior", "Failed to find self entity (%llu)!", context->originator);
return;
}
@@ -28,7 +28,7 @@ void SpawnBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStrea
origin = target;
}
}
EntityInfo info;
info.lot = this->m_lot;
info.pos = origin->GetPosition();
@@ -47,7 +47,7 @@ void SpawnBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStrea
if (entity == nullptr)
{
Game::logger->Log("SpawnBehavior", "Failed to spawn entity (%i)!\n", this->m_lot);
Game::logger->Log("SpawnBehavior", "Failed to spawn entity (%i)!", this->m_lot);
return;
}
@@ -61,7 +61,7 @@ void SpawnBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStrea
{
rebuildComponent->SetRepositionPlayer(false);
}
EntityManager::Instance()->ConstructEntity(entity);
if (branch.duration > 0)
@@ -79,7 +79,7 @@ void SpawnBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStrea
});
}
void SpawnBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch)
void SpawnBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch)
{
Handle(context, bitStream, branch);
}
@@ -90,7 +90,7 @@ void SpawnBehavior::Timer(BehaviorContext* context, const BehaviorBranchContext
if (entity == nullptr)
{
Game::logger->Log("SpawnBehavior", "Failed to find spawned entity (%llu)!\n", second);
Game::logger->Log("SpawnBehavior", "Failed to find spawned entity (%llu)!", second);
return;
}
@@ -100,7 +100,7 @@ void SpawnBehavior::Timer(BehaviorContext* context, const BehaviorBranchContext
if (destroyable == nullptr)
{
entity->Smash(context->originator);
return;
}

View File

@@ -22,7 +22,7 @@ void StunBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream
if (target == nullptr)
{
Game::logger->Log("StunBehavior", "Failed to find target (%llu)!\n", branch.target);
Game::logger->Log("StunBehavior", "Failed to find target (%llu)!", branch.target);
return;
}
@@ -30,7 +30,7 @@ void StunBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream
/*
* If our target is an enemy we can go ahead and stun it.
*/
auto* combatAiComponent = static_cast<BaseCombatAIComponent*>(target->GetComponent(COMPONENT_TYPE_BASE_COMBAT_AI));
if (combatAiComponent == nullptr)
@@ -49,7 +49,7 @@ void StunBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStr
if (self == nullptr)
{
Game::logger->Log("StunBehavior", "Invalid self entity (%llu)!\n", context->originator);
Game::logger->Log("StunBehavior", "Invalid self entity (%llu)!", context->originator);
return;
}
@@ -57,7 +57,7 @@ void StunBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStr
/*
* See if we can stun ourselves
*/
auto* combatAiComponent = static_cast<BaseCombatAIComponent*>(self->GetComponent(COMPONENT_TYPE_BASE_COMBAT_AI));
if (combatAiComponent == nullptr)
@@ -66,7 +66,7 @@ void StunBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStr
}
combatAiComponent->Stun(branch.duration);
return;
}
@@ -88,7 +88,7 @@ void StunBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStr
if (target == nullptr)
{
Game::logger->Log("StunBehavior", "Failed to find target (%llu)!\n", branch.target);
Game::logger->Log("StunBehavior", "Failed to find target (%llu)!", branch.target);
return;
}

View File

@@ -23,13 +23,13 @@ void SwitchBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStre
}
auto* destroyableComponent = entity->GetComponent<DestroyableComponent>();
if (destroyableComponent == nullptr)
{
return;
}
Game::logger->Log("SwitchBehavior", "[%i] State: (%d), imagination: (%i) / (%f)\n", entity->GetLOT(), state, destroyableComponent->GetImagination(), destroyableComponent->GetMaxImagination());
Game::logger->Log("SwitchBehavior", "[%i] State: (%d), imagination: (%i) / (%f)", entity->GetLOT(), state, destroyableComponent->GetImagination(), destroyableComponent->GetMaxImagination());
if (state || (entity->GetLOT() == 8092 && destroyableComponent->GetImagination() >= m_imagination))
{
@@ -44,7 +44,7 @@ void SwitchBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStre
void SwitchBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch)
{
auto state = true;
if (this->m_imagination > 0 || !this->m_isEnemyFaction)
{
auto* entity = EntityManager::Instance()->GetEntity(branch.target);
@@ -77,11 +77,11 @@ void SwitchBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitS
void SwitchBehavior::Load()
{
this->m_actionTrue = GetAction("action_true");
this->m_actionFalse = GetAction("action_false");
this->m_imagination = GetInt("imagination");
this->m_isEnemyFaction = GetBoolean("isEnemyFaction");
this->m_targetHasBuff = GetInt("target_has_buff");

View File

@@ -27,7 +27,7 @@ void TacArcBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStre
if (this->m_checkEnv)
{
bool blocked = false;
bitStream->Read(blocked);
if (blocked)
@@ -63,7 +63,7 @@ void TacArcBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStre
for (auto target : targets)
{
branch.target = target;
this->m_action->Handle(context, bitStream, branch);
}
}
@@ -77,7 +77,7 @@ void TacArcBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitS
{
auto* self = EntityManager::Instance()->GetEntity(context->originator);
if (self == nullptr) {
Game::logger->Log("TacArcBehavior", "Invalid self for (%llu)!\n", context->originator);
Game::logger->Log("TacArcBehavior", "Invalid self for (%llu)!", context->originator);
return;
}
@@ -102,7 +102,7 @@ void TacArcBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitS
}
auto* combatAi = self->GetComponent<BaseCombatAIComponent>();
const auto casterPosition = self->GetPosition();
auto reference = self->GetPosition(); //+ m_offset;
@@ -144,7 +144,7 @@ void TacArcBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitS
if (entity == nullptr)
{
Game::logger->Log("TacArcBehavior", "Invalid target (%llu) for (%llu)!\n", validTarget, context->originator);
Game::logger->Log("TacArcBehavior", "Invalid target (%llu) for (%llu)!", validTarget, context->originator);
continue;
}
@@ -171,7 +171,7 @@ void TacArcBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitS
// otherPosition is the position of the target.
// reference is the position of the caster.
// If we cast a ray forward from the caster, does it come within m_farWidth of the target?
const auto distance = Vector3::Distance(reference, otherPosition);
if (m_method == 2)
@@ -185,7 +185,7 @@ void TacArcBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitS
}
auto normalized = (reference - otherPosition) / distance;
const float degreeAngle = std::abs(Vector3::Angle(forward, normalized) * (180 / 3.14) - 180);
if (distance >= this->m_minDistance && this->m_maxDistance >= distance && degreeAngle <= 2 * this->m_angle)
@@ -221,7 +221,7 @@ void TacArcBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitS
}
context->foundTarget = true; // We want to continue with this behavior
const auto count = static_cast<uint32_t>(targets.size());
bitStream->Write(count);

View File

@@ -12,13 +12,13 @@ void TauntBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStrea
if (target == nullptr)
{
Game::logger->Log("TauntBehavior", "Failed to find target (%llu)!\n", branch.target);
Game::logger->Log("TauntBehavior", "Failed to find target (%llu)!", branch.target);
return;
}
auto* combatComponent = target->GetComponent<BaseCombatAIComponent>();
if (combatComponent != nullptr)
{
combatComponent->Taunt(context->originator, m_threatToAdd);
@@ -31,13 +31,13 @@ void TauntBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitSt
if (target == nullptr)
{
Game::logger->Log("TauntBehavior", "Failed to find target (%llu)!\n", branch.target);
Game::logger->Log("TauntBehavior", "Failed to find target (%llu)!", branch.target);
return;
}
auto* combatComponent = target->GetComponent<BaseCombatAIComponent>();
if (combatComponent != nullptr)
{
combatComponent->Taunt(context->originator, m_threatToAdd);

View File

@@ -23,11 +23,11 @@ void VerifyBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitS
if (self == nullptr)
{
Game::logger->Log("VerifyBehavior", "Invalid self for (%llu)\n", context->originator);
Game::logger->Log("VerifyBehavior", "Invalid self for (%llu)", context->originator);
return;
}
const auto distance = Vector3::DistanceSquared(self->GetPosition(), entity->GetPosition());
if (distance > this->m_range * this->m_range)