mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-12-22 21:43:35 +00:00
Address items not re-equipping upon exiting build mode (#615)
* Implement Precompiled Headers * fix cmake * Fix modular builds not returning parts Modular builds would not search inventory A for their corresponding item and by default would only look in the models bag. This PR forces the item to be looked for in the inventory its coming from (inventoryA) as a second resort before doing the final search in the default inventory of the item. Tested modular building a car and a rocket and when replacing parts the part that was already placed was returned to the inventory correctly. * Push equipped items upon entering build mode Fixes an issue where leaving build mode anywhere would not re-equip your items. This also implements the feature to set your stats back to full, as was done in the live game. Tested exiting build mode on a property with full venture gear and all gear was re-equipped and stats were set to the expected values.
This commit is contained in:
parent
3cf243b1d7
commit
de5d9182eb
@ -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) {
|
||||
|
@ -1158,6 +1158,18 @@ void InventoryComponent::PopEquippedItems()
|
||||
item->Equip();
|
||||
}
|
||||
|
||||
m_Pushed.clear();
|
||||
|
||||
auto destroyableComponent = m_Parent->GetComponent<DestroyableComponent>();
|
||||
|
||||
// Reset stats to full
|
||||
if (destroyableComponent) {
|
||||
destroyableComponent->SetHealth(static_cast<int32_t>(destroyableComponent->GetMaxHealth()));
|
||||
destroyableComponent->SetArmor(static_cast<int32_t>(destroyableComponent->GetMaxArmor()));
|
||||
destroyableComponent->SetImagination(static_cast<int32_t>(destroyableComponent->GetMaxImagination()));
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
}
|
||||
|
||||
m_Dirty = true;
|
||||
}
|
||||
|
||||
|
@ -286,6 +286,10 @@ void PropertyManagementComponent::OnStartBuilding()
|
||||
|
||||
player->SendToZone(zoneId);
|
||||
}
|
||||
auto inventoryComponent = ownerEntity->GetComponent<InventoryComponent>();
|
||||
|
||||
// Push equipped items
|
||||
if (inventoryComponent) inventoryComponent->PushEquippedItems();
|
||||
}
|
||||
|
||||
void PropertyManagementComponent::OnFinishBuilding()
|
||||
|
Loading…
Reference in New Issue
Block a user