From a956e615f8fbc2fd938d41e342c200d4afe459c9 Mon Sep 17 00:00:00 2001 From: Aaron Kimbrell Date: Wed, 11 Nov 2026 07:08:36 -0600 Subject: [PATCH 1/3] fix(scripts): the mast swing reads its lead-in as the game names it The Gnarled Forest masts give the cinematic lead-in as LeadIn, an integer (LeadIn=1:1). The mast script read LeanIn as a float, so the swing cinematic always played with no lead-in. It now reads LeadIn and takes the integer. Co-Authored-By: Claude Opus 5.5 --- dScripts/02_server/Map/GF/MastTeleport.cpp | 5 ++- tests/dGameTests/CMakeLists.txt | 1 + tests/dGameTests/GameSpellingsTests.cpp | 48 ++++++++++++++++++++++ 3 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 tests/dGameTests/GameSpellingsTests.cpp diff --git a/dScripts/02_server/Map/GF/MastTeleport.cpp b/dScripts/02_server/Map/GF/MastTeleport.cpp index 25b7824c3..892752848 100644 --- a/dScripts/02_server/Map/GF/MastTeleport.cpp +++ b/dScripts/02_server/Map/GF/MastTeleport.cpp @@ -57,7 +57,8 @@ void MastTeleport::OnTimerDone(Entity* self, std::string timerName) { GameMessages::Teleport(playerId, position, rotation, true).SendToClient(player->GetSystemAddress()); const auto cinematic = GeneralUtils::UTF16ToWTF8(self->GetVar(u"Cinematic")); - const auto leanIn = self->GetVar(u"LeanIn"); + // The mast's config holds the lead-in as an integer (LeadIn=1:1) + const auto leadIn = self->GetVarAs(u"LeadIn"); if (!cinematic.empty()) { GameMessages::PlayCinematic playCinematic; @@ -69,7 +70,7 @@ void MastTeleport::OnTimerDone(Entity* self, std::string timerName) { playCinematic.bUseControlledObjectForAudioListener = false; playCinematic.endBehavior = eEndBehavior::RETURN; playCinematic.hidePlayerDuringCine = false; - playCinematic.leadIn = leanIn; + playCinematic.leadIn = leadIn; playCinematic.Send(player->GetSystemAddress()); } diff --git a/tests/dGameTests/CMakeLists.txt b/tests/dGameTests/CMakeLists.txt index 1a53c7689..46cd990b2 100644 --- a/tests/dGameTests/CMakeLists.txt +++ b/tests/dGameTests/CMakeLists.txt @@ -31,6 +31,7 @@ set(DGAMETEST_SOURCES "PreconditionCheckTests.cpp" "PreconditionItemCostTests.cpp" "SpiderQueenTests.cpp" + "GameSpellingsTests.cpp" "TacArcTests.cpp" "CDFdbTests.cpp" "CDClientReloadTests.cpp" diff --git a/tests/dGameTests/GameSpellingsTests.cpp b/tests/dGameTests/GameSpellingsTests.cpp new file mode 100644 index 000000000..585bc20ac --- /dev/null +++ b/tests/dGameTests/GameSpellingsTests.cpp @@ -0,0 +1,48 @@ +#include + +#include "GameDependencies.h" +#include "Entity.h" +#include "EffectsMessages.h" +#include "dGameMessagesTests/GameMessageTestUtils.h" + +#include "02_server/Map/GF/MastTeleport.h" + +// Names the server reads from the shipped game data, spelt as the game spells them. + +using namespace GameMessageTestUtils; + +class GameSpellingsTest : public GameDependenciesTest { +protected: + std::vector> entities; + + void SetUp() override { SetUpDependencies(); } + + void TearDown() override { + for (const auto& entity : entities) Game::entityManager->_removeEntity(entity->GetObjectID()); + entities.clear(); + TearDownDependencies(); + } + + Entity* Add(const LWOOBJID id, const LOT lot) { + info.lot = lot; + auto* const entity = entities.emplace_back(std::make_unique(id, info)).get(); + Game::entityManager->_addEntity(entity); + return entity; + } +}; + +// The Gnarled Forest masts' config: Cinematic=0:MastSwing_01 and LeadIn=1:1 (an integer) +TEST_F(GameSpellingsTest, TheMastSwingCinematicTakesTheMastsLeadIn) { + auto* const mast = Add(0x1000, 6714); + auto* const player = Add(0x1001, 1); + mast->SetVar(u"Cinematic", u"MastSwing_01"); + mast->SetVar(u"LeadIn", 1); + mast->SetVar(u"userID", player->GetObjectID()); + + MastTeleport script; + const auto packets = Capture([&] { script.OnTimerDone(mast, "Start"); }); + const auto sent = SentGameMessages(packets); + ASSERT_EQ(sent.size(), 1u); + EXPECT_EQ(sent[0].pathName, u"MastSwing_01"); + EXPECT_FLOAT_EQ(sent[0].leadIn, 1.0f); +} From 0d6d47cb742d6388b0efca4fd2da80593948af90 Mon Sep 17 00:00:00 2001 From: Aaron Kimbrell Date: Wed, 11 Nov 2026 07:08:48 -0600 Subject: [PATCH 2/3] fix(scripts): the stun immunity script path as the game spells it The CDClient script components of the summoned pets and allies (Bulper, Thwok, the Make-Shift Buddies and others) name scripts\EquipmentScripts\StunImmunity.lua. The script table had stunImmunity.lua, so those objects never got the script and were not made immune to stuns, knockbacks, interrupts and pulls. The table now has the game's path. Co-Authored-By: Claude Opus 5.5 --- dScripts/CppScripts.cpp | 2 +- tests/dGameTests/GameSpellingsTests.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/dScripts/CppScripts.cpp b/dScripts/CppScripts.cpp index 0c2a30b4e..9dd355f3a 100644 --- a/dScripts/CppScripts.cpp +++ b/dScripts/CppScripts.cpp @@ -732,7 +732,7 @@ namespace { {"scripts\\equipmenttriggers\\gempack.lua", []() {return new GemPack();}}, {"scripts\\equipmenttriggers\\shardarmor.lua", []() {return new ShardArmor();}}, {"scripts\\equipmenttriggers\\coilbackpack.lua", []() {return new TeslaPack();}}, - {"scripts\\EquipmentScripts\\stunImmunity.lua", []() {return new StunImmunity();}}, + {"scripts\\EquipmentScripts\\StunImmunity.lua", []() {return new StunImmunity();}}, //FB {"scripts\\ai\\NS\\WH\\L_ROCKHYDRANT_BROKEN.lua", []() {return new RockHydrantBroken();}}, diff --git a/tests/dGameTests/GameSpellingsTests.cpp b/tests/dGameTests/GameSpellingsTests.cpp index 585bc20ac..95fb8652e 100644 --- a/tests/dGameTests/GameSpellingsTests.cpp +++ b/tests/dGameTests/GameSpellingsTests.cpp @@ -3,6 +3,7 @@ #include "GameDependencies.h" #include "Entity.h" #include "EffectsMessages.h" +#include "CppScripts.h" #include "dGameMessagesTests/GameMessageTestUtils.h" #include "02_server/Map/GF/MastTeleport.h" @@ -46,3 +47,9 @@ TEST_F(GameSpellingsTest, TheMastSwingCinematicTakesTheMastsLeadIn) { EXPECT_EQ(sent[0].pathName, u"MastSwing_01"); EXPECT_FLOAT_EQ(sent[0].leadIn, 1.0f); } + +// The summoned pets' and allies' script components (scripts\EquipmentScripts\StunImmunity.lua) +TEST_F(GameSpellingsTest, TheStunImmunityScriptLoadsByTheGamesPath) { + auto* const pet = Add(0x1000, 8563); + EXPECT_NE(CppScripts::GetScript(pet, "scripts\\EquipmentScripts\\StunImmunity.lua"), CppScripts::GetInvalidScript()); +} From 76b5b45d712f67ee593fc0b604a0a87589972082 Mon Sep 17 00:00:00 2001 From: Aaron Kimbrell Date: Wed, 11 Nov 2026 07:09:07 -0600 Subject: [PATCH 3/3] fix(behaviors): the verify behavior's blocking check as the game names it The verify behaviors' parameter is check_blocking (on 145 of them), and the client checks blocking unless it is 0. The server read "check blocking", which no behavior has. It now reads check_blocking with the client's default. The blocking check itself is still to be written. Co-Authored-By: Claude Opus 5.5 --- dGame/dBehaviors/VerifyBehavior.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dGame/dBehaviors/VerifyBehavior.cpp b/dGame/dBehaviors/VerifyBehavior.cpp index ec4b27a87..16f50af3f 100644 --- a/dGame/dBehaviors/VerifyBehavior.cpp +++ b/dGame/dBehaviors/VerifyBehavior.cpp @@ -52,7 +52,8 @@ void VerifyBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitS void VerifyBehavior::Load() { this->m_rangeCheck = GetBoolean("check_range"); - this->m_blockCheck = GetBoolean("check blocking"); + // The client checks blocking unless the behavior turns it off + this->m_blockCheck = GetBoolean("check_blocking", true); this->m_action = GetAction("action");