A Bunch of miscellaneous refactoring
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
[/Script/EngineSettings.GameMapsSettings]
|
||||
GameDefaultMap=/Game/LpxLevel.LpxLevel
|
||||
GlobalDefaultGameMode=/Game/IntegrationGameModeBaseBP.IntegrationGameModeBaseBP_C
|
||||
GlobalDefaultGameMode=/Game/Luprex/lxGameMode.lxGameMode_C
|
||||
GameInstanceClass=/Script/IntegrationV7.GameInstanceV7
|
||||
GlobalDefaultServerGameMode=/Game/IntegrationGameModeBaseBP.IntegrationGameModeBaseBP_C
|
||||
EditorStartupMap=/Game/LpxLevel.LpxLevel
|
||||
|
||||
BIN
Content/Luprex/lxDefaultPawn.uasset
LFS
Normal file
BIN
Content/Luprex/lxDefaultPawn.uasset
LFS
Normal file
Binary file not shown.
BIN
Content/Luprex/lxGameMode.uasset
LFS
BIN
Content/Luprex/lxGameMode.uasset
LFS
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Content/Tangibles/tangiblecharacter.uasset
LFS
Normal file
BIN
Content/Tangibles/tangiblecharacter.uasset
LFS
Normal file
Binary file not shown.
Binary file not shown.
@@ -143,11 +143,20 @@ void AIntegrationGameModeBase::UpdateTangibles() {
|
||||
}
|
||||
|
||||
void AIntegrationGameModeBase::UpdatePossessedTangible() {
|
||||
bool updated = TangibleManager->SetPossessedTangible(PlayerId);
|
||||
if (updated) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,11 +32,10 @@ class INTEGRATION_API IlxTangibleInterface
|
||||
|
||||
// Add interface functions to this class. This is the class that will be inherited to implement this interface.
|
||||
public:
|
||||
// Whenever the animation queue of a tangible changes in any way, this function
|
||||
// gets called automatically.
|
||||
UFUNCTION(BlueprintImplementableEvent, Category = "Luprex|Animation Queue")
|
||||
bool AnimationQueueChanged();
|
||||
|
||||
UFUNCTION(BlueprintImplementableEvent, Category = "Luprex|Tangible")
|
||||
void BecomePossessed();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -77,16 +77,6 @@ TanArray UlxTangibleManager::GetAllTangibles() const {
|
||||
return result;
|
||||
}
|
||||
|
||||
bool UlxTangibleManager::SetPossessedTangible(int64 id) {
|
||||
UlxTangible *t = GetTangible(id);
|
||||
if ((t == nullptr) || (t->GetActor() == nullptr)) {
|
||||
t = nullptr;
|
||||
}
|
||||
bool changed = (t != PossessedTangible);
|
||||
PossessedTangible = t;
|
||||
return changed;
|
||||
}
|
||||
|
||||
#pragma optimize("", off)
|
||||
void UlxTangibleManager::UpdateNearAccordingToLuprex(IdView near) {
|
||||
// Clear all the 'NearAccordingToLuprex' flags.
|
||||
|
||||
@@ -74,11 +74,7 @@ public:
|
||||
|
||||
// Set the currently-possessed tangible.
|
||||
//
|
||||
// You can also pass 0 for "no possessed tangible."
|
||||
//
|
||||
// Returns true if something changed.
|
||||
//
|
||||
bool SetPossessedTangible(int64 playerid);
|
||||
void SetPossessedTangible(UlxTangible *tan) { PossessedTangible = tan; }
|
||||
|
||||
// Update the 'NearAccordingToLuprex' flags.
|
||||
//
|
||||
|
||||
@@ -12,7 +12,7 @@ void UlxUtilityLibrary::Assert(bool condition, const FString &message) {
|
||||
}
|
||||
}
|
||||
|
||||
void UlxUtilityLibrary::CallFunctionByName(UObject *object, const FString &namepart1, const FString &namepart2, const FString &fallback) {
|
||||
void UlxUtilityLibrary::CallFunctionByName(UObject *object, const FString &namepart1, const FString &namepart2, const FString &fallback, bool bFailIfNotFound) {
|
||||
FString fullname = namepart1 + namepart2;
|
||||
if (!IsValid(object)) {
|
||||
const FBlueprintExceptionInfo ExceptionInfo(
|
||||
@@ -26,6 +26,9 @@ void UlxUtilityLibrary::CallFunctionByName(UObject *object, const FString &namep
|
||||
if (function == nullptr) {
|
||||
function = object->FindFunction(FName(*fallback));
|
||||
if (function == nullptr) {
|
||||
if (!bFailIfNotFound) {
|
||||
return;
|
||||
}
|
||||
const FBlueprintExceptionInfo ExceptionInfo(
|
||||
EBlueprintExceptionType::FatalError,
|
||||
LOCTEXT("CallFunctionByName_NoSuchFunction", "In CallFunctionByName, cannot find the named function or the fallback function.")
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
// the fallback function instead. If that isn't found either, returns false.
|
||||
//
|
||||
UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = "Luprex|Utility")
|
||||
static void CallFunctionByName(UObject *target, const FString &NamePart1, const FString &NamePart2, const FString &fallback);
|
||||
static void CallFunctionByName(UObject *target, const FString &NamePart1, const FString &NamePart2, const FString &fallback, bool bFailIfNotFound = true);
|
||||
|
||||
// Get the axis-aligned bounding box of an actor.
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user