Changes related to 'SetPossessedTangible'

This commit is contained in:
2024-03-25 14:50:06 -04:00
parent 0d94b1b9af
commit d520189a94
6 changed files with 49 additions and 3 deletions

View File

@@ -35,6 +35,7 @@ UClass *UlxTangibleManager::GetTangibleClass(const FString &name) {
UlxTangibleManager::UlxTangibleManager() {
World = nullptr;
PossessedTangible = nullptr;
}
void UlxTangibleManager::Init(UWorld* world, AIntegrationGameModeBase *gamemode) {
@@ -53,6 +54,7 @@ UlxTangible* UlxTangibleManager::GetTangible(int64 id) const {
#pragma optimize("", off)
UlxTangible* UlxTangibleManager::MakeTangible(int64 id) {
check(id > 0);
UlxTangible*& t = IdToTangible.FindOrAdd(id);
if (t == nullptr) {
t = NewObject<UlxTangible>();
@@ -75,6 +77,19 @@ TanArray UlxTangibleManager::GetAllTangibles() const {
return result;
}
UlxTangible *UlxTangibleManager::SetPossessedTangible(int64 id) {
UlxTangible *t = GetTangible(id);
if ((t == nullptr) || (t->GetActor() == nullptr)) {
PossessedTangible = nullptr;
return nullptr;
} else if (t == PossessedTangible) {
return nullptr;
} else {
PossessedTangible = t;
return t;
}
}
#pragma optimize("", off)
void UlxTangibleManager::UpdateNearAccordingToLuprex(IdView near) {
// Clear all the 'NearAccordingToLuprex' flags.