Skip to content

Commit

Permalink
Merge pull request #342 from Panakotta00/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
Panakotta00 authored Oct 30, 2024
2 parents f06b8e2 + 875219b commit 38c7ab7
Show file tree
Hide file tree
Showing 38 changed files with 743 additions and 128 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,18 @@ jobs:
- name: Package FicsItNetworks Mod
run: ${{ github.workspace }}\ue\Engine\Build\BatchFiles\RunUAT.bat -ScriptsForProject='${{ github.workspace }}\SatisfactoryModLoader\FactoryGame.uproject' PackagePlugin -project='${{ github.workspace }}\SatisfactoryModLoader\FactoryGame.uproject' -DLCName='FicsItNetworks' -build -server -clientconfig=Shipping -serverconfig=Shipping -platform=Win64 -serverplatform=Win64+Linux -nocompileeditor -installed -merge -utf8output

- name: Upload FicsItNetworks-Merged
id: upload-win64-merged
uses: actions/upload-artifact@v4
with:
name: FicsItNetworks-Merged
path: ${{github.workspace}}\SatisfactoryModLoader\Saved\ArchivedPlugins\FicsItNetworks\FicsItNetworks.zip
- name: Upload FicsItNetworks
id: upload-win64
uses: actions/upload-artifact@v4
with:
name: FicsItNetworks
path: ${{github.workspace}}\SatisfactoryModLoader\Saved\ArchivedPlugins\FicsItNetworks\*.zip
path: ${{github.workspace}}\SatisfactoryModLoader\Saved\ArchivedPlugins\FicsItNetworks\FicsItNetworks-*.zip

