2021-12-05 17:54:36 +00:00
|
|
|
#include "BuildBorderComponent.h"
|
|
|
|
|
|
|
|
#include "EntityManager.h"
|
|
|
|
#include "GameMessages.h"
|
|
|
|
#include "Entity.h"
|
|
|
|
#include "Game.h"
|
2023-10-21 23:31:55 +00:00
|
|
|
#include "Logger.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
#include "InventoryComponent.h"
|
|
|
|
#include "Item.h"
|
|
|
|
#include "PropertyManagementComponent.h"
|
|
|
|
|
|
|
|
BuildBorderComponent::BuildBorderComponent(Entity* parent) : Component(parent) {
|
|
|
|
}
|
|
|
|
|
|
|
|
BuildBorderComponent::~BuildBorderComponent() {
|
|
|
|
}
|
|
|
|
|
|
|
|
void BuildBorderComponent::OnUse(Entity* originator) {
|
|
|
|
if (originator->GetCharacter()) {
|
2023-07-15 20:56:33 +00:00
|
|
|
const auto& entities = Game::entityManager->GetEntitiesInGroup("PropertyPlaque");
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
auto buildArea = m_Parent->GetObjectID();
|
|
|
|
|
|
|
|
if (!entities.empty()) {
|
|
|
|
buildArea = entities[0]->GetObjectID();
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2023-10-21 23:31:55 +00:00
|
|
|
LOG("Using PropertyPlaque");
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
auto* inventoryComponent = originator->GetComponent<InventoryComponent>();
|
|
|
|
|
|
|
|
if (inventoryComponent == nullptr) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto* thinkingHat = inventoryComponent->FindItemByLot(6086);
|
|
|
|
|
|
|
|
if (thinkingHat == nullptr) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-07-06 08:30:13 +00:00
|
|
|
inventoryComponent->PushEquippedItems();
|
|
|
|
|
2023-10-21 23:31:55 +00:00
|
|
|
LOG("Starting with %llu", buildArea);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
if (PropertyManagementComponent::Instance() != nullptr) {
|
|
|
|
GameMessages::SendStartArrangingWithItem(
|
|
|
|
originator,
|
|
|
|
originator->GetSystemAddress(),
|
|
|
|
true,
|
|
|
|
buildArea,
|
|
|
|
originator->GetPosition(),
|
|
|
|
0,
|
|
|
|
thinkingHat->GetId(),
|
|
|
|
thinkingHat->GetLot(),
|
|
|
|
4,
|
|
|
|
0,
|
|
|
|
-1,
|
2024-01-29 07:53:12 +00:00
|
|
|
NiPoint3Constant::ZERO,
|
2021-12-05 17:54:36 +00:00
|
|
|
0
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
GameMessages::SendStartArrangingWithItem(originator, originator->GetSystemAddress(), true, buildArea, originator->GetPosition());
|
|
|
|
}
|
|
|
|
|
|
|
|
InventoryComponent* inv = m_Parent->GetComponent<InventoryComponent>();
|
|
|
|
if (!inv) return;
|
|
|
|
inv->PushEquippedItems(); // technically this is supposed to happen automatically... but it doesnt? so just keep this here
|
|
|
|
}
|
|
|
|
}
|