mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-06-21 14:14:22 +00:00
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:
@@ -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>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
12
dScripts/02_server/Map/njhub/LightningOrbServer.cpp
Normal file
12
dScripts/02_server/Map/njhub/LightningOrbServer.cpp
Normal 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");
|
||||||
|
}
|
||||||
8
dScripts/02_server/Map/njhub/LightningOrbServer.h
Normal file
8
dScripts/02_server/Map/njhub/LightningOrbServer.h
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "CppScripts.h"
|
||||||
|
|
||||||
|
class LightningOrbServer : public CppScripts::Script
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void OnCollisionPhantom(Entity* self, Entity* target) override;
|
||||||
|
};
|
||||||
@@ -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();}},
|
||||||
|
|||||||
Reference in New Issue
Block a user