mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-04-27 17:16:31 +00:00
Fix prereq bug (#1118)
This commit is contained in:
parent
0d6bd33f9e
commit
f46bc33dd4
@ -830,14 +830,22 @@ void InventoryComponent::EquipItem(Item* item, const bool skipChecks) {
|
|||||||
|
|
||||||
const auto position = m_Parent->GetPosition();
|
const auto position = m_Parent->GetPosition();
|
||||||
|
|
||||||
for (auto* lauchPad : rocketLauchPads) {
|
for (auto* launchPad : rocketLauchPads) {
|
||||||
if (Vector3::DistanceSquared(lauchPad->GetPosition(), position) > 13 * 13) continue;
|
if (!launchPad) continue;
|
||||||
|
|
||||||
|
auto prereq = launchPad->GetVarAsString(u"rocketLaunchPreCondition");
|
||||||
|
if (!prereq.empty()) {
|
||||||
|
PreconditionExpression expression(prereq);
|
||||||
|
if (!expression.Check(m_Parent)) continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Vector3::DistanceSquared(launchPad->GetPosition(), position) > 13 * 13) continue;
|
||||||
|
|
||||||
auto* characterComponent = m_Parent->GetComponent<CharacterComponent>();
|
auto* characterComponent = m_Parent->GetComponent<CharacterComponent>();
|
||||||
|
|
||||||
if (characterComponent != nullptr) characterComponent->SetLastRocketItemID(item->GetId());
|
if (characterComponent != nullptr) characterComponent->SetLastRocketItemID(item->GetId());
|
||||||
|
|
||||||
lauchPad->OnUse(m_Parent);
|
launchPad->OnUse(m_Parent);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user