Skip to content
/ rimworld-mod-template Public template

A rimworld modding template for my own personal projects

License

Notifications You must be signed in to change notification settings

Caaz/rimworld-mod-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

99 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rimworld Mod Template

Welcome to Caaz's rimworld mod template. This is a simple repo anyone should be able to use to get started rimworld modding.

Goals

As a rimworld modder, I'd like to be able to get up and running with as little boilerplate as possible. I don't enjoy XML as a markup language (or any thing that looks like that), so that's been replaced with pug. Additionally, I don't enjoy keeping track of versions, so there will be one source of truth.

Features

  • Automatic uploading to Steam Workshop, and creating of github releases!
  • automatic building of the mod for pull requests, to ensure code works before it gets released.
  • Reasonable gitignore
  • Made for VSCode
  • Uses Krafs.Rimworld.Ref for Rimworld's Reference Assemblies
  • Includes (but doesn't require) Hugslib and Harmony.
  • Has a Github action for building the mod on the main branch.
  • Has a metadata.json for including variables that get used in pug, gitlab actions, and the csproj file.
  • Has a bit of a Getting Started section!

Getting Started

So, you want to mod like Caaz?

  1. Use this template
    • This will create a repository on your account, using the same files and folder structure I do.
  2. Clone the resulting repo...
  3. Edit your metadata.json! That holds all the relevant information for your mod, in one spot! This includes the name of the project, the version, author data. Things you might expect in About.xml, but since they're variables, you can use them in other areas of the pug templates. See the metadata section for more details.

Metadata

Environments

metadata.json Allows you to define environment variables depending on how you build. This allows you to built the project in development mode, with some variables tweaked.

Reasoning

One of my personal pain points in modding has been wanting a single place to hold information for the mod. For example, if you wanted to put features behind some defs behind feature flags, you could do something like...

if featureFlag
  ThingDef
    label top_secret_def

These variables are usable in the pug templates, simply by using them as you would any other variable. In the About.pug for example, we reference the name with:

doctype xml
ModMetaData
  name=name

This allows us to set the name once and reference it in other places as well. You're free to fill metadata.json with whatever variables you may find handy, and use them across all of your pug files.

Variables used by default

These variables are currently being used by the mod template's pug files.

  • name
    • The name of the mod, used in About.pug. eg. ``My Cool Mod`
    • The build github action always uses the name found in default, so be aware of that.
  • author
    • A comma seperated list of authors that have worked on the mod. Used in About.pug. eg. Me, Myself, and I
  • description
    • A description used in About.pug. eg. A pretty neat mod template.
  • version
    • The version of the assembly. Used in csproj.pug. eg. 1.0.0.1
  • packageId
    • The package ID of the mod. Used in About.pug eg. my.mod.template
  • namespace
  • assemblyName
    • The assembly output name. It's the filename of the .dll the C# builds to. And here, it's also used for the filename of the .csproj. eg. MyMod

Building the Mod

npm run build will build the pug, and then build the DLL file. It's that simple!

About

A rimworld modding template for my own personal projects

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published