define ship roles via added modules and allow multiple weapons
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "FactionComponent.h"
|
||||
#include "HealthComponent.h"
|
||||
#include "HqProxyComponent.h"
|
||||
#include "ModuleOwnerComponent.h"
|
||||
#include "Rotation.h"
|
||||
#include "ShipIdentityComponent.h"
|
||||
#include "ShipSystem.h"
|
||||
@@ -166,13 +167,14 @@ TEST_CASE("WaveSystem: HQ anchor is at asteroid right edge", "[wave]")
|
||||
|
||||
TEST_CASE("WaveSystem: player stations have weapon set", "[wave]")
|
||||
{
|
||||
const Simulation sim(loadConfig(), 42);
|
||||
Simulation sim(loadConfig(), 42);
|
||||
|
||||
int armedPlayerStations = 0;
|
||||
sim.admin().forEach<StationBodyComponent, FactionComponent, WeaponComponent>(
|
||||
[&](entt::entity /*e*/, const StationBodyComponent& /*sb*/, const FactionComponent& f,
|
||||
const WeaponComponent& w)
|
||||
sim.admin().forEach<WeaponComponent, ModuleOwnerComponent>(
|
||||
[&](entt::entity /*e*/, const WeaponComponent& w, const ModuleOwnerComponent& mo)
|
||||
{
|
||||
if (!sim.admin().hasAll<StationBodyComponent>(mo.owner)) { return; }
|
||||
const FactionComponent& f = sim.admin().get<FactionComponent>(mo.owner);
|
||||
if (!f.isEnemy)
|
||||
{
|
||||
++armedPlayerStations;
|
||||
@@ -186,13 +188,14 @@ TEST_CASE("WaveSystem: player stations have weapon set", "[wave]")
|
||||
|
||||
TEST_CASE("WaveSystem: enemy stations have weapon set", "[wave]")
|
||||
{
|
||||
const Simulation sim(loadConfig(), 42);
|
||||
Simulation sim(loadConfig(), 42);
|
||||
|
||||
int armedEnemyStations = 0;
|
||||
sim.admin().forEach<StationBodyComponent, FactionComponent, WeaponComponent>(
|
||||
[&](entt::entity /*e*/, const StationBodyComponent& /*sb*/, const FactionComponent& f,
|
||||
const WeaponComponent& w)
|
||||
sim.admin().forEach<WeaponComponent, ModuleOwnerComponent>(
|
||||
[&](entt::entity /*e*/, const WeaponComponent& w, const ModuleOwnerComponent& mo)
|
||||
{
|
||||
if (!sim.admin().hasAll<StationBodyComponent>(mo.owner)) { return; }
|
||||
const FactionComponent& f = sim.admin().get<FactionComponent>(mo.owner);
|
||||
if (f.isEnemy)
|
||||
{
|
||||
++armedEnemyStations;
|
||||
|
||||
Reference in New Issue
Block a user