make ships orbit their targets
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "EntityAdmin.h"
|
||||
#include "ModuleOwnerComponent.h"
|
||||
#include "MovementIntentComponent.h"
|
||||
#include "OrbitMath.h"
|
||||
#include "PositionComponent.h"
|
||||
#include "RepairBehavior.h"
|
||||
#include "RepairToolComponent.h"
|
||||
@@ -28,7 +29,9 @@ void RepairExecutor::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,
|
||||
repair.orbitRadius_tiles);
|
||||
}
|
||||
intent = MovementIntentComponent{true, dest};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user