Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
cheese3660 committed Dec 23, 2023
0 parents commit 4bc5382
Show file tree
Hide file tree
Showing 22 changed files with 520 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/spacewarp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Space Warp Version Checker

on:
push:

jobs:
verify:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Verify KSP2 Mod
uses: Rexicon226/[email protected]

- name: KSP2 Builder
uses: Rexicon226/[email protected]
53 changes: 53 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# General C# project
*.suo
*.user
.vs/
[Bb]in/
[Oo]bj/
_UpgradeReport_Files/
/[Pp]ackages/

# Mod template folders
[Bb]uild/
[Dd]ist/
[Nn]uget/
[Ee]xternal_dlls/*
![Ee]xternal_dlls/PUT_EXTERNAL_DLLS_HERE

# Rider

# User specific
**/.idea/**/workspace.xml
**/.idea/**/tasks.xml
**/.idea/shelf/*
**/.idea/dictionaries
**/.idea/httpRequests/

# Sensitive or high-churn files
**/.idea/**/dataSources/
**/.idea/**/dataSources.ids
**/.idea/**/dataSources.xml
**/.idea/**/dataSources.local.xml
**/.idea/**/sqlDataSources.xml
**/.idea/**/dynamic.xml

# Rider auto-generates .iml files, and contentModel.xml
**/.idea/**/*.iml
**/.idea/**/contentModel.xml
**/.idea/**/modules.xml

# VS Code files
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace

# Local History for Visual Studio Code
.history/

# OS-specific
Thumbs.db
Desktop.ini
.DS_Store
13 changes: 13 additions & 0 deletions .idea/.idea.WMCCModules/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/.idea.WMCCModules/.idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/.idea.WMCCModules/.idea/indexLayout.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/.idea.WMCCModules/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 57 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup Label="Framework and language configuration">
<TargetFramework>netstandard2.1</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
<ImplicitUsings>true</ImplicitUsings>
</PropertyGroup>

<PropertyGroup Label="Game folder configuration">
<!-- Set this to the path to your KSP 2 folder if you don't have the KSP2DIR environmental variable set -->
<KSP2DIR Condition="'$(KSP2DIR)' == ''">C:/Program Files (x86)/Steam/steamapps/common/Kerbal Space Program 2</KSP2DIR>
</PropertyGroup>

<PropertyGroup Label="Build and namespace configuration">
<SolutionDir Condition="'$(SolutionDir)'==''">$(MSBuildThisFileDirectory)</SolutionDir>
<BaseOutputPath>$(SolutionDir)build/bin/$(MSBuildProjectName)</BaseOutputPath>
<BaseIntermediateOutputPath>$(SolutionDir)build/obj/$(MSBuildProjectName)</BaseIntermediateOutputPath>
<AssemblyName>$(MSBuildProjectName)</AssemblyName>
<RootNamespace>$(AssemblyName)</RootNamespace>
<Configurations>Debug;Release;Deploy;DeployAndRun</Configurations>
<Platforms>AnyCPU</Platforms>
<NoWarn>$(NoWarn);CS0436</NoWarn>
</PropertyGroup>

<PropertyGroup Label="Package source configuration">
<RestoreAdditionalProjectSources>
https://nuget.spacewarp.org/v3/index.json
</RestoreAdditionalProjectSources>
</PropertyGroup>

<ItemGroup Label="Dependencies for build targets">
<PackageReference Include="JsonPeek" Version="1.2.0" PrivateAssets="all"/>
</ItemGroup>

<!-- Define the main target -->
<Target Label="Reading properties from swinfo.json" Name="ReadPropertiesFromJson" BeforeTargets="PreBuildEvent;AddGeneratedFile">
<JsonPeek ContentPath="$(SolutionDir)/plugin_template/swinfo.json" Query="$">
<Output TaskParameter="Result" ItemName="Swinfo"/>
</JsonPeek>

<!-- Extract properties from the JSON -->
<PropertyGroup>
<ModId>@(Swinfo -> '%(mod_id)')</ModId>
<Version>@(Swinfo -> '%(version)')</Version>
<Version Condition="$(Version.Contains('-'))">$(Version.Substring(0, $(Version.IndexOf('-'))))</Version>
<Product>@(Swinfo -> '%(name)')</Product>
<Authors>@(Swinfo -> '%(author)')</Authors>
<Description>@(Swinfo -> '%(description)')</Description>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>@(Swinfo -> '%(source)')</RepositoryUrl>
<BepInExPluginGuid>$(ModId)</BepInExPluginGuid>
<BepInExPluginName>$(Product)</BepInExPluginName>
<BepInExPluginVersion>$(Version)</BepInExPluginVersion>
</PropertyGroup>
</Target>
</Project>
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MIT License

