2021-12-05 17:54:36 +00:00
|
|
|
#include "AmSkullkinDrillStand.h"
|
|
|
|
#include "GameMessages.h"
|
|
|
|
#include "dpEntity.h"
|
2023-03-20 13:10:52 +00:00
|
|
|
#include "Entity.h"
|
|
|
|
#include "RenderComponent.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
void AmSkullkinDrillStand::OnStartup(Entity* self) {
|
|
|
|
self->SetVar(u"bActive", true);
|
|
|
|
|
|
|
|
self->SetProximityRadius(new dpEntity(self->GetObjectID(), { 6, 14, 6 }), "knockback");
|
|
|
|
}
|
|
|
|
|
|
|
|
void AmSkullkinDrillStand::OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1, int32_t param2) {
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void AmSkullkinDrillStand::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
|
|
|
|
if (!self->GetVar<bool>(u"bActive")) {
|
2022-07-28 13:39:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
if (!entering->IsPlayer() || status != "ENTER" || name != "knockback") {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto myPos = self->GetPosition();
|
|
|
|
|
|
|
|
auto objPos = entering->GetPosition();
|
|
|
|
|
|
|
|
NiPoint3 newVec = { (objPos.x - myPos.x) * 4.5f, 15, (objPos.z - myPos.z) * 4.5f };
|
|
|
|
|
|
|
|
GameMessages::SendKnockback(entering->GetObjectID(), self->GetObjectID(), self->GetObjectID(), 0, newVec);
|
|
|
|
|
|
|
|
GameMessages::SendPlayFXEffect(entering->GetObjectID(), 1378, u"create", "pushBack");
|
|
|
|
|
2023-03-20 13:10:52 +00:00
|
|
|
RenderComponent::PlayAnimation(entering, u"knockback-recovery");
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|