Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xilo templates!! #100

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions docs/dev/initial-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,9 @@ This guide is roughly based on some parts of the [BepInEx setup guide](https://d
### .Net SDK {#dotnet-sdk}
An SDK (=Software Development Kit) is a system that allows you to turn your code into something that your PC can run. It is used by other tools, and you'll generally not interact with it directly.

You'll want to download and install the latest .Net 7 SDK version from [this page](https://dotnet.microsoft.com/en-us/download/dotnet/7.0). It'll look something like this:
You'll want to download and install the latest .NET SDK version from [this page](https://dotnet.microsoft.com/en-us/download). It'll look something like this:

[![.Net SDK download](/images/initial-setup/net7sdkdownload.png)](https://dotnet.microsoft.com/en-us/download/dotnet/7.0)

::: danger
The .Net 8 SDK can cause issues with the BepInEx 5 template. Until these issues are resolved, it is recommended to install .Net 7 instead of 8.
:::
[![.Net SDK download](/images/initial-setup/netsdkdownload.png)](https://dotnet.microsoft.com/en-us/download)

### IDE
By far the most important tool in a programmer's toolbox is an IDE (=Integrated Development Environment). For now, the definition of an "overengineered text editor" will suffice. Through an IDE, you can edit code far more efficiently, since it offers features such as:
Expand Down
50 changes: 34 additions & 16 deletions docs/dev/starting-a-mod.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ description: Learn how to create a basic project for a Lethal Company mod.
# Starting a mod

## Setting up your project {#setup-project}

::: warning
This guide assumes you've completed all the required steps in **[initial setup](/dev/initial-setup)**, or that you know what you're doing.
:::

This guide follows certain parts of the [official BepInEx guide](https://docs.bepinex.dev/articles/dev_guide/plugin_tutorial/2_plugin_start.html).

### Using the template repository {#using-template-repo}
### Using the template repository (Harmony Only) {#using-template-repo}

::: danger Outdated Template
The linked GitHub template repository may be **stale**. Refer to the Lethal Company Modding Discord server if you encounter issues using it.
:::
Expand All @@ -24,35 +26,51 @@ It does come with some minor drawbacks such as it using "LethalCompanyTemplate"

It is important that you remove all unused template code from the project before distributing your mod.

### Creating your project {#create-project}
### Using the dotnet template {#using-dotnet-template}
Xilophor marked this conversation as resolved.
Show resolved Hide resolved

First things first, you'll need to create your project. If you've not done so already, we recommend running the following command in a console to add some BepInEx templates for new projects:
First things first, you'll need to create your project. If you've not done so already, we recommend running the following command in a console to add some Lethal Company templates for new projects:

```cmd
dotnet new -i BepInEx.Templates --nuget-source https://nuget.bepinex.dev/v3/index.json
```shell
dotnet new -i Xilophor.LCModTemplates
```

Next, you'll want to create a new project (sometimes called "solution", in CSharp). There are two main ways to do this.

#### Using an IDE (more control) {#using-ide}
#### Using an IDE (easier) {#using-ide}

Depending on your IDE, this process will look slightly different. You'll want to give the solution the name of your soon-to-be mod. If given the option to use a template (you may want to google for *"how to use template in Visual Studio"* or *"how to use template in Rider"*), use the `BepInEx 5 Plugin Template`.
Depending on your IDE, this process will look slightly different. You'll want to give the solution the name of your soon-to-be mod. If given the option to use a template (you may want to google for *"how to use template in Visual Studio"* or *"how to use template in Rider"*), use the `Lethal Company Harmony Mod Template`.

#### Using the console (simpler) {#using-console}
#### Using the console (recommended for control) {#using-console}

Alternatively, you can open a console and run the following command, assuming you've set up the templates using the command above. Replace `MyFirstPlugin` with your mod's name:
Alternatively, you can open a console and run the following command, assuming you've set up the templates using the command above.
Replace `MyFirstMod` with your mod's name, and `MyName` with your username:

```cmd
dotnet new bepinex5plugin -n MyFirstPlugin -T "netstandard2.1" -U "2022.3.9"
```shell
dotnet new lcharmony -n MyFirstMod -M MyName.MyFirstMod
```

::: warning
Some people have been [reporting problems](https://github.com/BepInEx/BepInEx.Templates/issues/8) creating new BepInEx plugins from the template when using the .NET 8 SDK:
To see the other options provided in the mod template, you can use the following command:

```shell
dotnet new lcharmony --help
```

#### Note for MonoMod users {#monomod-template}

`Failed to create template.
Details: Object reference not set to an instance of an object.`
:::details MonoMod Template
If you want to use MonoMod, you can instead use the `Lethal Company MonoMod Mod Template` in your IDE or use `lcmonomod` instead of `lcharmony` in the console.

This template has an additional argument/setting for MonoMod specifically. In VS, it can be seen under MMHOOKLocation, and in the console, it's set with the `-MM` argument.
This argument/setting is to set the MMHOOK directory to use for hooking (i.e. the HookGen "plugin").

Without changing this setting, you will have to manually hook instead of using the `On.Class.Method += CustomMethod;` style provided by HookGen.

Example command line usage with a path of `C:\path\to\r2modman\LethalCompany\profiles\test\BepInEx\plugins\MMHOOK\`:

```shell
dotnet new lcmonomod -n MyFirstMod -M MyName.MyFirstMod -MM "C:\path\to\r2modman\LethalCompany\profiles\test\BepInEx\plugins\MMHOOK"
```

If you get this error, try downgrading to the [.NET 7 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/7.0).
:::

### Organising your modding projects {#organize-project}
Expand Down
Binary file removed docs/public/images/initial-setup/net7sdkdownload.png
Binary file not shown.
Binary file modified docs/public/images/initial-setup/netsdkdownload.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.