Skip to content

Commit

Permalink
feat: Added Orbital Trade alert patches
Browse files Browse the repository at this point in the history
If "We Had a Trader?" or "Tweaks Galore" are active, Realistic Orbital Trade now patches their alerts about orbital trade ships to include information about when they close their comms if the player triggered extra grace time in a trade.
  • Loading branch information
ilyvion committed May 9, 2024
1 parent 0965a22 commit 1080962
Show file tree
Hide file tree
Showing 30 changed files with 493 additions and 75 deletions.
1 change: 1 addition & 0 deletions .deps/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
originals
6 changes: 6 additions & 0 deletions .deps/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
These directories/files are only here to ensure the assemblies with dependencies on other mods can build. Everything except their assemblies have been stripped out.

For reference:

- 1541408076: We Had a Trader?
- 2695164414: Tweaks Galore
4 changes: 4 additions & 0 deletions .deps/generate_refs.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#Push-Location originals
Remove-Item -Recurse -Force refs
refasmer -v --all -O refs -g "originals\**\*.dll"
#Pop-Location
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
39 changes: 20 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,18 @@
name: Build

on:
push:
branches:
- main
paths-ignore:
- "README.md"
- "CHANGELOG.md"
- ".gitignore"
tags-ignore:
# This will ignore release versions tagged with a version identifier. We'll
# use a separate workflow for them.
- "v*"
pull_request:
paths-ignore:
- README.md
- "CHANGELOG.md"
- ".gitignore"
workflow_call:
inputs:
artifact-suffix:
required: true
type: string

jobs:
build:
name: Build
runs-on: windows-latest
env:
RimWorldSteamWorkshopFolderPath: ..\.deps\refs
steps:
- name: Checkout Repository
uses: actions/checkout@v4
Expand All @@ -34,29 +25,39 @@ jobs:
- name: Build Mod for 1.5
env:
RimWorldVersion: 1.5
run: dotnet build .vscode --configuration Release
run: |
dotnet build --configuration Release .vscode/mod.csproj
dotnet build --configuration Release .vscode/wehadatrader.interop.csproj
dotnet build --configuration Release .vscode/tweaksgalore.interop.csproj
- name: Build Mod for 1.4
env:
RimWorldVersion: 1.4
run: dotnet build .vscode --configuration Release
run: |
dotnet build .vscode --configuration Release
dotnet build --configuration Release .vscode/wehadatrader.interop.csproj
- name: Upload Mod Artifacts
uses: actions/upload-artifact@v4
with:
name: RealisticOrbitalTrade-${{ github.sha }}
name: RealisticOrbitalTrade-${{ inputs.artifact-suffix }}
path: |
About/
1.5/
1.4/
1.5_WeHadATrader/
1.4_WeHadATrader/
1.5_TweaksGalore/
Common/
UpdateLog/
Defs/
Patches/
LICENSE
LICENSE.Apache-2.0
LICENSE.MIT
README.md
CHANGELOG.md
LoadFolders.xml
!**/.*
!About/*.pdn
!About/*.svg
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Continuous Integration

on:
push:
branches:
- main
paths-ignore:
- "README.md"
- "CHANGELOG.md"
- ".gitignore"
tags-ignore:
# This will ignore release versions tagged with a version identifier. We'll
# use a separate workflow for them.
- "v*"
pull_request:
paths-ignore:
- README.md
- "CHANGELOG.md"
- ".gitignore"

jobs:
build:
uses: ./.github/workflows/build.yml
with:
artifact-suffix: ${{ github.sha }}
44 changes: 3 additions & 41 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,47 +9,9 @@ on:

jobs:
build:
name: Build
runs-on: windows-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup Dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x

- name: Build Mod for 1.5
env:
RimWorldVersion: 1.5
run: dotnet build .vscode --configuration Release

- name: Build Mod for 1.4
env:
RimWorldVersion: 1.4
run: dotnet build .vscode --configuration Release

- name: Upload Mod Artifacts
uses: actions/upload-artifact@v4
with:
name: RealisticOrbitalTrade-Release
path: |
About/
1.5/
1.4/
Common/
Defs/
Patches/
LICENSE
LICENSE.Apache-2.0
LICENSE.MIT
README.md
CHANGELOG.md
!**/.*
!About/*.pdn
!About/*.svg
!About/*.ttf
uses: ./.github/workflows/build.yml
with:
artifact-suffix: Release

package:
name: Release
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/.vscode/obj

/*/Assemblies

*.sln
42 changes: 36 additions & 6 deletions .vscode/build.ps1
Original file line number Diff line number Diff line change
@@ -1,24 +1,47 @@
$ErrorActionPreference = 'Stop'

$Configuration = 'Release'

$Target = "C:\Program Files (x86)\Steam\steamapps\common\RimWorld\Mods\RealisticOrbitalTrade"

# $env:RimWorldSteamWorkshopFolderPath = "..\.deps\refs"
$env:RimWorldSteamWorkshopFolderPath = "C:\Program Files (x86)\Steam\steamapps\workshop"

# build dlls
$env:RimWorldVersion = "1.5"
dotnet build .vscode
#dotnet build --configuration Release .vscode
dotnet build --configuration $Configuration .vscode/mod.csproj
if ($LASTEXITCODE -gt 0) {
throw "Build failed"
}
dotnet build --configuration $Configuration .vscode/wehadatrader.interop.csproj
if ($LASTEXITCODE -gt 0) {
throw "Build failed"
}
dotnet build --configuration $Configuration .vscode/tweaksgalore.interop.csproj
if ($LASTEXITCODE -gt 0) {
throw "Build failed"
}

