Fix projectile behavior

This commit is contained in:
David Markowitz 2022-12-20 19:00:52 -08:00
parent 41b8762c8f
commit e53e31021f
3 changed files with 4 additions and 1 deletions

View File

@ -15,6 +15,8 @@ struct BehaviorBranchContext
uint32_t start = 0; uint32_t start = 0;
bool isSync = false;
BehaviorBranchContext(); BehaviorBranchContext();
BehaviorBranchContext(LWOOBJID target, float duration = 0, const NiPoint3& referencePosition = NiPoint3(0, 0, 0)); BehaviorBranchContext(LWOOBJID target, float duration = 0, const NiPoint3& referencePosition = NiPoint3(0, 0, 0));

View File

@ -51,6 +51,7 @@ void BehaviorContext::RegisterSyncBehavior(const uint32_t syncId, Behavior* beha
entry.handle = syncId; entry.handle = syncId;
entry.behavior = behavior; entry.behavior = behavior;
entry.branchContext = branchContext; entry.branchContext = branchContext;
entry.branchContext.isSync = true;
entry.ignoreInterrupts = ignoreInterrupts; entry.ignoreInterrupts = ignoreInterrupts;
this->syncEntries.push_back(entry); this->syncEntries.push_back(entry);

View File

@ -31,7 +31,7 @@ void ProjectileAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStrea
return; return;
} }
if (m_ProjectileType == 1) { if (m_useMouseposit && !branch.isSync) {
NiPoint3 targetPosition = NiPoint3::ZERO; NiPoint3 targetPosition = NiPoint3::ZERO;
if (!bitStream->Read(targetPosition)) { if (!bitStream->Read(targetPosition)) {
Game::logger->Log("ProjectileAttackBehavior", "Unable to read targetPosition from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits()); Game::logger->Log("ProjectileAttackBehavior", "Unable to read targetPosition from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());