mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-07 05:13:44 +00:00
fix(quickbuild): take precondition items when the build starts, give them back on cancel
A quickbuild's HasItem preconditions took their items only when the build completed and never gave them back. Live took them when the build started and gave them back when it was cancelled: the FV Stone Warrior pedestal (LOT 8551, precondition 99: 5 of LOT 6194) took the items at Building 5 times and added them back with the loot source Quickbuild on each of the 3 cancels in the live captures. Preconditions now report their item costs instead of removing items while checking. A quickbuild takes them at the start, gives them back on cancel or a reset during the build, keeps them on completion, and gives them back when the builder leaves the world mid-build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -140,8 +140,12 @@ void PetComponent::OnUse(Entity* originator) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_Preconditions.has_value() && !m_Preconditions->Check(originator, true)) {
|
||||
return;
|
||||
if (m_Preconditions.has_value()) {
|
||||
if (!m_Preconditions->Check(originator)) return;
|
||||
// Taming uses up the items its preconditions ask for
|
||||
for (const auto& cost : m_Preconditions->GetItemCosts(originator)) {
|
||||
inventoryComponent->RemoveItem(cost.lot, cost.count, eInventoryType::ALL);
|
||||
}
|
||||
}
|
||||
|
||||
auto* const movementAIComponent = m_Parent->GetComponent<MovementAIComponent>();
|
||||
|
||||
Reference in New Issue
Block a user