Last active
January 18, 2026 21:50
-
-
Save QuingKhaos/a83e7aa06cba246d9d1e624e8d9c7aa4 to your computer and use it in GitHub Desktop.
Satisfactory Seawater Extractor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "SeawaterExtractor/PMBuildableSeawaterExtractor.h" | |
| #include "SeawaterExtractor/PMSeawaterVolume.h" | |
| APMBuildableSeawaterExtractor::APMBuildableSeawaterExtractor() | |
| : AFGBuildableWaterPump() | |
| { | |
| } | |
| //~ Begin UObject Interface | |
| void APMBuildableSeawaterExtractor::OnConstruction(const FTransform& transform) | |
| { | |
| AFGBuildableWaterPump::OnConstruction(transform); | |
| AActor* ExtractableResourceActor = GetExtractableResourceActor(); | |
| if (AFGWaterVolume* WaterVolume = Cast<AFGWaterVolume>(ExtractableResourceActor)) { | |
| FActorSpawnParameters SeawaterVolumeSpawnParameters; | |
| SeawaterVolumeSpawnParameters.Owner = this; | |
| SeawaterVolumeSpawnParameters.bAllowDuringConstructionScript = true; | |
| SeawaterVolumeSpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn; | |
| APMSeawaterVolume* SeawaterVolume = (APMSeawaterVolume*)GetWorld()->SpawnActor(APMSeawaterVolume::StaticClass(), NULL, NULL, SeawaterVolumeSpawnParameters); | |
| SeawaterVolume->SetDecoratedWaterVolume(WaterVolume); | |
| SeawaterVolume->SetSeawaterResourceClass(mSeawaterResourceClass); | |
| SetExtractableResource(SeawaterVolume); | |
| } | |
| } | |
| //~ End UObject Interface |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #pragma once | |
| #include "CoreMinimal.h" | |
| #include "Buildables/FGBuildableWaterPump.h" | |
| #include "Resources/FGResourceDescriptor.h" | |
| #include "PMBuildableSeawaterExtractor.generated.h" | |
| /** | |
| * | |
| */ | |
| UCLASS(Abstract) | |
| class PERIODICMADNESS_API APMBuildableSeawaterExtractor : public AFGBuildableWaterPump | |
| { | |
| GENERATED_BODY() | |
| public: | |
| APMBuildableSeawaterExtractor(); | |
| //~ Begin UObject Interface | |
| virtual void OnConstruction(const FTransform& transform) override; | |
| //~ End UObject Interface | |
| private: | |
| /** Reference to the Seawater Descriptor to set on the Seawater Volume */ | |
| UPROPERTY(EditDefaultsOnly, Category = "Extraction") | |
| TSubclassOf<class UFGResourceDescriptor> mSeawaterResourceClass; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "SeawaterExtractor/PMSeawaterVolume.h" | |
| APMSeawaterVolume::APMSeawaterVolume() | |
| : AActor() | |
| { | |
| } | |
| void APMSeawaterVolume::SetDecoratedWaterVolume(AFGWaterVolume* decoratedWaterVolume) | |
| { | |
| mDecoratedWaterVolume = decoratedWaterVolume; | |
| } | |
| void APMSeawaterVolume::SetSeawaterResourceClass(TSubclassOf<class UFGResourceDescriptor> resourceClass) | |
| { | |
| mSeawaterResourceClass = resourceClass; | |
| } | |
| //~ Begin AActor Interface | |
| void APMSeawaterVolume::BeginPlay() | |
| { | |
| if (mDecoratedWaterVolume) { | |
| mDecoratedWaterVolume->BeginPlay(); | |
| } | |
| } | |
| void APMSeawaterVolume::EndPlay(const EEndPlayReason::Type endPlayReason) | |
| { | |
| if (mDecoratedWaterVolume) { | |
| mDecoratedWaterVolume->EndPlay(endPlayReason); | |
| } | |
| } | |
| void APMSeawaterVolume::PostUnregisterAllComponents(void) | |
| { | |
| if (mDecoratedWaterVolume) { | |
| mDecoratedWaterVolume->PostUnregisterAllComponents(); | |
| } | |
| } | |
| void APMSeawaterVolume::PostRegisterAllComponents() | |
| { | |
| if (mDecoratedWaterVolume) { | |
| mDecoratedWaterVolume->PostRegisterAllComponents(); | |
| } | |
| } | |
| //~ End AActor Interface | |
| //~ Begin IFGSaveInterface Interface | |
| bool APMSeawaterVolume::ShouldSave_Implementation() const | |
| { | |
| return true; | |
| } | |
| bool APMSeawaterVolume::NeedTransform_Implementation() | |
| { | |
| return true; | |
| } | |
| //~ End IFGSaveInterface Interface | |
| //~ Begin IFGExtractableResourceInterface Interface | |
| void APMSeawaterVolume::SetIsOccupied(bool occupied) | |
| { | |
| mDecoratedWaterVolume->SetIsOccupied(occupied); | |
| } | |
| bool APMSeawaterVolume::IsOccupied() const | |
| { | |
| return mDecoratedWaterVolume->IsOccupied(); | |
| } | |
| bool APMSeawaterVolume::CanBecomeOccupied() const | |
| { | |
| return mDecoratedWaterVolume->CanBecomeOccupied(); | |
| } | |
| bool APMSeawaterVolume::HasAnyResources() const | |
| { | |
| return mDecoratedWaterVolume->HasAnyResources(); | |
| } | |
| TSubclassOf<class UFGResourceDescriptor> APMSeawaterVolume::GetResourceClass() const | |
| { | |
| return mSeawaterResourceClass; | |
| } | |
| int32 APMSeawaterVolume::ExtractResource(int32 amount) | |
| { | |
| return mDecoratedWaterVolume->ExtractResource(amount); | |
| } | |
| float APMSeawaterVolume::GetExtractionSpeedMultiplier() const | |
| { | |
| return mDecoratedWaterVolume->GetExtractionSpeedMultiplier(); | |
| } | |
| FVector APMSeawaterVolume::GetPlacementLocation(const FVector& hitLocation) const | |
| { | |
| return mDecoratedWaterVolume->GetPlacementLocation(hitLocation); | |
| } | |
| bool APMSeawaterVolume::CanPlaceResourceExtractor() const | |
| { | |
| return mDecoratedWaterVolume->CanPlaceResourceExtractor(); | |
| } | |
| //~ End IFGExtractableResourceInterface Interface |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #pragma once | |
| #include "CoreMinimal.h" | |
| #include "Resources/FGExtractableResourceInterface.h" | |
| #include "Resources/FGResourceDescriptor.h" | |
| #include "FGSaveInterface.h" | |
| #include "FGWaterVolume.h" | |
| #include "PMSeawaterVolume.generated.h" | |
| /** | |
| * | |
| */ | |
| UCLASS(HideCategories = (Collision)) | |
| class PERIODICMADNESS_API APMSeawaterVolume : public AActor, public IFGSaveInterface, public IFGExtractableResourceInterface | |
| { | |
| GENERATED_BODY() | |
| public: | |
| /** ctor */ | |
| APMSeawaterVolume(); | |
| void SetDecoratedWaterVolume(AFGWaterVolume* decoratedWaterVolume); | |
| void SetSeawaterResourceClass(TSubclassOf<class UFGResourceDescriptor> resourceClass); | |
| //~ Begin AActor Interface | |
| virtual void BeginPlay() override; | |
| virtual void EndPlay(const EEndPlayReason::Type endPlayReason) override; | |
| virtual void PostUnregisterAllComponents(void) override; | |
| virtual void PostRegisterAllComponents() override; | |
| //~ End AActor Interface | |
| //~ Begin IFGSaveInterface Interface | |
| virtual bool ShouldSave_Implementation() const override; | |
| virtual bool NeedTransform_Implementation() override; | |
| //~ End IFGSaveInterface Interface | |
| //~ Begin IFGExtractableResourceInterface Interface | |
| UFUNCTION() | |
| virtual void SetIsOccupied(bool occupied) override; | |
| UFUNCTION() | |
| virtual bool IsOccupied() const override; | |
| UFUNCTION() | |
| virtual bool CanBecomeOccupied() const override; | |
| UFUNCTION() | |
| virtual bool HasAnyResources() const override; | |
| UFUNCTION() | |
| virtual TSubclassOf<class UFGResourceDescriptor> GetResourceClass() const override; | |
| UFUNCTION() | |
| virtual int32 ExtractResource(int32 amount) override; | |
| UFUNCTION() | |
| virtual float GetExtractionSpeedMultiplier() const override; | |
| UFUNCTION() | |
| virtual FVector GetPlacementLocation(const FVector& hitLocation) const override; | |
| UFUNCTION() | |
| virtual bool CanPlaceResourceExtractor() const override; | |
| //~ End IFGExtractableResourceInterface Interface | |
| private: | |
| UPROPERTY(SaveGame) | |
| AFGWaterVolume* mDecoratedWaterVolume; | |
| /** Reference to the Seawater Descriptor. */ | |
| UPROPERTY(SaveGame) | |
| TSubclassOf<class UFGResourceDescriptor> mSeawaterResourceClass; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment