DarkflameServer/dScripts/02_server/Map/AG/AgLaserSensorServer.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
1.1 KiB
C++
Raw Normal View History

#include "AgLaserSensorServer.h"
#include "PhantomPhysicsComponent.h"
#include "SkillComponent.h"
#include "ePhysicsEffectType.h"
void AgLaserSensorServer::OnStartup(Entity* self) {
self->SetBoolean(u"active", true);
auto repelForce = self->GetVarAs<float>(u"repelForce");
if (!repelForce) repelForce = m_RepelForce;
2023-06-07 07:23:50 +00:00
auto phantomPhysicsComponent = self->GetComponent<PhantomPhysicsComponent>();
if (!phantomPhysicsComponent) return;
phantomPhysicsComponent->SetPhysicsEffectActive(true);
phantomPhysicsComponent->SetEffectType(ePhysicsEffectType::REPULSE);
phantomPhysicsComponent->SetDirectionalMultiplier(repelForce);
phantomPhysicsComponent->SetDirection(NiPoint3::UNIT_Y);
}
void AgLaserSensorServer::OnCollisionPhantom(Entity* self, Entity* target) {
auto active = self->GetVar<bool>(u"active");
if (!active) return;
auto skillCastID = self->GetVarAs<float>(u"skillCastID");
if (skillCastID == 0) skillCastID = m_SkillCastID;
2023-06-07 07:23:50 +00:00
auto skillComponent = self->GetComponent<SkillComponent>();
if (!skillComponent) return;
skillComponent->CastSkill(m_SkillCastID, target->GetObjectID());
}