mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-11-15 06:38:48 +00:00
feat banana (#1917)
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
#include "GfBananaCluster.h"
|
||||
#include "Entity.h"
|
||||
#include "dpWorld.h"
|
||||
#include "dNavMesh.h"
|
||||
#include "Loot.h"
|
||||
#include "DestroyableComponent.h"
|
||||
|
||||
void GfBananaCluster::OnStartup(Entity* self) {
|
||||
self->AddTimer("startup", 100);
|
||||
@@ -10,3 +14,21 @@ void GfBananaCluster::OnTimerDone(Entity* self, std::string timerName) {
|
||||
self->ScheduleKillAfterUpdate(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
// Hack in banana loot dropping from tree area since it seemed to do that in live for some reason
|
||||
void GfBananaCluster::OnHit(Entity* self, Entity* attacker) {
|
||||
auto* parentEntity = self->GetParentEntity();
|
||||
GameMessages::GetPosition posMsg{};
|
||||
if (parentEntity) {
|
||||
posMsg.target = parentEntity->GetObjectID();
|
||||
}
|
||||
posMsg.Send();
|
||||
|
||||
const auto rotation = parentEntity ? parentEntity->GetRotation() : self->GetRotation();
|
||||
|
||||
if (dpWorld::GetNavMesh()) posMsg.pos.y = dpWorld::GetNavMesh()->GetHeightAtPoint(posMsg.pos) + 3.0f;
|
||||
else posMsg.pos = posMsg.pos - (NiPoint3Constant::UNIT_Y * 8);
|
||||
posMsg.pos.x -= QuatUtils::Right(rotation).x * 5;
|
||||
posMsg.pos.z -= QuatUtils::Right(rotation).z * 5;
|
||||
self->SetPosition(posMsg.pos);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user