implement ships depart in waves
This commit is contained in:
@@ -13,6 +13,7 @@ Simulation::Simulation(GameConfig config, unsigned int seed)
|
||||
: m_config(std::move(config))
|
||||
, m_rng(seed)
|
||||
, m_currentTick(0)
|
||||
, m_nextDepartureTick(secondsToTicks(m_config.world.departureIntervalSeconds))
|
||||
, m_nextId(1)
|
||||
, m_buildingBlocksStock(m_config.world.startingBuildingBlocks)
|
||||
, m_gameOver(false)
|
||||
@@ -73,6 +74,7 @@ void Simulation::reset(unsigned int seed)
|
||||
{
|
||||
m_rng.seed(seed);
|
||||
m_currentTick = 0;
|
||||
m_nextDepartureTick = secondsToTicks(m_config.world.departureIntervalSeconds);
|
||||
m_nextId = 1;
|
||||
m_buildingBlocksStock = m_config.world.startingBuildingBlocks;
|
||||
m_gameOver = false;
|
||||
@@ -139,6 +141,14 @@ void Simulation::tick()
|
||||
m_beltSystem.tick(); // step 6
|
||||
|
||||
// Step 7: ship behavior systems (movement arbitration via intent priority)
|
||||
|
||||
// Departure timer: release gathered combat ships on a fixed interval (REQ-SHP-RALLY).
|
||||
if (m_currentTick >= m_nextDepartureTick)
|
||||
{
|
||||
m_shipSystem->triggerRallyDeparture();
|
||||
m_nextDepartureTick += secondsToTicks(m_config.world.departureIntervalSeconds);
|
||||
}
|
||||
|
||||
m_shipSystem->clearMovementIntents();
|
||||
m_shipSystem->tickHomeReturn(); // priority 4
|
||||
m_shipSystem->tickThreatResponse(*m_buildingSystem); // priority 3
|
||||
@@ -217,6 +227,11 @@ void Simulation::placeInitialStructures()
|
||||
QPoint(psAnchorX, ps2Y), Rotation::East, psHp, psHp);
|
||||
m_buildingSystem->initStationWeapon(m_playerStation2Id, psWeapon);
|
||||
|
||||
// Rally point: center of the player defence stations' X column, world vertical midpoint.
|
||||
const float rallyX = static_cast<float>(psAnchorX) + psParsed.footprint.width() / 2.0f;
|
||||
const float rallyY = static_cast<float>(m_config.world.heightTiles) / 2.0f;
|
||||
m_shipSystem->setRallyPoint(QVector2D(rallyX, rallyY));
|
||||
|
||||
// Enemy defence stations — generation 0 (initial set).
|
||||
placeEnemyStationSet(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user