mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-21 21:17:25 +00:00
set shield to false, add sync for done
This commit is contained in:
parent
9400ee1dc0
commit
2628470482
@ -199,6 +199,26 @@ void BehaviorContext::UpdatePlayerSyncs(float deltaTime) {
|
|||||||
i++;
|
i++;
|
||||||
continue;
|
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<char*>(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);
|
this->syncEntries.erase(this->syncEntries.begin() + i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,8 @@ void DamageAbsorptionBehavior::Handle(BehaviorContext* context, RakNet::BitStrea
|
|||||||
destroyable->SetIsShielded(true);
|
destroyable->SetIsShielded(true);
|
||||||
|
|
||||||
context->RegisterTimerBehavior(this, branch, target->GetObjectID());
|
context->RegisterTimerBehavior(this, branch, target->GetObjectID());
|
||||||
|
|
||||||
|
Game::entityManager->SerializeEntity(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DamageAbsorptionBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
|
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);
|
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() {
|
void DamageAbsorptionBehavior::Load() {
|
||||||
|
Loading…
Reference in New Issue
Block a user