mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-06 18:54:13 +00:00
initial dig functionality; need to clean up kruft
This commit is contained in:
@@ -101,6 +101,17 @@ void PetDigServer::OnDie(Entity* self, Entity* killer) {
|
||||
}
|
||||
}
|
||||
|
||||
void PetDigServer::OnUse(Entity* self, Entity* user) {
|
||||
LOG("Treasure used!");
|
||||
|
||||
auto* petComponent = PetComponent::GetActivePet(user->GetObjectID());
|
||||
if (!petComponent) return;
|
||||
|
||||
if(petComponent->GetIsReadyToDig()) {
|
||||
petComponent->SetTreasureTime(2.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void PetDigServer::HandleXBuildDig(const Entity* self, Entity* owner, Entity* pet) {
|
||||
auto playerID = self->GetVar<LWOOBJID>(u"builder");
|
||||
if (playerID == LWOOBJID_EMPTY || playerID != owner->GetObjectID())
|
||||
|
@@ -17,6 +17,13 @@ public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnDie(Entity* self, Entity* killer) override;
|
||||
|
||||
/**
|
||||
* Invoked when a player interacts with treasure.
|
||||
* @param self the entity the script belongs to
|
||||
* @param user the entity that used the treasure
|
||||
*/
|
||||
void OnUse(Entity* self, Entity* user) override;
|
||||
|
||||
static Entity* GetClosestTresure(NiPoint3 position);
|
||||
|
||||
private:
|
||||
|
Reference in New Issue
Block a user