Copyright (c) 2023 Cheese

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Where's My Crew Capsule (Modules)
The modules used for Where's My Crew Capsule
23 changes: 23 additions & 0 deletions WMCCModules.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{D20EFBCB-A831-4957-A64A-42207DEC1B69}") = "WMCCModules", "src/WMCCModules/WMCCModules.csproj", "{62FE5A3D-988F-4E2A-A613-62F8D60E3B8C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Deploy|Any CPU = Deploy|Any CPU
DeployAndRun|Any CPU = DeployAndRun|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{62FE5A3D-988F-4E2A-A613-62F8D60E3B8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{62FE5A3D-988F-4E2A-A613-62F8D60E3B8C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{62FE5A3D-988F-4E2A-A613-62F8D60E3B8C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{62FE5A3D-988F-4E2A-A613-62F8D60E3B8C}.Release|Any CPU.Build.0 = Release|Any CPU
{62FE5A3D-988F-4E2A-A613-62F8D60E3B8C}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU
{62FE5A3D-988F-4E2A-A613-62F8D60E3B8C}.Deploy|Any CPU.Build.0 = Deploy|Any CPU
{62FE5A3D-988F-4E2A-A613-62F8D60E3B8C}.DeployAndRun|Any CPU.ActiveCfg = DeployAndRun|Any CPU
{62FE5A3D-988F-4E2A-A613-62F8D60E3B8C}.DeployAndRun|Any CPU.Build.0 = DeployAndRun|Any CPU
EndGlobalSection
EndGlobal

5 changes: 5 additions & 0 deletions plugin_template/localizations/english.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Key,Type,Desc,English
WMCCModules/Pressurization/Suffocating,Text,,A Kerbal on board your craft is suffocating!
WMCCModules/Pressurization/Killed,Text,,A Kerbal on board your craft died due to lack of pressurization
WMCCModules/Pressurized,Text,,Pressurized
WMCCModules/ServiceCeiling,Text,,Service Ceiling
23 changes: 23 additions & 0 deletions plugin_template/swinfo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"spec": "2.0",
"mod_id": "WMCCModules",
"author": "Cheese",
"name": "Where's My Crew Capsule (Modules)",
"description": "The modules used for Where's My Crew Capsule",
"source": "",
"version": "0.1.0",
"version_check": "",
"ksp2_version": {
"min": "0.1.5",
"max": "*"
},
"dependencies": [
{
"id": "com.github.x606.spacewarp",
"version": {
"min": "1.6.0",
"max": "*"
}
}
]
}
2 changes: 2 additions & 0 deletions scripts/build-debug.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@echo off
dotnet build "../WMCCModules.sln" -c Debug
2 changes: 2 additions & 0 deletions scripts/build-deploy.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@echo off
dotnet build "../WMCCModules.sln" -c Deploy
2 changes: 2 additions & 0 deletions scripts/build-release.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@echo off
dotnet build "../WMCCModules.sln" -c Release
2 changes: 2 additions & 0 deletions scripts/build-run.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@echo off
dotnet build "../WMCCModules.sln" -c DeployAndRun
58 changes: 58 additions & 0 deletions src/WMCCModules/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<Target Label="Post build events" Name="PostBuild" AfterTargets="PostBuildEvent">
<Message Text="Cleaning up previous build directory"/>
<RemoveDir Directories="$(SolutionDir)/dist/$(ConfigurationName)"/>
<MakeDir Directories="$(SolutionDir)/dist/$(ConfigurationName)/BepInEx/plugins/$(ProjectName)"/>

<ItemGroup Label="Plugin template folder to be copied">
<PluginTemplate Include="$(SolutionDir)/plugin_template/**/*.*" Exclude="$(SolutionDir)/**/.gitkeep"/>
</ItemGroup>
<Message Text="Copying plugin folder to build directory"/>
<Copy SourceFiles="@(PluginTemplate)"
DestinationFolder="$(SolutionDir)/dist/$(ConfigurationName)/BepInEx/plugins/$(ProjectName)/%(RecursiveDir)"/>

<Message Text="Copying mod DLL to build directory"/>
<Copy SourceFiles="$(TargetPath)"
DestinationFolder="$(SolutionDir)/dist/$(ConfigurationName)/BepInEx/plugins/$(ProjectName)"/>

<Message Text="Copying mod PDB to build directory"
Condition="$(ConfigurationName) == Debug Or $(ConfigurationName) == Deploy Or $(ConfigurationName) == DeployAndRun"/>
<Copy Condition="$(ConfigurationName) == Debug Or $(ConfigurationName) == Deploy Or $(ConfigurationName) == DeployAndRun"
SourceFiles="$(TargetDir)$(TargetName).pdb"
DestinationFolder="$(SolutionDir)/dist/$(ConfigurationName)/BepInEx/plugins/$(ProjectName)"/>

<Message Text="Copying LICENSE and README to build directory"/>
<Copy Condition="Exists('$(SolutionDir)/LICENSE')"
SourceFiles="$(SolutionDir)/LICENSE"
DestinationFolder="$(SolutionDir)/dist/$(ConfigurationName)/BepInEx/plugins/$(ProjectName)"/>
<Copy Condition="Exists('$(SolutionDir)/README.md')"
SourceFiles="$(SolutionDir)/README.md"
DestinationFiles="$(SolutionDir)/dist/$(ConfigurationName)/BepInEx/plugins/$(ProjectName)/README.txt"/>

<Message Text="Compressing built plugin folder" Condition="$(ConfigurationName) == Release"/>
<Delete Condition="$(ConfigurationName) == Release"
Files="$(SolutionDir)/dist/$(SolutionName)-$(Version).zip"/>
<Exec Condition="$(ConfigurationName) == Release"
Command="powershell Compress-Archive -Path '$(SolutionDir)/dist/$(ConfigurationName)/BepInEx' -DestinationPath '$(SolutionDir)/dist/$(SolutionName)-$(Version).zip'"/>

<Message Text="Clean up the game's plugin folder" Condition="$(ConfigurationName) == Deploy Or $(ConfigurationName) == DeployAndRun"/>
<RemoveDir Condition="$(ConfigurationName) == Deploy Or $(ConfigurationName) == DeployAndRun"
Directories="$(KSP2DIR)/BepInEx/plugins/$(ProjectName)"/>
<MakeDir Condition="$(ConfigurationName) == Deploy Or $(ConfigurationName) == DeployAndRun"
Directories="$(KSP2DIR)/BepInEx/plugins/$(ProjectName)"/>

<ItemGroup Label="Dist folder to be copied">
<DistFolder Include="$(SolutionDir)/dist/$(ConfigurationName)/BepInEx/plugins/$(ProjectName)/**/*.*"/>
</ItemGroup>
<Message Text="Deploy plugin to game folder"
Condition="$(ConfigurationName) == Deploy Or $(ConfigurationName) == DeployAndRun"/>
<Copy Condition="$(ConfigurationName) == Deploy Or $(ConfigurationName) == DeployAndRun"
SourceFiles="@(DistFolder)"
DestinationFolder="$(KSP2DIR)/BepInEx/plugins/$(ProjectName)/%(RecursiveDir)"/>

<Message Text="Deploy plugin and run game" Condition="$(ConfigurationName) == DeployAndRun"/>
<Exec Command="powershell &quot;start-process &quot;&quot;$(KSP2DIR)\KSP2_x64.exe&quot;&quot;&quot;" Condition="$(ConfigurationName) == DeployAndRun"/>
</Target>
</Project>

22 changes: 22 additions & 0 deletions src/WMCCModules/Modules/Data_Pressurization.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using JetBrains.Annotations;
using KSP.Sim;
using KSP.Sim.Definitions;

namespace WMCCModules.Modules;

public class Data_Pressurization : ModuleData
{
public override Type ModuleType => typeof(Module_Pressurization);
[KSPDefinition] public List<string> TechNodesForPressurization = new();
[KSPDefinition] public bool UseScienceToChangePressurization = false;
[KSPDefinition] public bool DefaultPressurizationState = false;
[KSPDefinition] public double WarningAltitude = 0.0;
[KSPDefinition] public double KillAltitude = 0.0;
[KSPState] public bool IsPressurized = false;

[LocalizedField("WMCCModules/Pressurized")] [PAMDisplayControl(SortIndex = 1)] [KSPState]
public ModuleProperty<string> PressurizationState = new ModuleProperty<string>("", true);
[LocalizedField("WMCCModules/ServiceCeiling")]
[PAMDisplayControl(SortIndex = 2)]
[KSPState] public ModuleProperty<string> ServiceCeiling = new ModuleProperty<string>("", true);
}
Loading

0 comments on commit 4bc5382

Please sign in to comment.