feat(scripts): L_DOOR_INDICATOR_SERVER

Either named event lights the Fire Temple door indicator's flame (FlameOn), as the Lua does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-11-28 11:32:10 -06:00
parent 6ad3168659
commit ecd67f9d35
5 changed files with 33 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL
"BankInteractServer.cpp"
"BaseInteractDropLootServer.cpp"
"Binoculars.cpp"
"DoorIndicatorServer.cpp"
"EnemyClearThreat.cpp"
"ExplodingAsset.cpp"
"FrictionVolumeServer.cpp"

View File

@@ -0,0 +1,8 @@
#include "DoorIndicatorServer.h"
#include "Entity.h"
void DoorIndicatorServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) {
const bool deactivated = self->HasVar(u"name_deactivated_event") && args == self->GetVarAsString(u"name_deactivated_event");
const bool activated = self->HasVar(u"name_activated_event") && args == self->GetVarAsString(u"name_activated_event");
if (deactivated || activated) self->SetNetworkVar<bool>(u"FlameOn", true);
}

View File

@@ -0,0 +1,9 @@
#pragma once
#include "CppScripts.h"
// L_DOOR_INDICATOR_SERVER.lua (Fire Temple): the event named by name_activated_event or name_deactivated_event lights
// the indicator's flame (FlameOn). The Lua sets it true for both.
class DoorIndicatorServer : public CppScripts::Script {
public:
void OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) override;
};

View File

@@ -278,6 +278,7 @@
#include "SimpleMoverSwitch.h"
#include "KillCounterUtil.h"
#include "SpinnersVol.h"
#include "DoorIndicatorServer.h"
#include "SimpleOnceOnlyMoverSpinnerEvent.h"
#include "ImaginationShrineServer.h"
#include "Lieutenant.h"
@@ -695,6 +696,7 @@ namespace {
{"scripts\\02_server\\Map\\firetemple\\L_SIMPLE_ONCE_ONLY_MOVER_SPINNER_EVENT.lua", []() {return new SimpleOnceOnlyMoverSpinnerEvent();}},
{"scripts\\02_server\\Map\\firetemple\\L_BSPINNERS_VOL.lua", []() {return new BSpinnersVol();}},
{"scripts\\02_server\\Map\\firetemple\\L_DSPINNERS_VOL.lua", []() {return new DSpinnersVol();}},
{"scripts\\02_server\\Map\\firetemple\\L_DOOR_INDICATOR_SERVER.lua", []() {return new DoorIndicatorServer();}},
{"scripts\\02_server\\Map\\General\\L_KILL_COUNTER_UTIL.lua", []() {return new KillCounterUtil();}},
{"scripts\\02_server\\Enemy\\General\\L_ENEMY_NJ_BUFF_STUN_IMMUNITY.lua", []() {return new EnemyNjBuff();}},
{"scripts\\02_server\\Map\\njhub\\L_IMAGINATION_SHRINE_SERVER.lua", []() {return new ImaginationShrineServer();}},

View File

@@ -5,6 +5,7 @@
#include "GameMessages.h"
#include "02_server/Map/General/KillCounterUtil.h"
#include "02_server/Map/General/SpinnersVol.h"
#include "02_server/Map/General/DoorIndicatorServer.h"
namespace {
// A kill counter extension that records its limit events
@@ -81,3 +82,15 @@ TEST_F(FireTempleScriptsTest, SpinnersVolStartsItsRailTimerAtMax) {
blades.OnTimerDone(&entity, "SpawnIceRail");
}
// L_DOOR_INDICATOR_SERVER: either named event lights the flame; any other does nothing
TEST_F(FireTempleScriptsTest, DoorIndicatorLightsOnEitherEvent) {
info.settings.Insert<std::u16string>(u"name_activated_event", u"DoorOpen");
info.settings.Insert<std::u16string>(u"name_deactivated_event", u"DoorClose");
Entity entity(288300744895900203, info);
info.settings.values.clear();
DoorIndicatorServer indicator;
indicator.OnFireEventServerSide(&entity, &entity, "Other", 0, 0, 0);
EXPECT_FALSE(entity.GetNetworkVar<bool>(u"FlameOn"));
indicator.OnFireEventServerSide(&entity, &entity, "DoorClose", 0, 0, 0);
EXPECT_TRUE(entity.GetNetworkVar<bool>(u"FlameOn"));
}