diff --git a/Content/Subsystems/FicsitRemoteMonitoring_BP.uasset b/Content/Subsystems/FicsitRemoteMonitoring_BP.uasset index deb4d98b..bb3191c9 100644 Binary files a/Content/Subsystems/FicsitRemoteMonitoring_BP.uasset and b/Content/Subsystems/FicsitRemoteMonitoring_BP.uasset differ diff --git a/FicsitRemoteMonitoring.uplugin b/FicsitRemoteMonitoring.uplugin index fbd2cbba..d269b0cb 100644 --- a/FicsitRemoteMonitoring.uplugin +++ b/FicsitRemoteMonitoring.uplugin @@ -1,8 +1,8 @@ { "FileVersion": 3, "Version": 1, - "VersionName": "1.5.1", - "SemVersion": "1.5.1", + "VersionName": "1.5.2", + "SemVersion": "1.5.2", "AcceptsAnyRemoteVersion": true, "FriendlyName": "Ficsit Remote Monitoring", "Description": "Statistical and GeoLocation Monitoring for Satisfactory", diff --git a/Source/FicsitRemoteMonitoring/Private/Endpoints/World/PlayerLibrary.cpp b/Source/FicsitRemoteMonitoring/Private/Endpoints/World/PlayerLibrary.cpp index f869749b..863c5ee8 100644 --- a/Source/FicsitRemoteMonitoring/Private/Endpoints/World/PlayerLibrary.cpp +++ b/Source/FicsitRemoteMonitoring/Private/Endpoints/World/PlayerLibrary.cpp @@ -2,6 +2,7 @@ #include "FGCharacterPlayer.h" #include "FGCreatureSubsystem.h" +#include "FGSporeFlower.h" #include "FicsitRemoteMonitoring.h" #include "RemoteMonitoringLibrary.h" #include "Kismet/GameplayStatics.h" @@ -91,4 +92,38 @@ void UPlayerLibrary::getCreatures(UObject* WorldContext, FRequestData RequestDat OutJsonArray.Add(MakeShared(JCreature)); }; +}; + +void UPlayerLibrary::getHazards(UObject* WorldContext, FRequestData RequestData, TArray>& OutJsonArray) { + + UClass* SporeFlowerClass = AFGSporeFlower::StaticClass(); + TArray FoundActors; + + UGameplayStatics::GetAllActorsOfClass(WorldContext->GetWorld(), SporeFlowerClass, FoundActors); + for (AActor* SporeFlowerActor : FoundActors) { + + AFGSporeFlower* SporeFlower = Cast(SporeFlowerActor); + + TSharedPtr JSporeFlower = CreateBaseJsonObject(SporeFlower); + + AFicsitRemoteMonitoring* ModSubsystem = AFicsitRemoteMonitoring::Get(WorldContext->GetWorld()); + fgcheck(ModSubsystem); + + FString State; + FString GasState; + bool bIsSignificant; + bool bIsDead; + + ModSubsystem->SporeFlower_BIE(SporeFlower, State, GasState, bIsSignificant, bIsDead); + + JSporeFlower->Values.Add("ClassName", MakeShared(UKismetSystemLibrary::GetClassDisplayName(SporeFlower->GetClass()))); + JSporeFlower->Values.Add("location", MakeShared(getActorJSON(SporeFlower))); + JSporeFlower->Values.Add("State", MakeShared(State)); + JSporeFlower->Values.Add("GasState", MakeShared(GasState)); + JSporeFlower->Values.Add("Significant", MakeShared(bIsSignificant)); + JSporeFlower->Values.Add("Dead", MakeShared(bIsDead)); + JSporeFlower->Values.Add("features", MakeShared(getActorFeaturesJSON(SporeFlower, TEXT("Spore Flower"), TEXT("Spore Flower")))); + + OutJsonArray.Add(MakeShared(JSporeFlower)); + }; }; \ No newline at end of file diff --git a/Source/FicsitRemoteMonitoring/Private/FicsitRemoteMonitoring.cpp b/Source/FicsitRemoteMonitoring/Private/FicsitRemoteMonitoring.cpp index efea8519..6b0350a3 100644 --- a/Source/FicsitRemoteMonitoring/Private/FicsitRemoteMonitoring.cpp +++ b/Source/FicsitRemoteMonitoring/Private/FicsitRemoteMonitoring.cpp @@ -736,6 +736,7 @@ void AFicsitRemoteMonitoring::HandleApiRequest(UObject* World, uWS::HttpResponse void AFicsitRemoteMonitoring::InitAPIRegistry() { //Registering Endpoints: API Name, bRequireGameThread, FunctionPtr + RegisterEndpoint(FAPIEndpoint("GET", "getArtifacts", &UResearch::getArtifacts).RequiresGameThread()); RegisterEndpoint(FAPIEndpoint("GET", "getAssembler", &UFactoryLibrary::getAssembler)); RegisterEndpoint(FAPIEndpoint("GET", "getBelts", &ULogistics::getBelts)); RegisterEndpoint(FAPIEndpoint("GET", "getLifts", &ULogistics::getLifts)); @@ -761,6 +762,7 @@ void AFicsitRemoteMonitoring::InitAPIRegistry() RegisterEndpoint(FAPIEndpoint("GET", "getFrackingActivator", &UResources::getFrackingActivator)); RegisterEndpoint(FAPIEndpoint("GET", "getFuelGenerator", &UPower::getFuelGenerator)); RegisterEndpoint(FAPIEndpoint("GET", "getGeothermalGenerator", &UPower::getGeothermalGenerator)); + RegisterEndpoint(FAPIEndpoint("GET", "getHazards", &UPlayerLibrary::getHazards).RequiresGameThread()); RegisterEndpoint(FAPIEndpoint("GET", "getHUBTerminal", &USupport::getHubTerminal).RequiresGameThread()); RegisterEndpoint(FAPIEndpoint("GET", "getHyperEntrance", &UHypertubes::getHyperEntrance)); RegisterEndpoint(FAPIEndpoint("GET", "getHypertube", &UHypertubes::getHypertube)); @@ -776,8 +778,7 @@ void AFicsitRemoteMonitoring::InitAPIRegistry() RegisterEndpoint(FAPIEndpoint("GET", "getPlayer", &UPlayerLibrary::getPlayer).RequiresGameThread()); RegisterEndpoint(FAPIEndpoint("GET", "getPortal", &USupport::getPortal)); RegisterEndpoint(FAPIEndpoint("GET", "getPower", &UPower::getPower)); - RegisterEndpoint(FAPIEndpoint("GET", "getPowerSlug", &UResources::getPowerSlug).RequiresGameThread()); - RegisterEndpoint(FAPIEndpoint("GET", "getArtifacts", &UResearch::getArtifacts).RequiresGameThread()); + RegisterEndpoint(FAPIEndpoint("GET", "getPowerSlug", &UResources::getPowerSlug).RequiresGameThread()); RegisterEndpoint(FAPIEndpoint("GET", "getPowerUsage", &UPower::getPowerUsage)); RegisterEndpoint(FAPIEndpoint("GET", "getProdStats", &USession::getProdStats)); RegisterEndpoint(FAPIEndpoint("GET", "getPump", &ULogistics::getPump)); diff --git a/Source/FicsitRemoteMonitoring/Public/Endpoints/World/PlayerLibrary.h b/Source/FicsitRemoteMonitoring/Public/Endpoints/World/PlayerLibrary.h index ae9488e5..7047bc73 100644 --- a/Source/FicsitRemoteMonitoring/Public/Endpoints/World/PlayerLibrary.h +++ b/Source/FicsitRemoteMonitoring/Public/Endpoints/World/PlayerLibrary.h @@ -13,4 +13,5 @@ class FICSITREMOTEMONITORING_API UPlayerLibrary : public URemoteMonitoringLibrar static void getPlayer(UObject* WorldContext, FRequestData RequestData, TArray>& OutJsonArray); static void getDoggo(UObject* WorldContext, FRequestData RequestData, TArray>& OutJsonArray); static void getCreatures(UObject* WorldContext, FRequestData RequestData, TArray>& OutJsonArray); + static void getHazards(UObject* WorldContext, FRequestData RequestData, TArray>& OutJsonArray); }; diff --git a/Source/FicsitRemoteMonitoring/Public/FicsitRemoteMonitoring.h b/Source/FicsitRemoteMonitoring/Public/FicsitRemoteMonitoring.h index 12fc5828..dc86ff60 100644 --- a/Source/FicsitRemoteMonitoring/Public/FicsitRemoteMonitoring.h +++ b/Source/FicsitRemoteMonitoring/Public/FicsitRemoteMonitoring.h @@ -162,6 +162,9 @@ class FICSITREMOTEMONITORING_API AFicsitRemoteMonitoring : public AModSubsystem UFUNCTION(BlueprintImplementableEvent, Category = "Ficsit Remote Monitoring") void ResearchTreeNodeUnlockData_BIE(UFGResearchTreeNode* ResearchTreeNode, TArray& Parents, TArray& UnhiddenBy, FIntPoint& Coordinates); + UFUNCTION(BlueprintImplementableEvent, Category = "Ficsit Remote Monitoring") + void SporeFlower_BIE(AFGSporeFlower* SporeFlower, FString& State, FString& GasState, bool& bIsSignificant, bool& bIsDead); + // Array of API endpoints TArray APIEndpoints{}; diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc index 45e32328..31ef4f8b 100644 --- a/docs/modules/ROOT/nav.adoc +++ b/docs/modules/ROOT/nav.adoc @@ -111,6 +111,7 @@ **** xref:json/Read/getCreatures.adoc[getCreatures] **** xref:json/Read/getDoggo.adoc[getDoggo] **** xref:json/Read/getDropPod.adoc[getDropPod] +**** xref:json/Read/getHazards.adoc[getHazards] **** xref:json/Read/getMapMarkers.adoc[getMapMarkers] **** xref:json/Read/getPowerSlug.adoc[getPowerSlug] **** xref:json/Read/getProdStats.adoc[getProdStats] diff --git a/docs/modules/ROOT/pages/json/Read/getHazards.adoc b/docs/modules/ROOT/pages/json/Read/getHazards.adoc new file mode 100644 index 00000000..498b7940 --- /dev/null +++ b/docs/modules/ROOT/pages/json/Read/getHazards.adoc @@ -0,0 +1,65 @@ +:url-repo: https://www.github.com/porisius/FicsitRemoteMonitoring +:depth: + += Get Hazards + +Gets a list of all hazards. + +== URL + +`GET http://localhost:8080/getHazards` + +include::../_responseBody.adoc[] + +| ID | String | Unique ID of the Spore Flower. +| Name | String | Name of the Hazard. +| ClassName | String | ClassName of the Hazard. + +{set:key-name:location} +{set:key-description:Location details of the Hazard.} +include::../Models/_location.adoc[] + +| State | String | Current state of the hazard. Possible values are "Idle", "Expanding", "Retracting" and "Active". +| Gas State | String | Current state of the hazard. Possible values are "No Gas", "Gas", and "Cooldown". +| Significant | Boolean | Is the actor within range to perform animations, ticks, and other processing +| Dead | Boolean | Does the actor persist despite being blown up? + +// features +include::../Models/_features.adoc[] + +|=== + +== Example Response +[source,json] +----------------- +[ + { + "ID": "BP_SporeFlower25_13738", + "ClassName": "BP_SporeFlower_C", + "location": { + "x": -17811, + "y": 269409, + "z": -6977.728515625, + "rotation": 90 + }, + "State": "Idle", + "GasState": "NoGas", + "Significant": false, + "Dead": false, + "features": { + "properties": { + "name": "BP_SporeFlower_C", + "type": "Spore Flower" + }, + "geometry": { + "coordinates": { + "x": -17811, + "y": 269409, + "z": -6977.728515625 + }, + "type": "Point" + } + } + } +] +----------------- \ No newline at end of file