mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-05 18:24:12 +00:00
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.
This commit is contained in:
@@ -149,7 +149,7 @@ void BehaviorContext::SyncBehavior(const uint32_t syncId, RakNet::BitStream* bit
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
behavior->Sync(this, bitStream, branch);
|
||||
}
|
||||
|
||||
@@ -325,7 +325,7 @@ void BehaviorContext::Reset()
|
||||
this->scheduledUpdates.clear();
|
||||
}
|
||||
|
||||
std::vector<LWOOBJID> BehaviorContext::GetValidTargets(int32_t ignoreFaction, int32_t includeFaction) const
|
||||
std::vector<LWOOBJID> BehaviorContext::GetValidTargets(int32_t ignoreFaction, int32_t includeFaction, bool targetSelf) const
|
||||
{
|
||||
auto* entity = EntityManager::Instance()->GetEntity(this->caster);
|
||||
|
||||
@@ -353,21 +353,20 @@ std::vector<LWOOBJID> BehaviorContext::GetValidTargets(int32_t ignoreFaction, in
|
||||
}
|
||||
}
|
||||
|
||||
if (ignoreFaction || includeFaction || (!entity->HasComponent(COMPONENT_TYPE_PHANTOM_PHYSICS) && !entity->HasComponent(COMPONENT_TYPE_CONTROLLABLE_PHYSICS) && targets.empty()))
|
||||
if (ignoreFaction || includeFaction || (!entity->HasComponent(COMPONENT_TYPE_PHANTOM_PHYSICS) && targets.empty()))
|
||||
{
|
||||
DestroyableComponent* destroyableComponent;
|
||||
DestroyableComponent* destroyableComponent;
|
||||
if (!entity->TryGetComponent(COMPONENT_TYPE_DESTROYABLE, destroyableComponent))
|
||||
{
|
||||
return targets;
|
||||
}
|
||||
|
||||
auto entities = EntityManager::Instance()->GetEntitiesByComponent(COMPONENT_TYPE_CONTROLLABLE_PHYSICS);
|
||||
|
||||
for (auto* candidate : entities)
|
||||
{
|
||||
const auto id = candidate->GetObjectID();
|
||||
|
||||
if (destroyableComponent->CheckValidity(id, ignoreFaction || includeFaction))
|
||||
if ((id != entity->GetObjectID() || targetSelf) && destroyableComponent->CheckValidity(id, ignoreFaction || includeFaction))
|
||||
{
|
||||
targets.push_back(id);
|
||||
}
|
||||
|
Reference in New Issue
Block a user