mirror of
https://github.com/Jous99/F4MP.git
synced 2026-01-13 00:40:53 +01:00
32 lines
853 B
C++
32 lines
853 B
C++
#include "InvisibilityEffect.h"
|
|
|
|
#include <Games/ActorExtension.h>
|
|
#include <Forms/ActorValueInfo.h>
|
|
|
|
TP_THIS_FUNCTION(TFinish, void, InvisibilityEffect);
|
|
static TFinish* RealFinish = nullptr;
|
|
|
|
// This needs to be done because the actor value does not update in time
|
|
void TP_MAKE_THISCALL(HookFinish, InvisibilityEffect)
|
|
{
|
|
if (apThis && apThis->pTarget)
|
|
{
|
|
if (Actor* pActor = apThis->pTarget->GetTargetAsActor())
|
|
{
|
|
if (pActor->GetExtension()->IsRemote())
|
|
pActor->SetActorValue(ActorValueInfo::kInvisibility, 0.f);
|
|
}
|
|
}
|
|
|
|
TiltedPhoques::ThisCall(RealFinish, apThis);
|
|
}
|
|
|
|
static TiltedPhoques::Initializer s_invisibilityEffectsHooks(
|
|
[]()
|
|
{
|
|
POINTER_SKYRIMSE(TFinish, s_finish, 34370);
|
|
|
|
RealFinish = s_finish.Get();
|
|
|
|
TP_HOOK(&RealFinish, HookFinish);
|
|
});
|