move ecs related code to own folder
This commit is contained in:
30
src/lib/ecs/component/CMakeLists.txt
Normal file
30
src/lib/ecs/component/CMakeLists.txt
Normal file
@@ -0,0 +1,30 @@
|
||||
SET(HDRS
|
||||
${HDRS}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/DespawnAtComponent.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/DynamicBodyComponent.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/FacingComponent.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/FactionComponent.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/HealthComponent.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/HomeReturnBehaviorComponent.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/HqProxyComponent.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/MovementIntentComponent.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/PositionComponent.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/RallyBehaviorComponent.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/RepairBehaviorComponent.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/RepairToolComponent.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/SalvageBehaviorComponent.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/SalvageCargoComponent.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ScrapDataComponent.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/SensorRangeComponent.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ShipIdentityComponent.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/StationBodyComponent.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ThreatResponseBehaviorComponent.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/WeaponComponent.h
|
||||
PARENT_SCOPE
|
||||
)
|
||||
|
||||
set(LIB_INCLUDE_PATH
|
||||
${LIB_INCLUDE_PATH}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
PARENT_SCOPE
|
||||
)
|
||||
8
src/lib/ecs/component/DespawnAtComponent.h
Normal file
8
src/lib/ecs/component/DespawnAtComponent.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "Tick.h"
|
||||
|
||||
struct DespawnAtComponent
|
||||
{
|
||||
Tick tick;
|
||||
};
|
||||
21
src/lib/ecs/component/DynamicBodyComponent.h
Normal file
21
src/lib/ecs/component/DynamicBodyComponent.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include <QVector2D>
|
||||
|
||||
struct DynamicBodyComponent
|
||||
{
|
||||
// --- dynamics parameters (formerly ShipDynamics) ---
|
||||
float maxSpeedPerTick;
|
||||
float mainAccelerationPerTick;
|
||||
float maneuveringAccelerationPerTick;
|
||||
float angularAccelerationPerTick;
|
||||
float maxRotationSpeedPerTick;
|
||||
|
||||
// --- integrated state ---
|
||||
QVector2D velocity;
|
||||
float angularVelocity;
|
||||
|
||||
// --- written each tick by MovementIntentSystem, consumed by DynamicBodySystem ---
|
||||
QVector2D linearAcceleration;
|
||||
float angularAcceleration;
|
||||
};
|
||||
6
src/lib/ecs/component/FacingComponent.h
Normal file
6
src/lib/ecs/component/FacingComponent.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
struct FacingComponent
|
||||
{
|
||||
float radians;
|
||||
};
|
||||
6
src/lib/ecs/component/FactionComponent.h
Normal file
6
src/lib/ecs/component/FactionComponent.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
struct FactionComponent
|
||||
{
|
||||
bool isEnemy;
|
||||
};
|
||||
7
src/lib/ecs/component/HealthComponent.h
Normal file
7
src/lib/ecs/component/HealthComponent.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
struct HealthComponent
|
||||
{
|
||||
float hp;
|
||||
float maxHp;
|
||||
};
|
||||
9
src/lib/ecs/component/HomeReturnBehaviorComponent.h
Normal file
9
src/lib/ecs/component/HomeReturnBehaviorComponent.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <QVector2D>
|
||||
|
||||
struct HomeReturnBehaviorComponent
|
||||
{
|
||||
float retreatHpFraction;
|
||||
QVector2D homePos;
|
||||
};
|
||||
6
src/lib/ecs/component/HqProxyComponent.h
Normal file
6
src/lib/ecs/component/HqProxyComponent.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
struct HqProxyComponent
|
||||
{
|
||||
char unused = 0;
|
||||
};
|
||||
12
src/lib/ecs/component/MovementIntentComponent.h
Normal file
12
src/lib/ecs/component/MovementIntentComponent.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <QVector2D>
|
||||
|
||||
// A ship-behavior system writes this each tick before movement runs; the
|
||||
// highest-priority write wins. Priority order is fixed globally — see
|
||||
// architecture.md "Movement Arbitration".
|
||||
struct MovementIntentComponent
|
||||
{
|
||||
int priority;
|
||||
QVector2D target;
|
||||
};
|
||||
8
src/lib/ecs/component/PositionComponent.h
Normal file
8
src/lib/ecs/component/PositionComponent.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <QVector2D>
|
||||
|
||||
struct PositionComponent
|
||||
{
|
||||
QVector2D value;
|
||||
};
|
||||
8
src/lib/ecs/component/RallyBehaviorComponent.h
Normal file
8
src/lib/ecs/component/RallyBehaviorComponent.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <QVector2D>
|
||||
|
||||
struct RallyBehaviorComponent
|
||||
{
|
||||
QVector2D rallyPoint;
|
||||
};
|
||||
10
src/lib/ecs/component/RepairBehaviorComponent.h
Normal file
10
src/lib/ecs/component/RepairBehaviorComponent.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include "entt/entity/entity.hpp"
|
||||
|
||||
struct RepairBehaviorComponent
|
||||
{
|
||||
std::optional<entt::entity> currentTarget;
|
||||
};
|
||||
12
src/lib/ecs/component/RepairToolComponent.h
Normal file
12
src/lib/ecs/component/RepairToolComponent.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include "entt/entity/entity.hpp"
|
||||
|
||||
struct RepairToolComponent
|
||||
{
|
||||
float ratePerTick;
|
||||
float range;
|
||||
std::optional<entt::entity> currentTarget;
|
||||
};
|
||||
13
src/lib/ecs/component/SalvageBehaviorComponent.h
Normal file
13
src/lib/ecs/component/SalvageBehaviorComponent.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include <QVector2D>
|
||||
|
||||
#include "BuildingId.h"
|
||||
|
||||
struct SalvageBehaviorComponent
|
||||
{
|
||||
std::optional<QVector2D> scrapTarget;
|
||||
BuildingId deliveryBay; // kInvalidBuildingId until assigned at a salvage bay
|
||||
};
|
||||
8
src/lib/ecs/component/SalvageCargoComponent.h
Normal file
8
src/lib/ecs/component/SalvageCargoComponent.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
struct SalvageCargoComponent
|
||||
{
|
||||
int capacity;
|
||||
int current;
|
||||
float collectionRange;
|
||||
};
|
||||
6
src/lib/ecs/component/ScrapDataComponent.h
Normal file
6
src/lib/ecs/component/ScrapDataComponent.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
struct ScrapDataComponent
|
||||
{
|
||||
int amount;
|
||||
};
|
||||
6
src/lib/ecs/component/SensorRangeComponent.h
Normal file
6
src/lib/ecs/component/SensorRangeComponent.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
struct SensorRangeComponent
|
||||
{
|
||||
float value;
|
||||
};
|
||||
9
src/lib/ecs/component/ShipIdentityComponent.h
Normal file
9
src/lib/ecs/component/ShipIdentityComponent.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
struct ShipIdentityComponent
|
||||
{
|
||||
int level;
|
||||
std::string schematicId;
|
||||
};
|
||||
13
src/lib/ecs/component/StationBodyComponent.h
Normal file
13
src/lib/ecs/component/StationBodyComponent.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <QPoint>
|
||||
#include <QSize>
|
||||
|
||||
struct StationBodyComponent
|
||||
{
|
||||
QPoint anchor;
|
||||
QSize footprint;
|
||||
std::vector<QPoint> bodyCells;
|
||||
};
|
||||
10
src/lib/ecs/component/ThreatResponseBehaviorComponent.h
Normal file
10
src/lib/ecs/component/ThreatResponseBehaviorComponent.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include "entt/entity/entity.hpp"
|
||||
|
||||
struct ThreatResponseBehaviorComponent
|
||||
{
|
||||
std::optional<entt::entity> currentTarget;
|
||||
};
|
||||
14
src/lib/ecs/component/WeaponComponent.h
Normal file
14
src/lib/ecs/component/WeaponComponent.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include "entt/entity/entity.hpp"
|
||||
|
||||
struct WeaponComponent
|
||||
{
|
||||
float damage;
|
||||
float range;
|
||||
float fireRateHz;
|
||||
float cooldownTicks;
|
||||
std::optional<entt::entity> currentTarget;
|
||||
};
|
||||
Reference in New Issue
Block a user