split MovementSystem to MovementIntentSystem and DynamicBodySystem
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "ArenaSimulation.h"
|
||||
#include "Building.h"
|
||||
#include "BuildingSystem.h"
|
||||
#include "DynamicBodyComponent.h"
|
||||
#include "EcsComponents.h"
|
||||
#include "ScrapSystem.h"
|
||||
#include "Ship.h"
|
||||
@@ -314,9 +315,9 @@ void ArenaView::drawStations(QPainter& painter)
|
||||
|
||||
void ArenaView::drawShips(QPainter& painter)
|
||||
{
|
||||
m_sim->admin().forEach<ShipIdentity, Position, Velocity, Faction>(
|
||||
m_sim->admin().forEach<ShipIdentity, Position, DynamicBodyComponent, Faction>(
|
||||
[&](entt::entity e, const ShipIdentity& /*si*/, const Position& pos,
|
||||
const Velocity& vel, const Faction& fac)
|
||||
const DynamicBodyComponent& body, const Faction& fac)
|
||||
{
|
||||
const bool hasCargo = m_sim->admin().hasAll<SalvageCargo>(e);
|
||||
const bool hasRepair = m_sim->admin().hasAll<RepairTool>(e);
|
||||
@@ -326,8 +327,8 @@ void ArenaView::drawShips(QPainter& painter)
|
||||
if (it == m_visuals->ships.end()) { return; }
|
||||
|
||||
const QPointF center = worldToWidget(pos.value);
|
||||
const QVector2D dir = (vel.value.length() > 0.0001f)
|
||||
? vel.value.normalized()
|
||||
const QVector2D dir = (body.velocity.length() > 0.0001f)
|
||||
? body.velocity.normalized()
|
||||
: QVector2D(1.0f, 0.0f);
|
||||
const QVector2D perp(-dir.y(), dir.x());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user