$env:RimWorldVersion = "1.4"
dotnet build .vscode
#dotnet build --configuration Release .vscode
dotnet build --configuration $Configuration .vscode/mod.csproj
if ($LASTEXITCODE -gt 0) {
throw "Build failed"
}
dotnet build --configuration $Configuration .vscode/wehadatrader.interop.csproj
if ($LASTEXITCODE -gt 0) {
throw "Build failed"
}

# remove pdbs (for release)
# Remove-Item -Path .\1.5\Assemblies\RealisticOrbitalTrade.pdb -ErrorAction SilentlyContinue
# Remove-Item -Path .\1.4\Assemblies\RealisticOrbitalTrade.pdb -ErrorAction SilentlyContinue
if ($Configuration -eq "Release") {
Remove-Item -Path .\1.5\Assemblies\RealisticOrbitalTrade.pdb -ErrorAction SilentlyContinue
Remove-Item -Path .\1.4\Assemblies\RealisticOrbitalTrade.pdb -ErrorAction SilentlyContinue

Remove-Item -Path .\1.5_WeHadATrader\Assemblies\RealisticOrbitalTrade.WeHadATrader.pdb -ErrorAction SilentlyContinue
Remove-Item -Path .\1.4_WeHadATrader\Assemblies\RealisticOrbitalTrade.WeHadATrader.pdb -ErrorAction SilentlyContinue

Remove-Item -Path .\1.5_TweaksGalore\Assemblies\RealisticOrbitalTrade.TweaksGalore.pdb -ErrorAction SilentlyContinue
}

# remove mod folder
Remove-Item -Path $Target -Recurse -ErrorAction SilentlyContinue
Expand All @@ -27,7 +50,13 @@ Remove-Item -Path $Target -Recurse -ErrorAction SilentlyContinue
Copy-Item -Path 1.5 $Target\1.5 -Recurse
Copy-Item -Path 1.4 $Target\1.4 -Recurse

# copy interop mod files
Copy-Item -Path 1.5_WeHadATrader $Target\1.5_WeHadATrader -Recurse
Copy-Item -Path 1.4_WeHadATrader $Target\1.4_WeHadATrader -Recurse
Copy-Item -Path 1.5_TweaksGalore $Target\1.5_TweaksGalore -Recurse

Copy-Item -Path Common $Target\Common -Recurse
Copy-Item -Path UpdateLog $Target\UpdateLog -Recurse

New-Item -Path $Target -ItemType Directory -Name About
Copy-Item -Path About\About.xml $Target\About
Expand All @@ -41,3 +70,4 @@ Copy-Item -Path LICENSE $Target
Copy-Item -Path LICENSE.Apache-2.0 $Target
Copy-Item -Path LICENSE.MIT $Target
Copy-Item -Path README.md $Target
Copy-Item -Path LoadFolders.xml $Target
5 changes: 3 additions & 2 deletions .vscode/mod.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net472</TargetFramework>
<TargetFramework>net48</TargetFramework>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
Expand All @@ -12,7 +12,8 @@

<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>

<!-- Intellisense doesn't work without specifying this -->
<!-- Intellisense doesn't work without specifying these explicitly -->
<!-- !! Don't check in with these uncommented !! -->
<!-- <RimWorldVersion>1.5</RimWorldVersion> -->
</PropertyGroup>

Expand Down
66 changes: 66 additions & 0 deletions .vscode/tweaksgalore.interop.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net48</TargetFramework>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>

<RootNamespace>RealisticOrbitalTrade.TweaksGalore</RootNamespace>
<AssemblyName>RealisticOrbitalTrade.TweaksGalore</AssemblyName>
<VersionPrefix>0.6.1</VersionPrefix>

<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>

<!-- Intellisense doesn't work without specifying these explicitly -->
<!-- !! Don't check in with these uncommented !! -->
<!-- <RimWorldSteamWorkshopFolderPath>C:\Program Files (x86)\Steam\steamapps\workshop\content\294100</RimWorldSteamWorkshopFolderPath>
<RimWorldVersion>1.5</RimWorldVersion> -->
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols>
<Optimize>true</Optimize>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>

<ItemGroup>
<!-- Mod -->
<Compile Include="../Source/RealisticOrbitalTrade.TweaksGalore/**" />
</ItemGroup>

<Choose>
<When Condition="'$(RimWorldVersion)' == '1.5'">
<PropertyGroup>
<DefineConstants>$(DefineConstants);v1_5</DefineConstants>
<OutputPath>../1.5_TweaksGalore/Assemblies</OutputPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.5.*-*">
<ExcludeAssets>runtime</ExcludeAssets>
</PackageReference>
</ItemGroup>
</When>
</Choose>

<ItemGroup>
<PackageReference Include="Lib.Harmony" Version="2.2.2">
<ExcludeAssets>runtime</ExcludeAssets>
</PackageReference>
<ProjectReference Include=".\mod.csproj">
<CopyLocal>False</CopyLocal>
<Private>false</Private>
</ProjectReference>
<Reference Include="TweaksGalore">
<HintPath>$(RimWorldSteamWorkshopFolderPath)\2695164414\$(RimWorldVersion)\Assemblies\TweaksGalore.dll</HintPath>
<CopyLocal>False</CopyLocal>
<Private>false</Private>
</Reference>
</ItemGroup>
</Project>
Loading

0 comments on commit 1080962

Please sign in to comment.