mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-04-27 09:06:31 +00:00
Cannon Cove: Fix incorrect sign (#1211)
Update CMakeVariables.txt Cannon Cove: Fix incorrect sign
This commit is contained in:
parent
3dd2791066
commit
094797881b
@ -160,14 +160,15 @@ void SGCannon::OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button
|
||||
}
|
||||
}
|
||||
|
||||
void SGCannon::OnActivityTimerDone(Entity* self, const std::string& name) {
|
||||
if (name == SuperChargeTimer && !self->GetVar<bool>(SuperChargePausedVariable)) {
|
||||
void SGCannon::SuperChargeTimerFunc(Entity* self) {
|
||||
if (self->GetVar<bool>(WaveStatusVariable) || self->GetVar<uint32_t>(CurrentSuperChargedTimeVariable) < 1) {
|
||||
self->SetNetworkVar<uint32_t>(ChargeCountingVariable, 99);
|
||||
self->SetNetworkVar<uint32_t>(SuperChargeBarVariable, 0);
|
||||
ToggleSuperCharge(self, false);
|
||||
}
|
||||
} else if (name == SpawnWaveTimer) {
|
||||
}
|
||||
|
||||
void SGCannon::SpawnWaveTimerFunc(Entity* self) {
|
||||
if (self->GetVar<bool>(GameStartedVariable)) {
|
||||
self->SetVar<bool>(WaveStatusVariable, true);
|
||||
const auto wave = (int32_t)self->GetVar<uint32_t>(ThisWaveVariable);
|
||||
@ -203,7 +204,9 @@ void SGCannon::OnActivityTimerDone(Entity* self, const std::string& name) {
|
||||
GameMessages::SendActivityPause(self->GetObjectID(), false, player->GetSystemAddress());
|
||||
}
|
||||
}
|
||||
} else if (name == EndWaveTimer) {
|
||||
}
|
||||
|
||||
void SGCannon::EndWaveTimerFunc(Entity* self) {
|
||||
self->SetVar<bool>(WaveStatusVariable, false);
|
||||
TimerToggle(self);
|
||||
RecordPlayerScore(self);
|
||||
@ -233,7 +236,9 @@ void SGCannon::OnActivityTimerDone(Entity* self, const std::string& name) {
|
||||
if (self->GetVar<bool>(SuperChargeActiveVariable) && !self->GetVar<bool>(SuperChargePausedVariable)) {
|
||||
PauseChargeCannon(self);
|
||||
}
|
||||
} else if (name == GameOverTimer) {
|
||||
}
|
||||
|
||||
void SGCannon::GameOverTimerFunc(Entity* self) {
|
||||
auto* player = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
|
||||
if (player != nullptr) {
|
||||
Game::logger->Log("SGCannon", "Sending ActivityPause true");
|
||||
@ -252,22 +257,32 @@ void SGCannon::OnActivityTimerDone(Entity* self, const std::string& name) {
|
||||
|
||||
TimerToggle(self);
|
||||
}
|
||||
} else if (name.rfind(DoSpawnTimer, 0) == 0) {
|
||||
}
|
||||
|
||||
void SGCannon::DoSpawnTimerFunc(Entity* self, const std::string& name) {
|
||||
if (self->GetVar<bool>(GameStartedVariable)) {
|
||||
Game::logger->LogDebug("SGCannon", "time name %s %s", name.c_str(), name.substr(7).c_str());
|
||||
const auto spawnNumber = (uint32_t)std::stoi(name.substr(7));
|
||||
const auto& activeSpawns = self->GetVar<std::vector<SGEnemy>>(ActiveSpawnsVariable);
|
||||
if (activeSpawns.size() < spawnNumber) {
|
||||
Game::logger->LogDebug("SGCannon", "size %i, %i", activeSpawns.size(), spawnNumber);
|
||||
if (activeSpawns.size() <= spawnNumber) {
|
||||
Game::logger->Log("SGCannon", "Trying to spawn %i when spawns size is only %i", spawnNumber, activeSpawns.size());
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& toSpawn = activeSpawns.at(spawnNumber);
|
||||
Game::logger->LogDebug("SGCannon", "toSpawn %i", toSpawn.spawnPaths.size());
|
||||
const auto pathIndex = GeneralUtils::GenerateRandomNumber<float_t>(0, toSpawn.spawnPaths.size() - 1);
|
||||
Game::logger->LogDebug("SGCannon", "index %f", pathIndex);
|
||||
Game::logger->LogDebug("SGCannon", "%s", toSpawn.spawnPaths.at(pathIndex).c_str());
|
||||
const auto* path = Game::zoneManager->GetZone()->GetPath(toSpawn.spawnPaths.at(pathIndex));
|
||||
if (!path) {
|
||||
Game::logger->Log("SGCannon", "Path %s at index %i is null", toSpawn.spawnPaths.at(pathIndex).c_str(), pathIndex);
|
||||
return;
|
||||
}
|
||||
|
||||
Game::logger->LogDebug("SGCannon", "%s", path->pathName.c_str());
|
||||
|
||||
auto info = EntityInfo{};
|
||||
info.lot = toSpawn.lot;
|
||||
info.spawnerID = self->GetObjectID();
|
||||
@ -317,10 +332,27 @@ void SGCannon::OnActivityTimerDone(Entity* self, const std::string& name) {
|
||||
GameMessages::SendPlatformResync(enemy, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
}
|
||||
}
|
||||
} else if (name == EndGameBufferTimer) {
|
||||
}
|
||||
|
||||
void SGCannon::EndGameBufferTimerFunc(Entity* self) {
|
||||
RecordPlayerScore(self);
|
||||
StopGame(self, false);
|
||||
}
|
||||
|
||||
void SGCannon::OnActivityTimerDone(Entity* self, const std::string& name) {
|
||||
if (name == SuperChargeTimer && !self->GetVar<bool>(SuperChargePausedVariable)) {
|
||||
SuperChargeTimerFunc(self);
|
||||
} else if (name == SpawnWaveTimer) {
|
||||
SpawnWaveTimerFunc(self);
|
||||
} else if (name == EndWaveTimer) {
|
||||
EndWaveTimerFunc(self);
|
||||
} else if (name == GameOverTimer) {
|
||||
GameOverTimerFunc(self);
|
||||
} else if (name.rfind(DoSpawnTimer, 0) == 0) {
|
||||
DoSpawnTimerFunc(self, name);
|
||||
} else if (name == EndGameBufferTimer) {
|
||||
EndGameBufferTimerFunc(self);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -68,6 +68,12 @@ public:
|
||||
void OnActivityTimerDone(Entity* self, const std::string& name) override;
|
||||
void OnActivityTimerUpdate(Entity* self, const std::string& name, float_t timeRemaining, float_t elapsedTime) override;
|
||||
void OnRequestActivityExit(Entity* self, LWOOBJID player, bool canceled) override;
|
||||
void SuperChargeTimerFunc(Entity* self);
|
||||
void SpawnWaveTimerFunc(Entity* self);
|
||||
void EndWaveTimerFunc(Entity* self);
|
||||
void GameOverTimerFunc(Entity* self);
|
||||
void DoSpawnTimerFunc(Entity* self, const std::string& name);
|
||||
void EndGameBufferTimerFunc(Entity* self);
|
||||
private:
|
||||
static std::vector<std::vector<SGEnemy>> GetWaves();
|
||||
static SGConstants GetConstants();
|
||||
|
Loading…
x
Reference in New Issue
Block a user