mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-08 05:43:43 +00:00
fix(scripts): Spider Queen rapid fire sweeps the three zone target groups around a player (issue 2016)
The live boss script tracks which arena zone volume (Zone1Vol..Zone8Vol, TeleVol for the default Zone3Vol) each player last entered, and its rapid fire picks a random player, takes the three RFS target groups around that zone, sorts each by the targets' CWOrder (CWOrder2 when the sweep crosses between zones 8 and 1), clockwise or counter-clockwise at random, drops the first and last target of the middle group (shared with its neighbours), turns with skill 1480 at the fourth target and fires 1394 at every target in turn, playing attack-shoot-right or attack-shoot-left. The server shot a single random target with the single-shot animation, and the AG property zone never subscribed the boss to the zone volumes. The zone now registers the volumes (retrying until they are spawned) and the boss builds the sweep like the live script. Check in game: AG Spider Queen stage 2; the rapid fire is an arc of many shots sweeping across the arena near the player, left or right, and follows the player to other parts of the arena; after teleporting it starts from the default side. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "ZoneAgProperty.h"
|
||||
#include "GeneralUtils.h"
|
||||
#include "BossSpiderQueenEnemyServer.h"
|
||||
#include "EntityManager.h"
|
||||
#include "Character.h"
|
||||
#include "Entity.h"
|
||||
@@ -135,6 +136,32 @@ void ZoneAgProperty::ProcessGroupObjects(Entity* self, const std::string& group)
|
||||
spiderBoss->SetVar<LWOOBJID>(varName, objects.front()->GetObjectID());
|
||||
}
|
||||
|
||||
void ZoneAgProperty::ProcessZoneVolumes(Entity* self) {
|
||||
// Tells the Spider Queen which of the arena's zone volumes each player walks into, so her rapid fire sweeps
|
||||
// start where the player is
|
||||
for (const auto& group : self->GetVar<std::vector<std::string>>(ZoneVolumesGroup)) {
|
||||
const auto volumes = Game::entityManager->GetEntitiesInGroup(group);
|
||||
if (volumes.empty()) {
|
||||
// Not spawned yet: look again shortly
|
||||
self->AddTimer("ProcessGroupObj_ZoneVolumes", 0.3f);
|
||||
return;
|
||||
}
|
||||
|
||||
auto* const volume = volumes.front();
|
||||
if (volume->GetVar<bool>(u"spiderBossSensor")) continue; // already reporting
|
||||
volume->SetVar<bool>(u"spiderBossSensor", true);
|
||||
|
||||
volume->AddCollisionPhantomCallback([zoneID = self->GetObjectID(), group](Entity* target) {
|
||||
auto* const zone = Game::entityManager->GetEntity(zoneID);
|
||||
if (!zone) return;
|
||||
auto* const spiderBoss = Game::entityManager->GetEntity(zone->GetVar<LWOOBJID>(u"SpiderBossID"));
|
||||
if (!spiderBoss) return;
|
||||
auto* const bossScript = dynamic_cast<BossSpiderQueenEnemyServer*>(spiderBoss->GetScript());
|
||||
if (bossScript) bossScript->OnZoneVolumeEntered(spiderBoss, target, group);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void ZoneAgProperty::SpawnSpots(Entity* self) {
|
||||
for (const auto& spot : self->GetVar<std::vector<std::string>>(ROFTargetsSpawner)) {
|
||||
ActivateSpawner(spot);
|
||||
@@ -313,6 +340,8 @@ void ZoneAgProperty::BaseTimerDone(Entity* self, const std::string& timerName) {
|
||||
ProcessGroupObjects(self, self->GetVar<std::string>(LandTargetGroup));
|
||||
} else if (timerName == "ProcessGroupObj_ScreamEmitter") {
|
||||
ProcessGroupObjects(self, self->GetVar<std::string>(SpiderScreamGroup));
|
||||
} else if (timerName == "ProcessGroupObj_ZoneVolumes") {
|
||||
ProcessZoneVolumes(self);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -431,7 +460,7 @@ void ZoneAgProperty::BaseOnFireEventServerSide(Entity* self, Entity* sender, std
|
||||
|
||||
ProcessGroupObjects(self, self->GetVar<std::string>(LandTargetGroup));
|
||||
ProcessGroupObjects(self, self->GetVar<std::string>(SpiderScreamGroup));
|
||||
// ProcessGroupObjects(self, groups.ZoneVolumes);
|
||||
ProcessZoneVolumes(self);
|
||||
} else if (args == "CheckForPropertyOwner") {
|
||||
sender->SetNetworkVar<std::string>(u"PropertyOwnerID", std::to_string(self->GetVar<LWOOBJID>(u"PropertyOwner")));
|
||||
} else if (args == "ClearProperty") {
|
||||
|
||||
@@ -31,6 +31,7 @@ public:
|
||||
void LoadProperty(Entity* self);
|
||||
|
||||
void ProcessGroupObjects(Entity* self, const std::string& group);
|
||||
void ProcessZoneVolumes(Entity* self);
|
||||
|
||||
void SpawnSpots(Entity* self) override;
|
||||
void KillSpots(Entity* self) override;
|
||||
|
||||
@@ -24,4 +24,5 @@ target_precompile_headers(dScriptsServerMapProperty REUSE_FROM dScriptsBase)
|
||||
target_include_directories(dScriptsServerMapProperty PUBLIC "."
|
||||
"AG_Med"
|
||||
"AG_Small"
|
||||
"NS_Med")
|
||||
"NS_Med"
|
||||
"../../Enemy/AG") # the AG property zone reports zone volumes to the Spider Queen
|
||||
|
||||
Reference in New Issue
Block a user