feat(scripts): Portabello's frog bridge puts its tongue out for players who earned it

WBL_Frog_Bridge had no script. As the live script: when a player who finished mission 946 comes within 25 units,
the four FrogBridge pieces move out to form the bridge; after 10 seconds they go back one a second from the tip,
and 7 seconds later the frog looks for players again. Check: in Portabello, with mission 946 done, walk up to the
frog: the tongue bridge comes out and goes back; without the mission it doesn't. Depends on moving platforms
following their paths.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-29 09:35:12 -05:00
parent 88b2ef5f38
commit 32fe441d57
4 changed files with 80 additions and 0 deletions

View File

@@ -323,6 +323,7 @@
// WBL scripts
#include "WblGenericZone.h"
#include "WblStarflies.h"
#include "WblFrogBridge.h"
// Alpha Scripts
#include "TriggerGas.h"
@@ -690,6 +691,7 @@ namespace {
//WBL
{"scripts\\zone\\LUPs\\WBL_generic_zone.lua", []() {return new WblGenericZone();}},
{"scripts\\zone\\LUPs\\Portabello Intro\\WBL_Starflies.lua", []() {return new WblStarflies();}},
{"scripts\\zone\\LUPs\\Portabello Intro\\WBL_Frog_Bridge.lua", []() {return new WblFrogBridge();}},
{"scripts\\zone\\LUPs\\Moonbase Intro\\MOONBASE-INTRO_INTRO_CINEMATIC.lua", []() {return new WblGenericZone();}},
//Alpha

View File

@@ -1,6 +1,7 @@
set(DSCRIPTS_SOURCES_ZONE_LUPS
"WblGenericZone.cpp"
"WblStarflies.cpp"
"WblFrogBridge.cpp"
)
add_subdirectory(RobotCity_Intro)

View File

@@ -0,0 +1,63 @@
#include "WblFrogBridge.h"
#include "Entity.h"
#include "EntityManager.h"
#include "eMissionState.h"
#include "MissionComponent.h"
#include "MovingPlatformComponent.h"
#include "ProximityMonitorComponent.h"
namespace {
constexpr uint32_t BRIDGE_MISSION = 946;
}
void WblFrogBridge::OnStartup(Entity* self) {
self->SetProximityRadius(25.0f, "frog");
self->SetVar<bool>(u"TongueOut", false);
}
void WblFrogBridge::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
if (name == "frog" && status == "ENTER") StickOutTongue(self);
}
// Piece 1-4: the first object of group FrogBridge01..04
void WblFrogBridge::MovePiece(const int piece, const uint32_t waypoint) {
const auto pieces = Game::entityManager->GetEntitiesInGroup("FrogBridge0" + std::to_string(piece));
if (pieces.empty()) return;
if (auto* movingPlatform = pieces.front()->GetComponent<MovingPlatformComponent>()) movingPlatform->GotoWaypoint(waypoint, true);
}
void WblFrogBridge::StickOutTongue(Entity* self) {
if (self->GetVar<bool>(u"TongueOut")) return;
auto* proximity = self->GetComponent<ProximityMonitorComponent>();
if (!proximity) return;
for (const auto id : proximity->GetProximityObjects("frog")) {
auto* player = Game::entityManager->GetEntity(id);
auto* missions = player ? player->GetComponent<MissionComponent>() : nullptr;
if (!missions || missions->GetMissionState(BRIDGE_MISSION) < eMissionState::COMPLETE) continue;
for (int piece = 1; piece <= 4; piece++) MovePiece(piece, 1);
self->SetVar<bool>(u"TongueOut", true);
self->AddTimer("tongueWait", 10.0f);
return;
}
}
void WblFrogBridge::OnTimerDone(Entity* self, std::string timerName) {
// Back one piece a second, from the tip, then 7 seconds before the frog looks for players again
if (timerName == "tongueWait") {
self->AddTimer("back4", 1.0f);
MovePiece(4, 0);
} else if (timerName == "back4") {
self->AddTimer("back3", 1.0f);
MovePiece(3, 0);
} else if (timerName == "back3") {
self->AddTimer("back2", 1.0f);
MovePiece(2, 0);
} else if (timerName == "back2") {
self->AddTimer("tongueIn", 7.0f);
MovePiece(1, 0);
} else if (timerName == "tongueIn") {
self->SetVar<bool>(u"TongueOut", false);
StickOutTongue(self);
}
}

View File

@@ -0,0 +1,14 @@
#pragma once
#include "CppScripts.h"
// WBL_Frog_Bridge (Portabello): the frog puts its tongue out as a bridge (the four FrogBridge pieces move to their
// second waypoint) when a player who finished mission 946 comes near, then pulls it back piece by piece
class WblFrogBridge : public CppScripts::Script {
public:
void OnStartup(Entity* self) override;
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override;
void OnTimerDone(Entity* self, std::string timerName) override;
private:
static void StickOutTongue(Entity* self);
static void MovePiece(int piece, uint32_t waypoint);
};