Replace invoke_engio with invoke_lua_call

This commit is contained in:
2024-08-29 17:46:12 -04:00
parent d520189a94
commit a61a74a7b0
4 changed files with 60 additions and 6 deletions

View File

@@ -6,6 +6,7 @@
#include "IntegrationGameModeBase.h"
#define DEFAULT_BLUEPRINT (TEXT("TangibleStaticMesh"))
#define LOCTEXT_NAMESPACE "Tangible"
UlxTangible::UlxTangible()
{
@@ -113,7 +114,7 @@ void UlxTangible::MaybeExecuteAnimStateChanged() {
FString blueprint = AnimTracker.GetCurrentBlueprintName();
if (blueprint.IsEmpty()) blueprint = DEFAULT_BLUEPRINT;
SetActorBlueprint(blueprint);
IlxTangibleInterface::Execute_AnimationStateChanged(GetActor());
IlxTangibleInterface::Execute_AnimationQueueChanged(GetActor());
}
}
@@ -173,4 +174,44 @@ bool UlxTangible::IsCurrentPlayer(AActor* target) {
void UlxTangible::SetAutoFinish(AActor *target, const FString &action, const FVector &xyz) {
UlxTangible *tan = GetActorTangible(target);
tan->AnimTracker.SetAutoFinish(action, xyz);
}
}
void UlxTangible::Assert(bool condition, const FString &message) {
if (!condition) {
FBlueprintExceptionInfo ExceptionInfo(EBlueprintExceptionType::FatalError, FText::FromString(message));
FBlueprintCoreDelegates::ThrowScriptException(FFrame::GetThreadLocalTopStackFrame()->Object, *FFrame::GetThreadLocalTopStackFrame(), ExceptionInfo);
}
}
void UlxTangible::CallFunctionByName(UObject *object, const FString &namepart1, const FString &namepart2, const FString &fallback) {
FString fullname = namepart1 + namepart2;
if (!IsValid(object)) {
const FBlueprintExceptionInfo ExceptionInfo(
EBlueprintExceptionType::FatalError,
LOCTEXT("CallFunctionByName_ObjectIsNotValid", "In CallFunctionByName, object passed in is not valid.")
);
FBlueprintCoreDelegates::ThrowScriptException(FFrame::GetThreadLocalTopStackFrame()->Object, *FFrame::GetThreadLocalTopStackFrame(), ExceptionInfo);
return;
}
UFunction* function = object->FindFunction(FName(*fullname));
if (function == nullptr) {
function = object->FindFunction(FName(*fallback));
if (function == nullptr) {
const FBlueprintExceptionInfo ExceptionInfo(
EBlueprintExceptionType::FatalError,
LOCTEXT("CallFunctionByName_NoSuchFunction", "In CallFunctionByName, cannot find the named function or the fallback function.")
);
FBlueprintCoreDelegates::ThrowScriptException(FFrame::GetThreadLocalTopStackFrame()->Object, *FFrame::GetThreadLocalTopStackFrame(), ExceptionInfo);
return;
}
}
if (function->ParmsSize != 0) {
const FBlueprintExceptionInfo ExceptionInfo(
EBlueprintExceptionType::FatalError,
LOCTEXT("CallFunctionByName_FunctionHasParameters", "CallFunctionByName can only call functions that have no parameters and no return values.")
);
FBlueprintCoreDelegates::ThrowScriptException(FFrame::GetThreadLocalTopStackFrame()->Object, *FFrame::GetThreadLocalTopStackFrame(), ExceptionInfo);
return;
}
object->ProcessEvent(function, nullptr);
}