fix(shooting gallery): moving platform targets run on their mover, as live

sg_cannon.lua puts a moving platform target (the subs and the kraken) on its path with SetCurrentPath{ pathName, startPoint = 0 }; its SetPathingSpeed is read by nothing on a moving platform, so these run their paths at the waypoints' speeds (10, 15 and 35 in the zone), as the client's mover does. Live constructed them with the path and the mover waiting at waypoint 0 (9) and serialized the mover at each waypoint (9, then 2). They had a movement AI and a made up PlatformResync instead, and the kraken a speed chosen to look right, which goes back to the script's.

PlatformResync's constructor that overrode its arguments for a few LOTs (the FV tree platform 9483 among them) has no user left and is gone; a resync request is answered by movers only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-11-10 13:36:25 -06:00
parent 275243cf86
commit 11d7455cad
4 changed files with 40 additions and 57 deletions

View File

@@ -11,6 +11,7 @@
#include "CharacterComponent.h"
#include "SimplePhysicsComponent.h"
#include "MovementAIComponent.h"
#include "MovingPlatformComponent.h"
#include "MissionComponent.h"
#include "Loot.h"
#include "InventoryComponent.h"
@@ -295,7 +296,17 @@ void SGCannon::DoSpawnTimerFunc(Entity* self, const std::string& name) {
auto* enemy = Game::entityManager->CreateEntity(info, nullptr, self);
auto* movementAI = enemy->AddComponent<MovementAIComponent>(-1, MovementAIInfo{});
// sg_cannon.lua (onChildLoaded): a moving platform target gets SetPathingSpeed, which nothing on a moving platform
// reads, and SetCurrentPath{ pathName, startPoint = 0 }: its mover runs the path at the waypoints' speeds, as the
// client's does. Live constructed these targets with the path and the mover waiting at waypoint 0 (9), and
// serialized the mover at each waypoint. The other targets follow their waypoints.
auto* const movingPlatform = toSpawn.isMovingPlatform ? enemy->GetComponent<MovingPlatformComponent>() : nullptr;
MovementAIComponent* movementAI = nullptr;
if (movingPlatform) {
movingPlatform->SetCurrentPath(path->pathName, 0);
} else {
movementAI = enemy->AddComponent<MovementAIComponent>(-1, MovementAIInfo{});
}
auto* simplePhysicsComponent = enemy->GetComponent<SimplePhysicsComponent>();
if (simplePhysicsComponent) {
simplePhysicsComponent->SetPhysicsMotionState(4);
@@ -303,20 +314,21 @@ void SGCannon::DoSpawnTimerFunc(Entity* self, const std::string& name) {
Game::entityManager->ConstructEntity(enemy);
movementAI->SetMaxSpeed(toSpawn.initialSpeed);
movementAI->SetCurrentSpeed(toSpawn.initialSpeed);
movementAI->SetHaltDistance(0.0f);
if (movementAI) {
movementAI->SetMaxSpeed(toSpawn.initialSpeed);
movementAI->SetCurrentSpeed(toSpawn.initialSpeed);
movementAI->SetHaltDistance(0.0f);
movementAI->SetPath(path->pathWaypoints);
movementAI->SetPath(path->pathWaypoints);
}
enemy->AddDieCallback([this, self, enemy, name]() {
RegisterHit(self, enemy, name);
});
// Save the enemy and tell it to start pathing
// Save the enemy
if (enemy != nullptr) {
const_cast<std::vector<LWOOBJID>&>(self->GetVar<std::vector<LWOOBJID>>(SpawnedObjects)).push_back(enemy->GetObjectID());
GameMessages::PlatformResync(*enemy).Send(UNASSIGNED_SYSTEM_ADDRESS);
}
}
}
@@ -1104,22 +1116,14 @@ std::vector<std::vector<SGEnemy>> SGCannon::GetWaves() {
1.0, false, true
},
// Ness temp fix for dlu where speeds are set to 7 to match a speed closer to live while we work on movingplatform components.
// Ness
{
std::vector<std::string> { "Wave_1_Ness_1", "Wave_1_Ness_2", "Wave_2_Ness_1" },
2565, 10.0, 15.0, true, 10.0, 15.0,
7.0, 10000, false, 0.0, 7.0,
7.0, true, true
2.0, 10000, false, 0.0, 1.0,
1.0, true, true
},
// // Ness
// {
// std::vector<std::string> { "Wave_1_Ness_1", "Wave_1_Ness_2", "Wave_2_Ness_1" },
// 2565, 10.0, 15.0, true, 10.0, 15.0,
// 2.0, 10000, false, 0.0, 1.0,
// 1.0, true, true
// },
// Friendly 1
{
std::vector<std::string> { "Wave_3_FShip_1", "Wave_3_FShip_2" },