mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-04 17:54:01 +00:00
Implement flying command (#713)
* Implement flying command * Add documentation.
This commit is contained in:
@@ -3,16 +3,34 @@
|
||||
#include "BehaviorBranchContext.h"
|
||||
#include "GameMessages.h"
|
||||
|
||||
#include "Character.h"
|
||||
|
||||
void JetPackBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_stream, const BehaviorBranchContext branch) {
|
||||
auto* entity = EntityManager::Instance()->GetEntity(branch.target);
|
||||
|
||||
GameMessages::SendSetJetPackMode(entity, true, this->m_BypassChecks, this->m_EnableHover, this->m_effectId, this->m_Airspeed, this->m_MaxAirspeed, this->m_VerticalVelocity, this->m_WarningEffectID);
|
||||
|
||||
if (entity->IsPlayer()) {
|
||||
auto* character = entity->GetCharacter();
|
||||
|
||||
if (character) {
|
||||
character->SetIsFlying(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void JetPackBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branch) {
|
||||
auto* entity = EntityManager::Instance()->GetEntity(branch.target);
|
||||
|
||||
GameMessages::SendSetJetPackMode(entity, false);
|
||||
|
||||
if (entity->IsPlayer()) {
|
||||
auto* character = entity->GetCharacter();
|
||||
|
||||
if (character) {
|
||||
character->SetIsFlying(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void JetPackBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bit_stream, const BehaviorBranchContext branch) {
|
||||
|
Reference in New Issue
Block a user