A Bunch of miscellaneous refactoring

This commit is contained in:
2024-09-24 22:13:56 -04:00
parent 0b7049cf5a
commit a295ff5e53
13 changed files with 33 additions and 36 deletions

View File

@@ -143,13 +143,22 @@ void AIntegrationGameModeBase::UpdateTangibles() {
}
void AIntegrationGameModeBase::UpdatePossessedTangible() {
bool updated = TangibleManager->SetPossessedTangible(PlayerId);
if (updated) {
UlxTangible *ptan = TangibleManager->GetPossessedTangible();
UlxTangible *ptan = TangibleManager->GetPossessedTangible();
UlxTangible *tan = TangibleManager->GetTangible(PlayerId);
APlayerController *ctrl = GetWorld()->GetFirstPlayerController();
APawn *pawn = nullptr;
if (tan != nullptr) pawn = Cast<APawn>(tan->GetActor());
if (pawn == nullptr) {
if (ptan != nullptr) {
IlxTangibleInterface::Execute_BecomePossessed(ptan->GetActor());
TangibleManager->SetPossessedTangible(nullptr);
ctrl->Possess(nullptr);
}
}
} else {
if (ptan != tan) {
TangibleManager->SetPossessedTangible(tan);
ctrl->Possess(pawn);
}
}
}
void AIntegrationGameModeBase::LuaCallEnd(InvocationKind kind, int64 place_id) {