DarkflameServer/dScripts/BuccaneerValiantShip.cpp
Mick Vermeulen 833ed8a40d Implement Buccaneer Valiant special ability
Adds the ability for the buccaneer valiant to spawn a ship that rams
enemies and smashes them. Next to a script that triggers the ship skill
a few other changes had to be made:
- Force movement behavior server side calculation and sync
- The ship has no physics volume so the FindValidTargets for behaviors
had to be altered to allow ControllablePhysics entities to find entities
within their area. The "target_self" AOE flag has been used to replicate
the old behavior.
2021-12-11 11:59:29 +01:00

25 lines
787 B
C++

#include "BuccaneerValiantShip.h"
#include "SkillComponent.h"
#include "dLogger.h"
void BuccaneerValiantShip::OnStartup(Entity* self) {
const auto skill = 982;
const auto behavior = 20577;
const auto skillCastTimer = 1.0F;
self->AddCallbackTimer(skillCastTimer, [self]() {
auto* skillComponent = self->GetComponent<SkillComponent>();
auto* owner = self->GetOwner();
if (skillComponent != nullptr && owner != nullptr) {
skillComponent->CalculateBehavior(skill, behavior, LWOOBJID_EMPTY, true, false, owner->GetObjectID());
// Kill self if missed
const auto selfSmashTimer = 1.1F;
self->AddCallbackTimer(selfSmashTimer, [self]() {
self->Kill();
});
}
});
}