mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 02:43:44 +00:00
fix(njhub): the cave prison counterweight goes down as its simple mover
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
#include "Character.h"
|
#include "Character.h"
|
||||||
#include "dZoneManager.h"
|
#include "dZoneManager.h"
|
||||||
#include "RenderComponent.h"
|
#include "RenderComponent.h"
|
||||||
|
#include "MovingPlatformComponent.h"
|
||||||
|
|
||||||
void CavePrisonCage::OnStartup(Entity* self) {
|
void CavePrisonCage::OnStartup(Entity* self) {
|
||||||
const auto& myNum = self->GetVar<std::u16string>(u"myNumber");
|
const auto& myNum = self->GetVar<std::u16string>(u"myNumber");
|
||||||
@@ -83,20 +84,15 @@ void CavePrisonCage::SpawnCounterweight(Entity* self, Spawner* spawner) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
quickBuildComponent->AddQuickBuildCompleteCallback([this, self](Entity* user) {
|
quickBuildComponent->AddQuickBuildCompleteCallback([this, self](Entity* user) {
|
||||||
// The counterweight is a simple mover, which is not implemented, so we'll just set it's position
|
|
||||||
auto* counterweight = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"Counterweight"));
|
auto* counterweight = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"Counterweight"));
|
||||||
|
|
||||||
if (counterweight == nullptr) {
|
if (counterweight == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the counterweight down 2 units
|
// The counterweight is a simple mover (MovingPlatforms row 41): send it down to its end
|
||||||
counterweight->SetPosition(counterweight->GetPosition() + NiPoint3(0, -2, 0));
|
auto* const platform = counterweight->GetComponent<MovingPlatformComponent>();
|
||||||
|
if (platform) platform->GotoWaypoint(1);
|
||||||
// Serialize the counterweight
|
|
||||||
Game::entityManager->SerializeEntity(counterweight);
|
|
||||||
|
|
||||||
// notifyPlatformAtLastWaypoint
|
|
||||||
|
|
||||||
// Save the userID as Builder
|
// Save the userID as Builder
|
||||||
self->SetVar<LWOOBJID>(u"Builder", user->GetObjectID());
|
self->SetVar<LWOOBJID>(u"Builder", user->GetObjectID());
|
||||||
|
|||||||
Reference in New Issue
Block a user