DarkflameServer/dScripts/02_server/Map/General/Ninjago/NjIceRailActivator.cpp
David Markowitz b432a3f5da Remove inlines
Clean up macros

more tomorrow

Cleanup and optimize CDActivities table

Remove unused include

Further work on CDActivityRewards

Update MasterServer.cpp

Further animations work

Activities still needs work for a better PK.

fix type

All of these replacements worked

Create internal interface for animations

Allows for user to just call GetAnimationTIme or PlayAnimation rather than passing in arbitrary true false statements
2023-03-26 02:59:46 -07:00

28 lines
844 B
C++

#include "NjIceRailActivator.h"
#include "EntityManager.h"
#include "GameMessages.h"
#include "Entity.h"
#include "RenderComponent.h"
void NjIceRailActivator::OnPlayerRailArrived(Entity* self, Entity* sender, const std::u16string& pathName,
int32_t waypoint) {
const auto breakPoint = self->GetVar<int32_t>(BreakpointVariable);
if (breakPoint == waypoint) {
const auto& blockGroup = self->GetVar<std::u16string>(BlockGroupVariable);
for (auto* block : EntityManager::Instance()->GetEntitiesInGroup(GeneralUtils::UTF16ToWTF8(blockGroup))) {
RenderComponent::PlayAnimation(block, u"explode");
const auto blockID = block->GetObjectID();
self->AddCallbackTimer(1.0f, [self, blockID]() {
auto* block = EntityManager::Instance()->GetEntity(blockID);
if (block != nullptr) {
block->Kill(self);
}
});
}
}
}