make ships orbit their targets
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "EntityAdmin.h"
|
||||
#include "ModuleOwnerComponent.h"
|
||||
#include "MovementIntentComponent.h"
|
||||
#include "OrbitMath.h"
|
||||
#include "PositionComponent.h"
|
||||
#include "SelectedBehaviorComponent.h"
|
||||
#include "tracing.h"
|
||||
@@ -28,7 +29,9 @@ void AttackExecutor::execute(EntityAdmin& admin)
|
||||
QVector2D dest = pos.value;
|
||||
if (admin.isValid(t) && admin.hasAll<PositionComponent>(t))
|
||||
{
|
||||
dest = admin.get<PositionComponent>(t).value;
|
||||
const QVector2D targetPos = admin.get<PositionComponent>(t).value;
|
||||
dest = OrbitMath::computeOrbitDestination(pos.value, targetPos,
|
||||
attack.orbitRadius_tiles);
|
||||
}
|
||||
intent = MovementIntentComponent{true, dest};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user