split MovementSystem to MovementIntentSystem and DynamicBodySystem

This commit is contained in:
2026-05-25 07:25:54 +02:00
parent f5f4453e2c
commit 0cd0529468
18 changed files with 277 additions and 154 deletions

View File

@@ -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());