DarkflameServer/dScripts/02_server/Map/VE/VeBricksampleServer.cpp
Aaron Kimbrell 6aa90ad5b2
Breakout rest of the enums from dCommonVars and clean it up (#1061)
* Breakout rest of the enums from dcommonvars
so we don't have to deal with merge conflicts
ePlayerFlags is not a scoped enum, yet, due to it's complexity

* address feedback

* make player flag types consistent

* fix typo
2023-05-02 17:39:21 -05:00

23 lines
885 B
C++

#include "VeBricksampleServer.h"
#include "InventoryComponent.h"
#include "EntityManager.h"
#include "MissionComponent.h"
#include "GameMessages.h"
#include "eMissionState.h"
void VeBricksampleServer::OnUse(Entity* self, Entity* user) {
auto* missionComponent = user->GetComponent<MissionComponent>();
if (missionComponent != nullptr && missionComponent->GetMissionState(1183) == eMissionState::ACTIVE) {
const auto loot = self->GetVar<int32_t>(m_LootVariable);
auto* inventoryComponent = user->GetComponent<InventoryComponent>();
if (loot && inventoryComponent != nullptr && inventoryComponent->GetLotCount(loot) == 0) {
inventoryComponent->AddItem(loot, 1, eLootSourceType::ACTIVITY);
for (auto* brickEntity : EntityManager::Instance()->GetEntitiesInGroup("Bricks")) {
GameMessages::SendNotifyClientObject(brickEntity->GetObjectID(), u"Pickedup");
}
}
}
}