feat: update template for nixos
This commit is contained in:
parent
dce259ecf8
commit
c229cb42ac
26 changed files with 474 additions and 174 deletions
1
.envrc
Normal file
1
.envrc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
use flake
|
7
.gitignore
vendored
7
.gitignore
vendored
|
@ -1,6 +1,3 @@
|
||||||
/.vscode/obj
|
/.vscode/obj
|
||||||
|
/.direnv/
|
||||||
# /*/Assemblies
|
/log/rimworld.log
|
||||||
# /*/Assemblies/*.pdb
|
|
||||||
# /.vscode
|
|
||||||
# /Source
|
|
23
.vscode/about.xml.xslt
vendored
Normal file
23
.vscode/about.xml.xslt
vendored
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||||
|
<xsl:output method="xml" indent="yes"/>
|
||||||
|
|
||||||
|
<!-- Match ModMetaData and its descendants, modify modVersion element -->
|
||||||
|
<xsl:template match="/Project/PropertyGroup/ModMetaData|ModMetaData/@*[not(name()='Id')]|ModMetaData//node()">
|
||||||
|
<xsl:copy>
|
||||||
|
<xsl:apply-templates select="@*[not(name()='Id')]|node()"/>
|
||||||
|
</xsl:copy>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<!-- Modify modVersion element using the value of VersionPrefix -->
|
||||||
|
<xsl:template match="ModMetaData/modVersion">
|
||||||
|
<modVersion>
|
||||||
|
<xsl:copy-of select="@*" />
|
||||||
|
<xsl:value-of select="/Project/PropertyGroup/VersionPrefix"/>
|
||||||
|
</modVersion>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<!-- Remove other elements and attributes -->
|
||||||
|
<xsl:template match="@*|node()">
|
||||||
|
<xsl:apply-templates/>
|
||||||
|
</xsl:template>
|
||||||
|
</xsl:stylesheet>
|
7
.vscode/build.bat
vendored
7
.vscode/build.bat
vendored
|
@ -1,7 +0,0 @@
|
||||||
echo off
|
|
||||||
|
|
||||||
REM remove unnecessary assemblies
|
|
||||||
DEL .\*\Assemblies\*.*
|
|
||||||
|
|
||||||
REM build dll
|
|
||||||
dotnet build .vscode
|
|
15
.vscode/build.sh
vendored
Executable file
15
.vscode/build.sh
vendored
Executable file
|
@ -0,0 +1,15 @@
|
||||||
|
set -e
|
||||||
|
|
||||||
|
script_dir=$(dirname $(readlink -f $0))
|
||||||
|
mod_dir=$(dirname $script_dir)
|
||||||
|
pushd $script_dir
|
||||||
|
|
||||||
|
# build dll
|
||||||
|
rm -f ../1.4/Assemblies/*
|
||||||
|
dotnet build mod.csproj
|
||||||
|
|
||||||
|
# generate About.xml
|
||||||
|
rm -f ../About/About.xml
|
||||||
|
xsltproc -o ../About/About.xml ./about.xml.xslt ./mod.csproj
|
||||||
|
|
||||||
|
popd
|
5
.vscode/extensions.json
vendored
5
.vscode/extensions.json
vendored
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
"recommendations": [
|
|
||||||
"ms-dotnettools.csharp"
|
|
||||||
]
|
|
||||||
}
|
|
9
.vscode/fmt.sh
vendored
Normal file
9
.vscode/fmt.sh
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
set -e
|
||||||
|
|
||||||
|
script_dir=$(dirname $(readlink -f $0))
|
||||||
|
mod_dir=$(dirname $script_dir)
|
||||||
|
pushd $mod_dir
|
||||||
|
|
||||||
|
nix fmt
|
||||||
|
|
||||||
|
popd
|
20
.vscode/launch.json
vendored
20
.vscode/launch.json
vendored
|
@ -1,20 +0,0 @@
|
||||||
{
|
|
||||||
// Use IntelliSense to learn about possible attributes.
|
|
||||||
// Hover to view descriptions of existing attributes.
|
|
||||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"name": "Rimworld Mod Project",
|
|
||||||
"type": "clr",
|
|
||||||
"request": "launch",
|
|
||||||
"preLaunchTask": "build dll",
|
|
||||||
"args": [],
|
|
||||||
"program": "../../RimWorldWin64.exe",
|
|
||||||
"cwd": "${workspaceFolder}",
|
|
||||||
"console": "internalConsole",
|
|
||||||
"internalConsoleOptions":"neverOpen",
|
|
||||||
"stopAtEntry": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
9
.vscode/launch.sh
vendored
Executable file
9
.vscode/launch.sh
vendored
Executable file
|
@ -0,0 +1,9 @@
|
||||||
|
set -e
|
||||||
|
|
||||||
|
script_dir=$(dirname $(readlink -f $0))
|
||||||
|
mod_dir=$(dirname $script_dir)
|
||||||
|
pushd $script_dir
|
||||||
|
|
||||||
|
LC_ALL=C steam-run ~/.steam/steam/steamapps/common/RimWorld/RimWorldLinux -logfile $mod_dir/log/rimworld.log -popupwindow $@
|
||||||
|
|
||||||
|
popd
|
90
.vscode/mod.csproj
vendored
90
.vscode/mod.csproj
vendored
|
@ -1,34 +1,60 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<TargetFramework>net480</TargetFramework>
|
<TargetFramework>net480</TargetFramework>
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<!-- Modify [RootNamespace], [AssemblyName], [OutputPath], [VersionPrefix] -->
|
||||||
<!-- Modify [RootNamespace], [AssemblyName], [OutputPath], [VersionPrefix] -->
|
<RootNamespace>Template</RootNamespace>
|
||||||
<RootNamespace>Template</RootNamespace>
|
<AssemblyName>Template</AssemblyName>
|
||||||
<AssemblyName>Template</AssemblyName>
|
<OutputPath>../1.4/Assemblies</OutputPath>
|
||||||
<OutputPath>../1.4/Assemblies</OutputPath>
|
<LangVersion>latest</LangVersion>
|
||||||
<VersionPrefix>0.1.0.0</VersionPrefix>
|
<VersionPrefix>0.1.0.0</VersionPrefix>
|
||||||
|
<!-- do not generate pdb file -->
|
||||||
<!-- do not generate pdb file -->
|
<DebugType>none</DebugType>
|
||||||
<DebugType>none</DebugType>
|
<DebugSymbols>false</DebugSymbols>
|
||||||
|
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||||
<DebugSymbols>false</DebugSymbols>
|
<!-- Contents of About.xml
|
||||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
See https://rimworldwiki.com/wiki/Modding_Tutorials/About.xml -->
|
||||||
</PropertyGroup>
|
<ModMetaData>
|
||||||
|
<packageId>dev.tobot.mod-template</packageId>
|
||||||
<ItemGroup>
|
<name>Mod Template</name>
|
||||||
<!-- Mod -->
|
<authors>
|
||||||
<Compile Include="../Source/*" />
|
<li>Toby</li>
|
||||||
|
</authors>
|
||||||
<!-- Rimworld -->
|
<description>A mod template.\nReady to build on NixOS.</description>
|
||||||
<Reference Include="../../../RimWorldWin64_Data/Managed/*.dll">
|
<supportedVersions>
|
||||||
<Private>False</Private>
|
<li>1.4</li>
|
||||||
</Reference>
|
</supportedVersions>
|
||||||
|
<modVersion IgnoreIfNoMatchingField="True" />
|
||||||
<!-- Harmony -->
|
<url />
|
||||||
<!-- <Reference Include="../../Harmony/Current/Assemblies/0Harmony.dll">
|
<modDependencies />
|
||||||
<Private>False</Private>
|
<modDependenciesByVersion>
|
||||||
</Reference> -->
|
<!-- <v1.4>
|
||||||
</ItemGroup>
|
<li>
|
||||||
|
<packageId>brrainz.harmony</packageId>
|
||||||
|
<displayName>Harmony</displayName>
|
||||||
|
<steamWorkshopUrl>steam://url/CommunityFilePage/2009463077</steamWorkshopUrl>
|
||||||
|
<downloadUrl>https://github.com/pardeike/HarmonyRimWorld/releases/latest</downloadUrl>
|
||||||
|
</li>
|
||||||
|
</v1.4> -->
|
||||||
|
</modDependenciesByVersion>
|
||||||
|
<loadAfter />
|
||||||
|
<loadAfterByVersion />
|
||||||
|
<forceLoadAfter />
|
||||||
|
<loadBefore />
|
||||||
|
<loadBeforeByVersion />
|
||||||
|
<forceLoadBefore />
|
||||||
|
<incompatibleWith />
|
||||||
|
<incompatibleWithByVersion />
|
||||||
|
</ModMetaData>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<!-- Mod -->
|
||||||
|
<Compile Include="../Source/*" />
|
||||||
|
<PackageReference Include="Krafs.Rimworld.Ref"
|
||||||
|
Version="1.4.3901" />
|
||||||
|
<PackageReference Include="Lib.Harmony"
|
||||||
|
Version="2.2.2"
|
||||||
|
IncludeAssets="none" />
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
10
.vscode/settings.json
vendored
Normal file
10
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
// "explorer.excludeGitIgnore": true,
|
||||||
|
"files.exclude": {
|
||||||
|
".direnv": true,
|
||||||
|
".vscode/obj": true
|
||||||
|
},
|
||||||
|
"files.readonlyInclude": {
|
||||||
|
"log/rimworld.log": true
|
||||||
|
}
|
||||||
|
}
|
12
.vscode/setup.sh
vendored
Executable file
12
.vscode/setup.sh
vendored
Executable file
|
@ -0,0 +1,12 @@
|
||||||
|
set -e
|
||||||
|
|
||||||
|
script_dir=$(dirname $(readlink -f $0))
|
||||||
|
mod_dir=$(dirname $script_dir)
|
||||||
|
pushd $script_dir
|
||||||
|
|
||||||
|
mod_name="${mod_dir##*/}"
|
||||||
|
|
||||||
|
# Try to create symlink in RimWorld mod directory
|
||||||
|
ln -s $mod_dir -t "$(readlink -f ~/.steam/steam/steamapps/common/RimWorld/Mods)" -v || echo "Target directory already exists. This is expected on re-runs"
|
||||||
|
|
||||||
|
popd
|
51
.vscode/tasks.json
vendored
51
.vscode/tasks.json
vendored
|
@ -2,13 +2,60 @@
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"tasks": [
|
"tasks": [
|
||||||
{
|
{
|
||||||
"label": "build dll",
|
"label": "format",
|
||||||
|
"type": "shell",
|
||||||
|
"group": "none",
|
||||||
|
"command": ".vscode/fmt.sh",
|
||||||
|
"problemMatcher": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "build mod",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"group": {
|
"group": {
|
||||||
"kind": "build",
|
"kind": "build",
|
||||||
"isDefault": true
|
"isDefault": true
|
||||||
},
|
},
|
||||||
"command": ".vscode/build.bat",
|
"command": ".vscode/build.sh",
|
||||||
|
"problemMatcher": [
|
||||||
|
"$msCompile"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"label": "run game",
|
||||||
|
"type": "shell",
|
||||||
|
"group": {
|
||||||
|
"kind": "none",
|
||||||
|
"isDefault": true
|
||||||
|
},
|
||||||
|
"command": ".vscode/launch.sh",
|
||||||
|
"problemMatcher": [],
|
||||||
|
"dependsOn": [
|
||||||
|
"link mod directory",
|
||||||
|
"build mod"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "run game (quicktest)",
|
||||||
|
"type": "shell",
|
||||||
|
"group": {
|
||||||
|
"kind": "none",
|
||||||
|
"isDefault": true
|
||||||
|
},
|
||||||
|
"command": ".vscode/launch.sh -quicktest",
|
||||||
|
"problemMatcher": [],
|
||||||
|
"dependsOn": [
|
||||||
|
"link mod directory",
|
||||||
|
"build mod"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "link mod directory",
|
||||||
|
"type": "shell",
|
||||||
|
"group": {
|
||||||
|
"kind": "none"
|
||||||
|
},
|
||||||
|
"command": ".vscode/setup.sh",
|
||||||
|
"problemMatcher": []
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
BIN
1.4/Assemblies/Template.dll
Normal file
BIN
1.4/Assemblies/Template.dll
Normal file
Binary file not shown.
|
@ -1,12 +1,12 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<Defs>
|
<Defs>
|
||||||
<LetterDef>
|
<LetterDef>
|
||||||
<defName>success_letter</defName>
|
<defName>success_letter</defName>
|
||||||
<color>(65, 200, 65)</color>
|
<color>(65, 200, 65)</color>
|
||||||
<flashColor>(85, 255, 85)</flashColor>
|
<flashColor>(85, 255, 85)</flashColor>
|
||||||
<flashInterval>6</flashInterval>
|
<flashInterval>6</flashInterval>
|
||||||
<bounce>false</bounce>
|
<bounce>false</bounce>
|
||||||
<arriveSound>LetterArrive_Good</arriveSound>
|
<arriveSound>LetterArrive_Good</arriveSound>
|
||||||
<description>If you can see this letter, then mod template is set up correctly.</description>
|
<description>If you can see this letter, then mod template is set up correctly.</description>
|
||||||
</LetterDef>
|
</LetterDef>
|
||||||
</Defs>
|
</Defs>
|
|
@ -1,3 +1,2 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<LanguageData>
|
<LanguageData />
|
||||||
</LanguageData>
|
|
|
@ -1,3 +1,2 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<Patch>
|
<Patch />
|
||||||
</Patch>
|
|
|
@ -1,24 +1,33 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0"?>
|
||||||
<ModMetaData>
|
<ModMetaData>
|
||||||
<packageId>username.modname</packageId>
|
<packageId>dev.tobot.mod-template</packageId>
|
||||||
<name>Mod Template</name>
|
<name>Mod Template</name>
|
||||||
<author>username</author>
|
<authors>
|
||||||
<supportedVersions>
|
<li>Toby</li>
|
||||||
<li>1.4</li>
|
</authors>
|
||||||
</supportedVersions>
|
<description>A mod template.\nReady to build on NixOS.</description>
|
||||||
|
<supportedVersions>
|
||||||
<modDependencies>
|
<li>1.4</li>
|
||||||
<!-- <li>
|
</supportedVersions>
|
||||||
<packageId>brrainz.harmony</packageId>
|
<modVersion IgnoreIfNoMatchingField="True">0.1.0.0</modVersion>
|
||||||
<displayName>Harmony</displayName>
|
<url/>
|
||||||
<steamWorkshopUrl>steam://url/CommunityFilePage/2009463077</steamWorkshopUrl>
|
<modDependencies/>
|
||||||
<downloadUrl>https://github.com/pardeike/HarmonyRimWorld/releases/latest</downloadUrl>
|
<modDependenciesByVersion>
|
||||||
</li> -->
|
<!-- <v1.4>
|
||||||
</modDependencies>
|
<li>
|
||||||
|
<packageId>brrainz.harmony</packageId>
|
||||||
<incompatibleWith>
|
<displayName>Harmony</displayName>
|
||||||
<!-- <li>username.modname</li> -->
|
<steamWorkshopUrl>steam://url/CommunityFilePage/2009463077</steamWorkshopUrl>
|
||||||
</incompatibleWith>
|
<downloadUrl>https://github.com/pardeike/HarmonyRimWorld/releases/latest</downloadUrl>
|
||||||
|
</li>
|
||||||
<description>Template</description>
|
</v1.4> -->
|
||||||
</ModMetaData>
|
</modDependenciesByVersion>
|
||||||
|
<loadAfter/>
|
||||||
|
<loadAfterByVersion/>
|
||||||
|
<forceLoadAfter/>
|
||||||
|
<loadBefore/>
|
||||||
|
<loadBeforeByVersion/>
|
||||||
|
<forceLoadBefore/>
|
||||||
|
<incompatibleWith/>
|
||||||
|
<incompatibleWithByVersion/>
|
||||||
|
</ModMetaData>
|
||||||
|
|
21
LICENSE
Normal file
21
LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2024 Tobias Berger
|
||||||
|
|
||||||
|
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.
|
30
README.md
30
README.md
|
@ -1,23 +1,19 @@
|
||||||
# Rimworld Mod Template
|
# RimWorld Mod Template
|
||||||
|
|
||||||
This template is created for Rimworld modders who use [Visual Studio Code](https://code.visualstudio.com/) instead of Visual Studio IDE.
|
This template is created for creating RimWorld mods in [VSCodium/Visual Studio Code](https://vscodium.com/)
|
||||||
|
|
||||||
* __No virtual folders__. Easy to manage and edit both `xml` and `cs` files.
|
|
||||||
|
|
||||||
* __Lightweight__. Visual Studio Code only takes up to 200 MB of storage space and is lighting fast.
|
|
||||||
|
|
||||||
* __Automated__. Integrated build, scripting and management tools to perform common tasks making everyday workflows faster.
|
|
||||||
|
|
||||||
* __Customizable__. Almost every feature can be changed, whenever it is editor UI, keybinds or folder structure.
|
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
1. Download and install [.NET Core SDK](https://dotnet.microsoft.com/download/dotnet-core) and [.Net Framework 4.8 Developer Pack](https://dotnet.microsoft.com/download/dotnet-framework/net48). This step can be skipped if you already have required C# packages from Visual Studio IDE.
|
|
||||||
2. Install [C# extension](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp).
|
1. Ensure the extension `ms-dotnettools.csharp` (a.k.a. [C#](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp)) is installed
|
||||||
3. Clone, pull or download this template into your Rimworld `Mods` folder.
|
1. Run the task `link mod directory`.
|
||||||
|
- This should symlink the mod directory to RimWorld's mod folder.
|
||||||
|
- The script won't work if you have installed RimWorld anywhere else than the default steam install.
|
||||||
|
1. Run the task `build mod` to compile assemblies and About.xml
|
||||||
|
1. Run the task `run game` to launch the game
|
||||||
|
- The script won't work if you have installed RimWorld anywhere else than the default steam install.
|
||||||
|
|
||||||
## Additional notes
|
## Additional notes
|
||||||
* By pressing `F5` key VS Code will perform 2 operations: build assembly file and launch Rimworld executable.
|
|
||||||
* All intermediate files are kept inside `.vscode` folder.
|
|
||||||
* For XML only modders remove preLaunchTask line from `.vscode/launch.json` file.
|
|
||||||
* Modify `.vscode/mod.csproj` and `About/About.xml` according to your needs.
|
|
||||||
|
|
||||||
|
- All attributes for `About.xml` are kept in `.vscode/mod.csproj`, `About.xml` will get overriden each build.
|
||||||
|
- You can run `nix fmt` to format all code in the repository.
|
||||||
|
- While this template is designed for VSCodium, it works just as well with any other editor, simply launch the scripts manually
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using UnityEngine;
|
|
||||||
using Verse;
|
|
||||||
using Verse.AI;
|
|
||||||
using Verse.AI.Group;
|
|
||||||
using Verse.Sound;
|
|
||||||
using Verse.Noise;
|
|
||||||
using Verse.Grammar;
|
|
||||||
using RimWorld;
|
|
||||||
using RimWorld.Planet;
|
|
||||||
|
|
||||||
// using System.Reflection;
|
|
||||||
// using HarmonyLib;
|
|
||||||
|
|
||||||
namespace Template
|
|
||||||
{
|
|
||||||
[DefOf]
|
|
||||||
public class TemplateDefOf
|
|
||||||
{
|
|
||||||
public static LetterDef success_letter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class MyMapComponent : MapComponent
|
|
||||||
{
|
|
||||||
public MyMapComponent(Map map) : base(map){}
|
|
||||||
public override void FinalizeInit()
|
|
||||||
{
|
|
||||||
Messages.Message("Success", null, MessageTypeDefOf.PositiveEvent);
|
|
||||||
Find.LetterStack.ReceiveLetter("Success", TemplateDefOf.success_letter.description, TemplateDefOf.success_letter, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[StaticConstructorOnStartup]
|
|
||||||
public static class Start
|
|
||||||
{
|
|
||||||
static Start()
|
|
||||||
{
|
|
||||||
Log.Message("Mod template loaded successfully!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
16
Source/Startup.cs
Normal file
16
Source/Startup.cs
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
#nullable enable
|
||||||
|
|
||||||
|
using Verse;
|
||||||
|
|
||||||
|
// using HarmonyLib;
|
||||||
|
|
||||||
|
namespace Template;
|
||||||
|
|
||||||
|
[StaticConstructorOnStartup]
|
||||||
|
public static class Startup
|
||||||
|
{
|
||||||
|
static Startup()
|
||||||
|
{
|
||||||
|
Log.Message("Mod template loaded successfully!");
|
||||||
|
}
|
||||||
|
}
|
13
Source/TemplateDefOf.cs
Normal file
13
Source/TemplateDefOf.cs
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#nullable disable // Populated at runtime ; Will error if Def isn't added in Defs
|
||||||
|
|
||||||
|
using RimWorld;
|
||||||
|
using Verse;
|
||||||
|
|
||||||
|
namespace Template;
|
||||||
|
|
||||||
|
[DefOf]
|
||||||
|
public class TemplateDefOf
|
||||||
|
{
|
||||||
|
public static LetterDef success_letter;
|
||||||
|
}
|
||||||
|
#nullable enable
|
25
Source/TemplateMapComponent.cs
Normal file
25
Source/TemplateMapComponent.cs
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#nullable enable
|
||||||
|
|
||||||
|
using RimWorld;
|
||||||
|
using Verse;
|
||||||
|
|
||||||
|
// using HarmonyLib;
|
||||||
|
|
||||||
|
namespace Template;
|
||||||
|
|
||||||
|
public class TemplateMapComponent : MapComponent
|
||||||
|
{
|
||||||
|
public TemplateMapComponent(Map map)
|
||||||
|
: base(map) { }
|
||||||
|
|
||||||
|
public override void FinalizeInit()
|
||||||
|
{
|
||||||
|
Messages.Message("Success", null, MessageTypeDefOf.PositiveEvent);
|
||||||
|
Find.LetterStack.ReceiveLetter(
|
||||||
|
"Success",
|
||||||
|
TemplateDefOf.success_letter.description,
|
||||||
|
TemplateDefOf.success_letter,
|
||||||
|
null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
115
flake.lock
Normal file
115
flake.lock
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-parts": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs-lib": "nixpkgs-lib"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1706830856,
|
||||||
|
"narHash": "sha256-a0NYyp+h9hlb7ddVz4LUn1vT/PLwqfrWYcHMvFB1xYg=",
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "flake-parts",
|
||||||
|
"rev": "b253292d9c0a5ead9bc98c4e9a26c6312e27d69f",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "flake-parts",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1707546158,
|
||||||
|
"narHash": "sha256-nYYJTpzfPMDxI8mzhQsYjIUX+grorqjKEU9Np6Xwy/0=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "d934204a0f8d9198e1e4515dd6fec76a139c87f0",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs-lib": {
|
||||||
|
"locked": {
|
||||||
|
"dir": "lib",
|
||||||
|
"lastModified": 1706550542,
|
||||||
|
"narHash": "sha256-UcsnCG6wx++23yeER4Hg18CXWbgNpqNXcHIo5/1Y+hc=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "97b17f32362e475016f942bbdfda4a4a72a8a652",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"dir": "lib",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1705856552,
|
||||||
|
"narHash": "sha256-JXfnuEf5Yd6bhMs/uvM67/joxYKoysyE3M2k6T3eWbg=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "612f97239e2cc474c13c9dafa0df378058c5ad8d",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-parts": "flake-parts",
|
||||||
|
"nixpkgs": "nixpkgs",
|
||||||
|
"systems": "systems",
|
||||||
|
"treefmt-nix": "treefmt-nix"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"treefmt-nix": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs_2"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1707300477,
|
||||||
|
"narHash": "sha256-qQF0fEkHlnxHcrKIMRzOETnRBksUK048MXkX0SOmxvA=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "treefmt-nix",
|
||||||
|
"rev": "ac599dab59a66304eb511af07b3883114f061b9d",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "treefmt-nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
37
flake.nix
Normal file
37
flake.nix
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
{
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||||
|
systems.url = "github:nix-systems/default";
|
||||||
|
# Dev tools
|
||||||
|
treefmt-nix.url = "github:numtide/treefmt-nix";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = inputs:
|
||||||
|
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
|
||||||
|
systems = import inputs.systems;
|
||||||
|
imports = [ inputs.treefmt-nix.flakeModule ];
|
||||||
|
perSystem = { config, self', pkgs, lib, system, ... }: {
|
||||||
|
# Rust dev environment
|
||||||
|
devShells.default = pkgs.mkShell {
|
||||||
|
inputsFrom = [ config.treefmt.build.devShell ];
|
||||||
|
nativeBuildInputs = with pkgs; [ dotnet-sdk mono libxslt ];
|
||||||
|
shellHook = ''
|
||||||
|
DOTNET_ROOT="${pkgs.dotnet-sdk}";
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
# Add your auto-formatters here.
|
||||||
|
# cf. https://numtide.github.io/treefmt/
|
||||||
|
treefmt.config = {
|
||||||
|
projectRootFile = "flake.nix";
|
||||||
|
programs = {
|
||||||
|
nixpkgs-fmt.enable = true;
|
||||||
|
csharpier.enable = true;
|
||||||
|
prettier.enable = true;
|
||||||
|
nixfmt.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue