mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-12-20 03:30:18 +00:00
Public release of the DLU server code!
Have fun!
This commit is contained in:
31
dScripts/FvRaceSmashEggImagineServer.cpp
Normal file
31
dScripts/FvRaceSmashEggImagineServer.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#include "FvRaceSmashEggImagineServer.h"
|
||||
#include "DestroyableComponent.h"
|
||||
#include "CharacterComponent.h"
|
||||
#include "EntityManager.h"
|
||||
#include "PossessableComponent.h"
|
||||
|
||||
void FvRaceSmashEggImagineServer::OnDie(Entity *self, Entity *killer) {
|
||||
if (killer != nullptr) {
|
||||
auto* destroyableComponent = killer->GetComponent<DestroyableComponent>();
|
||||
if (destroyableComponent != nullptr) {
|
||||
destroyableComponent->SetImagination(destroyableComponent->GetImagination() + 10);
|
||||
EntityManager::Instance()->SerializeEntity(killer);
|
||||
}
|
||||
|
||||
// Crate is killed by the car
|
||||
auto* possessableComponent = killer->GetComponent<PossessableComponent>();
|
||||
if (possessableComponent != nullptr) {
|
||||
|
||||
auto* possessor = EntityManager::Instance()->GetEntity(possessableComponent->GetPossessor());
|
||||
if (possessor != nullptr) {
|
||||
|
||||
auto* characterComponent = possessor->GetComponent<CharacterComponent>();
|
||||
if (characterComponent != nullptr) {
|
||||
characterComponent->UpdatePlayerStatistic(ImaginationPowerUpsCollected);
|
||||
characterComponent->UpdatePlayerStatistic(RacingSmashablesSmashed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user