From 262847048282536a80ad53d85f066e8ef3430451 Mon Sep 17 00:00:00 2001 From: David Markowitz Date: Tue, 18 Jun 2024 14:24:03 -0700 Subject: [PATCH 1/3] set shield to false, add sync for done --- dGame/dBehaviors/BehaviorContext.cpp | 20 +++++++++++++++++++ dGame/dBehaviors/DamageAbsorptionBehavior.cpp | 10 +++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/dGame/dBehaviors/BehaviorContext.cpp b/dGame/dBehaviors/BehaviorContext.cpp index abba74bee..95c4c84c2 100644 --- a/dGame/dBehaviors/BehaviorContext.cpp +++ b/dGame/dBehaviors/BehaviorContext.cpp @@ -199,6 +199,26 @@ void BehaviorContext::UpdatePlayerSyncs(float deltaTime) { i++; continue; } + + if (this->skillUId != 0 && !clientInitalized) { + EchoSyncSkill echo; + echo.bDone = true; + echo.uiSkillHandle = this->skillUId; + echo.uiBehaviorHandle = entry.handle; + + RakNet::BitStream bitStream{}; + entry.behavior->SyncCalculation(this, bitStream, entry.branchContext); + + echo.sBitStream.assign(reinterpret_cast(bitStream.GetData()), bitStream.GetNumberOfBytesUsed()); + + RakNet::BitStream message; + BitStreamUtils::WriteHeader(message, eConnectionType::CLIENT, eClientMessageType::GAME_MSG); + message.Write(this->originator); + echo.Serialize(message); + + Game::server->Send(message, UNASSIGNED_SYSTEM_ADDRESS, true); + } + this->syncEntries.erase(this->syncEntries.begin() + i); } } diff --git a/dGame/dBehaviors/DamageAbsorptionBehavior.cpp b/dGame/dBehaviors/DamageAbsorptionBehavior.cpp index f657c8fd0..e5711f4d1 100644 --- a/dGame/dBehaviors/DamageAbsorptionBehavior.cpp +++ b/dGame/dBehaviors/DamageAbsorptionBehavior.cpp @@ -27,6 +27,8 @@ void DamageAbsorptionBehavior::Handle(BehaviorContext* context, RakNet::BitStrea destroyable->SetIsShielded(true); context->RegisterTimerBehavior(this, branch, target->GetObjectID()); + + Game::entityManager->SerializeEntity(target); } void DamageAbsorptionBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) { @@ -52,7 +54,13 @@ void DamageAbsorptionBehavior::Timer(BehaviorContext* context, BehaviorBranchCon const auto toRemove = std::min(present, this->m_absorbAmount); - destroyable->SetDamageToAbsorb(present - toRemove); + const auto remaining = present - toRemove; + + destroyable->SetDamageToAbsorb(remaining); + + destroyable->SetIsShielded(remaining > 0); + + Game::entityManager->SerializeEntity(target); } void DamageAbsorptionBehavior::Load() { From b648b43c4d68eaf53a021e14742a48171498f639 Mon Sep 17 00:00:00 2001 From: David Markowitz Date: Tue, 25 Jun 2024 20:52:46 -0700 Subject: [PATCH 2/3] ?? --- dGame/dUtilities/Preconditions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dGame/dUtilities/Preconditions.cpp b/dGame/dUtilities/Preconditions.cpp index 25e8b773c..f58431af3 100644 --- a/dGame/dUtilities/Preconditions.cpp +++ b/dGame/dUtilities/Preconditions.cpp @@ -26,7 +26,7 @@ Precondition::Precondition(const uint32_t condition) { if (result.eof()) { this->type = PreconditionType::ItemEquipped; this->count = 1; - this->values = { 0 }; + this->values = { 0u }; LOG("Failed to find precondition of id (%i)!", condition); From f2d72e7ed506406e26b9fc89fdee57490dde39cf Mon Sep 17 00:00:00 2001 From: David Markowitz Date: Tue, 25 Jun 2024 21:02:40 -0700 Subject: [PATCH 3/3] Update Preconditions.cpp --- dGame/dUtilities/Preconditions.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dGame/dUtilities/Preconditions.cpp b/dGame/dUtilities/Preconditions.cpp index f58431af3..cd920863f 100644 --- a/dGame/dUtilities/Preconditions.cpp +++ b/dGame/dUtilities/Preconditions.cpp @@ -26,7 +26,8 @@ Precondition::Precondition(const uint32_t condition) { if (result.eof()) { this->type = PreconditionType::ItemEquipped; this->count = 1; - this->values = { 0u }; + this->values.clear(); + this->values.push_back(0); LOG("Failed to find precondition of id (%i)!", condition);