implement rest of equipment scripts (#1714)

This commit is contained in:
David Markowitz
2025-01-03 14:44:20 -08:00
committed by GitHub
parent c8fcb3788d
commit fb32534ae3
15 changed files with 188 additions and 30 deletions

View File

@@ -0,0 +1,27 @@
#include "TrialFactionArmorServer.h"
#include "Character.h"
#include "ePlayerFlag.h"
#include "DestroyableComponent.h"
void TrialFactionArmorServer::OnFactionTriggerItemEquipped(Entity* itemOwner, LWOOBJID itemObjId) {
auto* character = itemOwner->GetCharacter();
if (!character) return;
auto flag = character->GetPlayerFlag(ePlayerFlag::EQUPPED_TRIAL_FACTION_GEAR);
if (!flag) {
character->SetPlayerFlag(ePlayerFlag::EQUPPED_TRIAL_FACTION_GEAR, true);
// technically a TimerWithCancel but our current implementation doesnt support this.
itemOwner->AddCallbackTimer(1.0f, [itemOwner]() {
auto* destroyableComponent = itemOwner->GetComponent<DestroyableComponent>();
if (!destroyableComponent) return;
destroyableComponent->SetHealth(destroyableComponent->GetMaxHealth());
destroyableComponent->SetArmor(destroyableComponent->GetMaxArmor());
destroyableComponent->SetImagination(destroyableComponent->GetMaxImagination());
Game::entityManager->SerializeEntity(itemOwner);
});
}
}