feat: add the lightning orb script* (#2011)

* feat: add the lightning orb script*

Doesn't do anything because MPC don't work...

* Update LightningOrbServer.cpp
This commit is contained in:
David Markowitz
2026-06-20 22:30:44 -07:00
committed by GitHub
parent ccc029424c
commit 83707e2210
5 changed files with 37 additions and 1 deletions

View File

@@ -369,8 +369,21 @@ public:
template<typename AmfType = AMFArrayValue> template<typename AmfType = AMFArrayValue>
AmfType& PushDebug(const std::string_view name) { AmfType& PushDebug(const std::string_view name) {
size_t i = 0;
for (; i < m_Dense.size(); i++) {
const auto& cast = dynamic_cast<AMFArrayValue*>(m_Dense[i].get());
if (!cast) continue;
const auto& nameValue = cast->Get<std::string>("name");
if (!nameValue || nameValue->GetValue() != name) continue;
// found a duplicate, return this instead
auto valueCast = dynamic_cast<AmfType*>(cast->Get("value"));
if (valueCast) return *valueCast;
}
auto* value = PushArray(); auto* value = PushArray();
value->Insert("name", name.data()); value->Insert<std::string>("name", name.data());
return value->Insert<AmfType>("value", std::make_unique<AmfType>()); return value->Insert<AmfType>("value", std::make_unique<AmfType>());
} }

View File

@@ -6,6 +6,7 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_NJHUB
"EnemySkeletonSpawner.cpp" "EnemySkeletonSpawner.cpp"
"FallingTile.cpp" "FallingTile.cpp"
"FlameJetServer.cpp" "FlameJetServer.cpp"
"LightningOrbServer.cpp"
"ImaginationShrineServer.cpp" "ImaginationShrineServer.cpp"
"Lieutenant.cpp" "Lieutenant.cpp"
"MonCoreNookDoors.cpp" "MonCoreNookDoors.cpp"

View File

@@ -0,0 +1,12 @@
#include "LightningOrbServer.h"
void LightningOrbServer::OnCollisionPhantom(Entity* self, Entity* target) {
GameMessages::GetPosition playerPos;
playerPos.Send(target->GetObjectID());
GameMessages::GetPosition selfPos;
selfPos.Send(self->GetObjectID());
const NiPoint3 newVec((playerPos.pos.x - selfPos.pos.x) * 2.5, 15, (playerPos.pos.z - selfPos.pos.z) * 2.5);
// ahhhh aron said to put a TODO here moving platforms don't work lol. disable this so people can actually do the puzzle
// GameMessages::SendKnockback(target->GetObjectID(), self->GetObjectID(), self->GetObjectID(), 0, newVec);
// GameMessages::SendPlayFXEffect(target->GetObjectID(), -1, u"knockback", "knockback");
}

View File

@@ -0,0 +1,8 @@
#pragma once
#include "CppScripts.h"
class LightningOrbServer : public CppScripts::Script
{
public:
void OnCollisionPhantom(Entity* self, Entity* target) override;
};

View File

@@ -274,6 +274,7 @@
#include "MonCoreNookDoors.h" #include "MonCoreNookDoors.h"
#include "MonCoreSmashableDoors.h" #include "MonCoreSmashableDoors.h"
#include "FlameJetServer.h" #include "FlameJetServer.h"
#include "LightningOrbServer.h"
#include "BurningTile.h" #include "BurningTile.h"
#include "NjEarthDragonPetServer.h" #include "NjEarthDragonPetServer.h"
#include "NjEarthPetServer.h" #include "NjEarthPetServer.h"
@@ -628,6 +629,7 @@ namespace {
{"scripts\\02_server\\Map\\njhub\\L_MON_CORE_SMASHABLE_DOORS.lua", []() {return new MonCoreSmashableDoors();}}, {"scripts\\02_server\\Map\\njhub\\L_MON_CORE_SMASHABLE_DOORS.lua", []() {return new MonCoreSmashableDoors();}},
{"scripts\\02_server\\Map\\njhub\\L_MON_CORE_SMASHABLE_DOORS.lua", []() {return new MonCoreSmashableDoors();}}, {"scripts\\02_server\\Map\\njhub\\L_MON_CORE_SMASHABLE_DOORS.lua", []() {return new MonCoreSmashableDoors();}},
{"scripts\\02_server\\Map\\njhub\\L_FLAME_JET_SERVER.lua", []() {return new FlameJetServer();}}, {"scripts\\02_server\\Map\\njhub\\L_FLAME_JET_SERVER.lua", []() {return new FlameJetServer();}},
{"scripts\\02_server\\Map\\njhub\\L_LIGHTNING_ORB_SERVER.lua", []() {return new LightningOrbServer();}},
{"scripts\\02_server\\Map\\njhub\\L_BURNING_TILE.lua", []() {return new BurningTile();}}, {"scripts\\02_server\\Map\\njhub\\L_BURNING_TILE.lua", []() {return new BurningTile();}},
{"scripts\\02_server\\Map\\njhub\\L_SPAWN_EARTH_PET_SERVER.lua", []() {return new NjEarthDragonPetServer();}}, {"scripts\\02_server\\Map\\njhub\\L_SPAWN_EARTH_PET_SERVER.lua", []() {return new NjEarthDragonPetServer();}},
{"scripts\\02_server\\Map\\njhub\\L_EARTH_PET_SERVER.lua", []() {return new NjEarthPetServer();}}, {"scripts\\02_server\\Map\\njhub\\L_EARTH_PET_SERVER.lua", []() {return new NjEarthPetServer();}},