Files
Project-Reboot-3.0/Project Reboot 3.0/PlayerState.cpp
Milxnor 3405177d20 i broke the whole project but its fine
complete pickup rewrite, idle pawns
2023-05-07 17:34:24 -04:00

51 lines
1.4 KiB
C++

#include "PlayerState.h"
#include "reboot.h"
FString APlayerState::GetPlayerName()
{
static auto GetPlayerNameFn = FindObject<UFunction>("/Script/Engine.PlayerState.GetPlayerName");
if (GetPlayerNameFn)
{
FString PlayerName;
this->ProcessEvent(GetPlayerNameFn, &PlayerName);
return PlayerName;
}
static auto PlayerNameOffset = GetOffset("PlayerName");
return Get<FString>(PlayerNameOffset);
}
int& APlayerState::GetPlayerID()
{
static auto PlayerIDOffset = FindOffsetStruct("/Script/Engine.PlayerState", "PlayerID", false);
if (PlayerIDOffset == -1)
{
static auto PlayerIdOffset = FindOffsetStruct("/Script/Engine.PlayerState", "PlayerId", false);
return Get<int>(PlayerIdOffset);
}
return Get<int>(PlayerIDOffset);
}
bool APlayerState::IsBot()
{
static auto bIsABotOffset = GetOffset("bIsABot");
static auto bIsABotFieldMask = GetFieldMask(GetProperty("bIsABot"));
return ReadBitfieldValue(bIsABotOffset, bIsABotFieldMask);
}
void APlayerState::SetIsBot(bool NewValue)
{
static auto bIsABotOffset = GetOffset("bIsABot");
static auto bIsABotFieldMask = GetFieldMask(GetProperty("bIsABot"));
return SetBitfieldValue(bIsABotOffset, bIsABotFieldMask, NewValue);
}
void APlayerState::OnRep_PlayerName()
{
static auto OnRep_PlayerNameFn = FindObject<UFunction>("/Script/Engine.PlayerState.OnRep_PlayerName");
this->ProcessEvent(OnRep_PlayerNameFn);
}