allow custom orbit rotations directions
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
#include "EntityAdmin.h"
|
||||
#include "ModuleOwnerComponent.h"
|
||||
#include "MovementIntentComponent.h"
|
||||
#include "OrbitMath.h"
|
||||
#include "PositionComponent.h"
|
||||
#include "RepairBehavior.h"
|
||||
#include "RepairToolComponent.h"
|
||||
@@ -26,14 +25,14 @@ void RepairExecutor::execute(EntityAdmin& admin)
|
||||
if (!repair.currentTarget) { return; }
|
||||
|
||||
const entt::entity t = *repair.currentTarget;
|
||||
QVector2D dest = pos.value;
|
||||
QVector2D center = pos.value;
|
||||
float radius = 0.0f;
|
||||
if (admin.isValid(t) && admin.hasAll<PositionComponent>(t))
|
||||
{
|
||||
const QVector2D targetPos = admin.get<PositionComponent>(t).value;
|
||||
dest = OrbitMath::computeOrbitDestination(pos.value, targetPos,
|
||||
repair.orbitRadius_tiles);
|
||||
center = admin.get<PositionComponent>(t).value;
|
||||
radius = repair.orbitRadius_tiles;
|
||||
}
|
||||
intent = MovementIntentComponent{true, dest};
|
||||
intent = MovementIntentComponent{true, center, radius};
|
||||
});
|
||||
|
||||
// Repair tools: prefer the behavior target if it is within tool range.
|
||||
|
||||
Reference in New Issue
Block a user