feat: Add GetComponents(Mut) functions to Entity (#1842)

Allows for a really neat way of getting components using structured binding.  Tested that powerups still function

do it again because its neat
This commit is contained in:
David Markowitz
2025-07-01 05:26:05 -07:00
committed by GitHub
parent 9524198044
commit 5e9fe40bec
3 changed files with 21 additions and 9 deletions

View File

@@ -1662,11 +1662,9 @@ void Entity::PickupItem(const LWOOBJID& objectID) const {
auto* const skillsTable = CDClientManager::GetTable<CDObjectSkillsTable>();
const auto skills = skillsTable->Query([&info](CDObjectSkills entry) {return (entry.objectTemplate == info.lot); });
for (const auto& skill : skills) {
auto* skillComponent = GetComponent<SkillComponent>();
const auto [skillComponent, missionComponent] = GetComponentsMut<SkillComponent, MissionComponent>();
if (skillComponent) skillComponent->CastSkill(skill.skillID, GetObjectID(), GetObjectID(), skill.castOnType, NiQuaternion(0, 0, 0, 0));
auto* missionComponent = GetComponent<MissionComponent>();
if (missionComponent != nullptr) {
missionComponent->Progress(eMissionTaskType::POWERUP, skill.skillID);
}