fix: a worn jetpack works again after a world change

Jetpack mode is not saved, and the equip skill that turns it on was cast
only when the item was put on, so a player still wearing a jetpack lost
it in the next world. Live sent SetJetPackMode (use, bypass checks, effect
167, the values of the jetpack's equip skill) shortly after the player's
own construction in 12 of 28 world loads of a player with a jetpack, and
constructed the player in jetpack mode in the other 16.

The jetpack behaviors among the equip skills of the equipped items are
run again when the player has loaded. Nothing new is saved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-11-10 14:50:33 -06:00
parent 5ac39dca8b
commit 95e0746441
4 changed files with 70 additions and 0 deletions

View File

@@ -32,6 +32,7 @@
#include "ZoneMessages.h"
#include "MovementMessages.h"
#include "SkillComponent.h"
#include "Behavior.h"
#include "Character.h"
#include "EntityManager.h"
#include "ItemSet.h"
@@ -1694,6 +1695,20 @@ std::vector<uint32_t> InventoryComponent::FindBuffs(Item* item, bool castOnEquip
return buffs;
}
std::vector<uint32_t> InventoryComponent::FindEquippedJetPacks() const {
std::vector<uint32_t> jetPacks;
for (const auto& equipped : m_Equipped | std::views::values) {
for (const auto behaviorID : FindBuffs(FindItemById(equipped.id), false)) {
if (Behavior::GetBehaviorTemplate(behaviorID) == BehaviorTemplate::JETPACK) jetPacks.push_back(behaviorID);
}
}
return jetPacks;
}
void InventoryComponent::RecastEquippedJetPacks() const {
for (const auto behaviorID : FindEquippedJetPacks()) SkillComponent::HandleUnmanaged(behaviorID, m_Parent->GetObjectID());
}
void InventoryComponent::SetNPCItems(const std::vector<LOT>& items) {
m_Equipped.clear();