diff --git a/Content/Luprex/lxUtilityFunctionsLibrary.uasset b/Content/Luprex/lxUtilityFunctionsLibrary.uasset index 223942c0..3af30cf0 100644 --- a/Content/Luprex/lxUtilityFunctionsLibrary.uasset +++ b/Content/Luprex/lxUtilityFunctionsLibrary.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8cc0a1943b9c1affeaec49235a9e7bc77fee4f868e2b2364dc218b020eeac97a -size 87318 +oid sha256:8365b2c87a615ab893faebe00d0e44d4774c169472ca5d8ce83a174b85e82b5a +size 119675 diff --git a/Content/Tangibles/TAN_Character.uasset b/Content/Tangibles/TAN_Character.uasset index 6090194a..13e6a21e 100644 --- a/Content/Tangibles/TAN_Character.uasset +++ b/Content/Tangibles/TAN_Character.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1b6fe3387b265017df574b406207526ac131d3ded39c8d4355ebc0ae3d7d20ea -size 315530 +oid sha256:cfc033e1fa7fa768a973220586c861a216892d9f5112843ae9dde60b4490f89d +size 332627 diff --git a/Source/Integration/AnimQueue.cpp b/Source/Integration/AnimQueue.cpp index dd0794d2..36cce283 100644 --- a/Source/Integration/AnimQueue.cpp +++ b/Source/Integration/AnimQueue.cpp @@ -335,9 +335,6 @@ FlxAnimTracker::FlxAnimTracker() { void FlxAnimTracker::Clear() { AQ.Empty(); Changed = true; - AutoFinish = false; - AutoFinishAction.Empty(); - AutoFinishXYZ.Set(0,0,0); } void FlxAnimTracker::FinishedAnimation(uint64 hash) { @@ -349,6 +346,15 @@ void FlxAnimTracker::FinishedAnimation(uint64 hash) { } } +bool FlxAnimTracker::IsFinished(uint64 hash) { + for (int i = 0; i < AQ.Num(); i++) { + if (AQ[i].Hash == hash) { + return AQ[i].Finished; + } + } + return true; +} + void FlxAnimTracker::SkipToEnd() { for (int i = 0; i < AQ.Num(); i++) { if (!AQ[i].Finished) { @@ -459,22 +465,6 @@ void FlxAnimTracker::Update(std::string_view encqueue) { } AQ.SetNum(limit); } - - // Autofinish up to one animation. - // - if (AutoFinish) { - for (int i = 0; i < AQ.Num(); i++) { - if (!AQ[i].Finished) { - if (MatchesAutoFinish(AQ[i])) { - AQ[i].Finished = true; - } - break; - } - } - AutoFinish = false; - AutoFinishAction.Empty(); - AutoFinishXYZ.Set(0,0,0); - } } FString FlxAnimTracker::DebugString() const @@ -488,14 +478,6 @@ FString FlxAnimTracker::DebugString() const { Result += TEXT("changed=false "); } - if (AutoFinish) - { - Result += TEXT("autofinish=true"); - } - else - { - Result += TEXT("autofinish=false"); - } Result += TEXT("\n"); for (int i = 0; i < AQ.Num(); i++) { @@ -505,20 +487,6 @@ FString FlxAnimTracker::DebugString() const return Result; } -void FlxAnimTracker::SetAutoFinish(const FString &action, const FVector &xyz) { - AutoFinish = true; - AutoFinishAction = action; - AutoFinishXYZ = xyz; -} - -bool FlxAnimTracker::MatchesAutoFinish(const FlxAnimationStep &step) { - FVector xyz = UlxAnimationStepLibrary::AnimationStepGetVector(step, TEXT("xyz")); - if (xyz != AutoFinishXYZ) return false; - FString action = UlxAnimationStepLibrary::AnimationStepGetString(step, TEXT("action")); - if (action != AutoFinishAction) return false; - return true; -} - FString FlxAnimTracker::GetCurrentBlueprintName() { for (int i = 0; i < AQ.Num(); i++) { if (!AQ[i].Finished) { diff --git a/Source/Integration/AnimQueue.h b/Source/Integration/AnimQueue.h index 6159a367..2d53dd0a 100644 --- a/Source/Integration/AnimQueue.h +++ b/Source/Integration/AnimQueue.h @@ -256,15 +256,6 @@ public: // True if something has recently changed. // bool Changed; - - // Autofinish parameters. - // - bool AutoFinish; - FString AutoFinishAction; - FVector AutoFinishXYZ; - -private: - bool MatchesAutoFinish(const FlxAnimationStep &step); public: // Construct a tracker. @@ -284,14 +275,6 @@ public: // void Update(std::string_view encqueue); - // Auto-finish animation. - // - // Next time 'update' is called, we will check for the presence - // of a new animation matching these parameters. If there is - // one, it is automatically marked 'finished'. - // - void SetAutoFinish(const FString &action, const FVector &xyz); - // Get the current blueprint name, as a string. // FString GetCurrentBlueprintName(); @@ -312,6 +295,12 @@ public: // void FinishedAnimation(uint64 Hash); + // Return true if an animation step is marked finished. + // + // Also return true if the animation step is not found. + // + bool IsFinished(uint64 Hash); + // Skip to the end of the animation queue. // // This is equivalent to calling 'FinishedHash' on every diff --git a/Source/Integration/BlueprintErrors.cpp b/Source/Integration/BlueprintErrors.cpp index 82e4814d..195af844 100644 --- a/Source/Integration/BlueprintErrors.cpp +++ b/Source/Integration/BlueprintErrors.cpp @@ -6,6 +6,7 @@ #include "Kismet/KismetSystemLibrary.h" #include "Kismet2/KismetDebugUtilities.h" #include "Kismet/KismetTextLibrary.h" +#include "AnimQueue.h" ELogVerbosity::Type UlxBlueprintErrorLibrary::ConvertElxLogVerbosity(ElxLogVerbosity Verbosity) { switch (Verbosity) { @@ -207,6 +208,15 @@ FFormatArgumentData UlxFormatDataLibrary::FormatArgumentDataLuaValues(const UlxL return Result; } +FFormatArgumentData UlxFormatDataLibrary::FormatArgumentDataAnimationStep(const FlxAnimationStep &Value, const FString &Name) +{ + FFormatArgumentData Result; + Result.ArgumentValueType = EFormatArgumentType::Text; + Result.ArgumentName = Name; + Result.ArgumentValue = FText::FromString(UlxAnimationStepLibrary::AnimationStepDebugString(Value)); + return Result; +} + FFormatArgumentData UlxBlueprintErrorLibrary::FormatArgumentDataBlank(const FString &Name) { FFormatArgumentData Result; diff --git a/Source/Integration/BlueprintErrors.h b/Source/Integration/BlueprintErrors.h index 82de9485..5e3925cb 100644 --- a/Source/Integration/BlueprintErrors.h +++ b/Source/Integration/BlueprintErrors.h @@ -17,6 +17,7 @@ #include "BlueprintErrors.generated.h" class UlxLuaValues; +struct FlxAnimationStep; /* * enum class ElxLogVerbosity, below, contains all the same error severity levels @@ -150,6 +151,9 @@ public: UFUNCTION(BlueprintPure, meta = (BlueprintInternalUseOnly = "true"), Category = "Luprex|Utility") static FFormatArgumentData FormatArgumentDataLuaValues(const UlxLuaValues *Value, const FString &Name); + + UFUNCTION(BlueprintPure, meta = (BlueprintInternalUseOnly = "true"), Category = "Luprex|Utility") + static FFormatArgumentData FormatArgumentDataAnimationStep(const FlxAnimationStep &Value, const FString &Name); }; /* Debug Blueprint Errors output device. diff --git a/Source/Integration/LuprexGameModeBase.h b/Source/Integration/LuprexGameModeBase.h index 7dd7f1ca..21a7470e 100644 --- a/Source/Integration/LuprexGameModeBase.h +++ b/Source/Integration/LuprexGameModeBase.h @@ -126,7 +126,8 @@ public: // tangibles that have been changed. void UpdateTangibles(); - // Maybe call 'BecomePossessed' on the player tangible. + // Look for a tangible whose ID is equal to the current actor ID. + // Tell the player controller to possess that tangible. void UpdatePossessedTangible(); // Call 'CalculateLookAt', but only if everything is valid. diff --git a/Source/Integration/Tangible.cpp b/Source/Integration/Tangible.cpp index 7f024b8e..23f1c08e 100644 --- a/Source/Integration/Tangible.cpp +++ b/Source/Integration/Tangible.cpp @@ -42,8 +42,8 @@ void UlxTangible::DeleteCurrentActor() CurrentActor->Rename(nullptr); CurrentActor->Destroy(); - // If this actor previously was posessed by a player controller, - // then it's not posessed anymore, because there is no actor any more. + // If this actor previously was possessed by a player controller, + // then it's not possessed anymore, because there is no actor any more. if (Manager->PossessedTangible == this) { Manager->PossessedTangible = nullptr; }; @@ -242,6 +242,12 @@ void UlxTangible::FinishedAnimation(AActor *target, const FlxAnimationStep &step UE_LOG(LogLuprex, Display, TEXT("Animation Finished: %s"), *DebugString); } +bool UlxTangible::AnimationStepIsFinished(AActor *target, const FlxAnimationStep &step) { + UlxTangible *tan = GetActorTangibleOrLog(target); + if (tan == nullptr) return true; + return tan->AnimTracker.IsFinished(step.Hash); +} + FString UlxTangible::GetTangiblePlane(AActor* target) { UlxTangible *tan = GetActorTangibleOrLog(target); if (tan == nullptr) return TEXT(""); @@ -266,9 +272,3 @@ bool UlxTangible::IsLuprexTangible(AActor* target) { return tan != nullptr; } -void UlxTangible::SetAutoFinish(AActor *target, const FString &action, const FVector &xyz) { - UlxTangible *tan = GetActorTangibleOrLog(target); - if (tan == nullptr) return; - tan->AnimTracker.SetAutoFinish(action, xyz); -} - diff --git a/Source/Integration/Tangible.h b/Source/Integration/Tangible.h index 312fa1d9..a0a4d68c 100644 --- a/Source/Integration/Tangible.h +++ b/Source/Integration/Tangible.h @@ -154,8 +154,8 @@ public: UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "Target"), Category = "Luprex|Animation Queue") static void FinishedAnimation(AActor *Target, const FlxAnimationStep &Step, bool AutoUpdate = true); - UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = "Luprex|Animation Queue") - static void SetAutoFinish(AActor *target, const FString &action, const FVector &xyz); + UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "Target", ExpandBoolAsExecs="ReturnValue"), Category = "Luprex|Animation Queue") + static bool AnimationStepIsFinished(AActor *Target, const FlxAnimationStep &Step); UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = "Luprex|Tangible") static FString GetTangiblePlane(AActor* target); diff --git a/Source/Integration/TangibleManager.h b/Source/Integration/TangibleManager.h index 1d477801..44dd22d9 100644 --- a/Source/Integration/TangibleManager.h +++ b/Source/Integration/TangibleManager.h @@ -29,7 +29,7 @@ public: UPROPERTY() TMap IdToTangible; - // The Tangible ID of the posessed tangible, if any. + // The Tangible ID of the possessed tangible, if any. UlxTangible *PossessedTangible; public: diff --git a/luprex/lua/login.lua b/luprex/lua/login.lua index cab8072d..089bc572 100644 --- a/luprex/lua/login.lua +++ b/luprex/lua/login.lua @@ -25,7 +25,7 @@ end function engio.move(action, xyz, facing) -- todo: sanity check the parameters. dprint("engio.move ", action, " ", xyz[1], " ", xyz[2], " ", xyz[3]) - tangible.animate(actor, nil, {action=action, xyz=xyz, facing=facing}) + tangible.animate(actor, nil, {action=action, interactive=true, xyz=xyz, facing=facing}) end function cube.lookhotkeys(keys)