diff --git a/dGame/dComponents/BuildBorderComponent.cpp b/dGame/dComponents/BuildBorderComponent.cpp index ed2fe2d2..1747f0ed 100644 --- a/dGame/dComponents/BuildBorderComponent.cpp +++ b/dGame/dComponents/BuildBorderComponent.cpp @@ -42,6 +42,8 @@ void BuildBorderComponent::OnUse(Entity* originator) { return; } + inventoryComponent->PushEquippedItems(); + Game::logger->Log("BuildBorderComponent", "Starting with %llu\n", buildArea); if (PropertyManagementComponent::Instance() != nullptr) { diff --git a/dGame/dComponents/InventoryComponent.cpp b/dGame/dComponents/InventoryComponent.cpp index 950536ab..8ae6e93f 100644 --- a/dGame/dComponents/InventoryComponent.cpp +++ b/dGame/dComponents/InventoryComponent.cpp @@ -1158,6 +1158,18 @@ void InventoryComponent::PopEquippedItems() item->Equip(); } + m_Pushed.clear(); + + auto destroyableComponent = m_Parent->GetComponent(); + + // Reset stats to full + if (destroyableComponent) { + destroyableComponent->SetHealth(static_cast(destroyableComponent->GetMaxHealth())); + destroyableComponent->SetArmor(static_cast(destroyableComponent->GetMaxArmor())); + destroyableComponent->SetImagination(static_cast(destroyableComponent->GetMaxImagination())); + EntityManager::Instance()->SerializeEntity(m_Parent); + } + m_Dirty = true; } diff --git a/dGame/dComponents/PropertyManagementComponent.cpp b/dGame/dComponents/PropertyManagementComponent.cpp index 04e2f633..f27ea283 100644 --- a/dGame/dComponents/PropertyManagementComponent.cpp +++ b/dGame/dComponents/PropertyManagementComponent.cpp @@ -286,6 +286,10 @@ void PropertyManagementComponent::OnStartBuilding() player->SendToZone(zoneId); } + auto inventoryComponent = ownerEntity->GetComponent(); + + // Push equipped items + if (inventoryComponent) inventoryComponent->PushEquippedItems(); } void PropertyManagementComponent::OnFinishBuilding()