mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-30 01:41:40 +00:00
Merge exp/game-spellings: names as the game spells them
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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");
|
||||
|
||||
|
||||
@@ -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<std::u16string>(u"Cinematic"));
|
||||
const auto leanIn = self->GetVar<float>(u"LeanIn");
|
||||
// The mast's config holds the lead-in as an integer (LeadIn=1:1)
|
||||
const auto leadIn = self->GetVarAs<float>(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());
|
||||
}
|
||||
|
||||
|
||||
@@ -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();}},
|
||||
|
||||
@@ -31,6 +31,7 @@ set(DGAMETEST_SOURCES
|
||||
"PreconditionCheckTests.cpp"
|
||||
"PreconditionItemCostTests.cpp"
|
||||
"SpiderQueenTests.cpp"
|
||||
"GameSpellingsTests.cpp"
|
||||
"TacArcTests.cpp"
|
||||
"CDFdbTests.cpp"
|
||||
"CDClientReloadTests.cpp"
|
||||
|
||||
55
tests/dGameTests/GameSpellingsTests.cpp
Normal file
55
tests/dGameTests/GameSpellingsTests.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "GameDependencies.h"
|
||||
#include "Entity.h"
|
||||
#include "EffectsMessages.h"
|
||||
#include "CppScripts.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<std::unique_ptr<Entity>> 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<Entity>(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<std::u16string>(u"Cinematic", u"MastSwing_01");
|
||||
mast->SetVar<int32_t>(u"LeadIn", 1);
|
||||
mast->SetVar<LWOOBJID>(u"userID", player->GetObjectID());
|
||||
|
||||
MastTeleport script;
|
||||
const auto packets = Capture([&] { script.OnTimerDone(mast, "Start"); });
|
||||
const auto sent = SentGameMessages<GameMessages::PlayCinematic>(packets);
|
||||
ASSERT_EQ(sent.size(), 1u);
|
||||
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());
|
||||
}
|
||||
Reference in New Issue
Block a user