- name: Discord Webhook Action
uses: Panakotta00/[email protected]
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/deploy-to-smr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
core.setFailed('Found Release is a draft!');
return;
}
core.setOutput('body', release.body);
core.setOutput('body_encoded', btoa(release.body));
- name: Download FicsIt-Networks Version
if: ${{inputs.should_upload}}
Expand All @@ -56,9 +56,10 @@ jobs:
- name: Upload to SMR
if: ${{inputs.should_upload}}
env:
body: ${{steps.find-release.outputs.body}}
BODY_ENCODED: ${{steps.find-release.outputs.body_encoded}}
run: |
ficsit --api-key "${{secrets.SMR_API_KEY}}" smr upload 8d8gk4imvFanRs FicsItNetworks.zip $body
BODY=$(echo "$BODY_ENCODED" | base64 --decode)
ficsit --api-key "${{secrets.SMR_API_KEY}}" smr upload 8d8gk4imvFanRs FicsItNetworks.zip $BODY
- name: Wait for Approval
uses: actions/github-script@v7
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: Push
on:
push:
branches:
- master
- development
workflow_dispatch:
workflow_call:
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/update-release-draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@ jobs:
name: "FicsItNetworks"
});
return response.data.artifacts[0].workflow_run.id;
- name: Find FicsIt-Networks-Merged Binary
uses: actions/github-script@v7
id: find-ficsit-networks-merged
with:
script: |
const response = await github.rest.actions.listArtifactsForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
per_page: 1,
name: "FicsItNetworks-Merged"
});
return response.data.artifacts[0].workflow_run.id;
- name: Download FicsIt-Networks
uses: actions/download-artifact@v4
Expand All @@ -50,6 +62,13 @@ jobs:
run-id: ${{ steps.find-ficsit-networks.outputs.result }}
path: ${{ github.workspace }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Download FicsIt-Networks
uses: actions/download-artifact@v4
with:
name: FicsItNetworks-Merged
run-id: ${{ steps.find-ficsit-networks-merged.outputs.result }}
path: ${{ github.workspace }}
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Upload To Github Release
uses: xresloader/[email protected]
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion FicsItNetworks.uplugin
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"FileVersion": 3,
"Version": 0,
"VersionName": "0.3",
"SemVersion": "0.3.23",
"SemVersion": "0.3.24",
"FriendlyName": "FicsIt-Networks",
"Description": "Adds a computer network and programmable computers to the Game.",
"Category": "Modding",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "FINAdvancedNetworkConnectionComponent.h"
#include "FINNetworkCircuit.h"
#include "FGBlueprintSubsystem.h"
#include "FGBuildable.h"
#include "Engine/World.h"
#include "Net/UnrealNetwork.h"

void UFINAdvancedNetworkConnectionComponent::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const {
Expand Down Expand Up @@ -36,7 +38,6 @@ void UFINAdvancedNetworkConnectionComponent::BeginPlay() {
}

void UFINAdvancedNetworkConnectionComponent::Serialize(FArchive& Ar) {
// UE_LOG(LogFicsItNetworks, Warning, Ar.)
Super::Serialize(Ar);
}

Expand All @@ -62,7 +63,7 @@ FString UFINAdvancedNetworkConnectionComponent::GetNick_Implementation() const {

void UFINAdvancedNetworkConnectionComponent::SetNick_Implementation(const FString& NewNick) {
Nick = NewNick;
//GetOwner()->ForceNetUpdate();
GetOwner()->ForceNetUpdate();
}

bool UFINAdvancedNetworkConnectionComponent::HasNick_Implementation(const FString& inNick) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ void AFINNetworkAdapterHologram::UpdateSnapped(AActor* NewSnappedActor) {
void AFINNetworkAdapterHologram::OnBeginSnap(AActor* ActorSnapped) {
if (ActorSnapped) {
UFGOutlineComponent* Outline = UFGOutlineComponent::Get(this->GetWorld());
if (Outline) Outline->ShowOutline(ActorSnapped, EOutlineColor::OC_HOLOGRAM);
if (Outline) Outline->ShowOutline(ActorSnapped, EOutlineColor::OC_HOLOGRAMLINE);
OnSnap();
}
}

Expand Down
25 changes: 24 additions & 1 deletion Source/FicsItNetworksCircuit/Private/FINNetworkCable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@

#include "Net/UnrealNetwork.h"
#include "FINNetworkConnectionComponent.h"
#include "TimerManager.h"
#include "Components/SplineMeshComponent.h"

AFINNetworkCable::AFINNetworkCable() {
CableSpline = CreateDefaultSubobject<USplineMeshComponent>("CableSpline");
CableSpline->SetupAttachment(RootComponent);
CableSpline->SetForwardAxis(ESplineMeshAxis::Z);
CableSpline->SetMobility(EComponentMobility::Type::Movable);

bReplicates = true;
}

AFINNetworkCable::~AFINNetworkCable() {}
Expand All @@ -32,6 +35,13 @@ void AFINNetworkCable::BeginPlay() {
if (!Buildable || !Buildable->GetBlueprintDesigner()) {
ConnectConnectors();
}

FTimerHandle handle;
GetWorld()->GetTimerManager().SetTimer(handle, FTimerDelegate::CreateWeakLambda(this, [this]() {
if (!IsValid(Connector1) || !IsValid(Connector2) || !Connector1->ConnectedCables.Contains(this) || !Connector2->ConnectedCables.Contains(this)) {
this->Execute_Dismantle(this);
}
}), 5000.0, false);
}

void AFINNetworkCable::EndPlay(EEndPlayReason::Type reason) {
Expand All @@ -58,7 +68,20 @@ int32 AFINNetworkCable::GetDismantleRefundReturnsMultiplier() const {
if (!IsValid(Connector1) || !IsValid(Connector2)) return 0;
FVector startPos = Connector1->GetComponentLocation();
FVector endPos = Connector2->GetComponentLocation();
return (startPos - endPos).Size() / 1000.0;
return FMath::Max(1, (startPos - endPos).Size() / 1000.0);
}

void AFINNetworkCable::SetConnection(UFINNetworkConnectionComponent* InConnector1, UFINNetworkConnectionComponent* InConnector2) {
Connector1 = InConnector1;
Connector2 = InConnector2;

ReconstructCable();

ForceNetUpdate();
}

TTuple<UFINNetworkConnectionComponent*, UFINNetworkConnectionComponent*> AFINNetworkCable::GetConnections() const {
return {Connector1, Connector2};
}

void AFINNetworkCable::ReconstructCable() {
Expand Down
Loading

0 comments on commit 38c7ab7

Please sign in to comment.