diff --git a/README.md b/README.md index 0ac944d..8d336da 100644 --- a/README.md +++ b/README.md @@ -1,93 +1,20 @@ -# Lethal Company Mod Template +# Launch Confirm +A BepInEx plugin for Lethal Company that adds a confirmation dialog when launching the game, to prevent accidental launches. -Thank you for using the mod template! Here are a few tips to help you on your journey: +![warning message](./media/notification.png) -## Versioning +## Features +- Confirmation dialog when trying to launch the ship without pulling the apparatus. +- Works even if you have multiple apparatuses form previous rounds in the ship. -BepInEx uses [semantic versioning, or semver](https://semver.org/), for the mod's version info. -To increment it, you can either modify the version tag in the `.csproj` file directly, or use your IDE's UX to increment the version. Below is an example of modifying the `.csproj` file directly: +## Thunderstore / R2ModManager Installation (TODO actually upload mod to thunderstore.) +1. Open Thunderstore or R2ModManager and select your lethal company profile. +2. Switch to the "Online" tab and search for "Launch Confirm". +3. Click on the plugin and then click "Install". +4. Launch the game using the "Start Modded" button. -```xml - - - HerpieDerpiee.LaunchConfirm - LaunchConfirm - - 1.0.0 - -``` - -Your IDE will have the setting in `Package` or `NuGet` under `General` or `Metadata`, respectively. - -## Logging - -A logger is provided to help with logging to the console. -You can access it by doing `Plugin.Logger` in any class outside the `Plugin` class. - -***Please use*** `LogDebug()` ***whenever possible, as any other log method -will be displayed to the console and potentially cause performance issues for users.*** - -If you chose to do so, make sure you change the following line in the `BepInEx.cfg` file to see the Debug messages: - -```toml -[Logging.Console] - -# ... # - -## Which log levels to show in the console output. -# Setting type: LogLevel -# Default value: Fatal, Error, Warning, Message, Info -# Acceptable values: None, Fatal, Error, Warning, Message, Info, Debug, All -# Multiple values can be set at the same time by separating them with , (e.g. Debug, Warning) -LogLevels = All -``` - -## Harmony - -This template uses harmony. For more specifics on how to use it, look at -[the HarmonyX GitHub wiki](https://github.com/BepInEx/HarmonyX/wiki) and -[the Harmony docs](https://harmony.pardeike.net/). - -To make a new harmony patch, just use `[HarmonyPatch]` before any class you make that has a patch in it. - -Then in that class, you can use -`[HarmonyPatch(typeof(ClassToPatch), "MethodToPatch")]` -where `ClassToPatch` is the class you're patching (ie `TVScript`), and `MethodToPatch` is the method you're patching (ie `SwitchTVLocalClient`). - -Then you can use -[the appropriate prefix, postfix, transpiler, or finalizer](https://harmony.pardeike.net/articles/patching.html) attribute. - -_While you can use_ `return false;` _in a prefix patch, -it is **HIGHLY DISCOURAGED** as it can **AND WILL** cause compatibility issues with other mods._ - -For example, we want to add a patch that will debug log the current players' position. -We have the following postfix patch patching the `SwitchTVLocalClient` method -in `TVScript`: - -```csharp -using HarmonyLib; - -namespace LaunchConfirm.Patches; - -[HarmonyPatch(typeof(TVScript))] -public class ExampleTVPatch -{ - [HarmonyPatch("SwitchTVLocalClient")] - [HarmonyPrefix] - private static void SwitchTvPrefix(TVScript __instance) - { - /* - * When the method is called, the TV will be turning off when we want to - * turn the lights on and vice-versa. At that time, the TV's tvOn field - * will be the opposite of what it's doing, ie it'll be on when turning off. - * So, we want to set the lights to what the tv's state was - * when this method is called. - */ - StartOfRound.Instance.shipRoomLights.SetShipLightsBoolean(__instance.tvOn); - } -} -``` - -In this case we include the type of the class we're patching in the attribute -before our `ExampleTVPatch` class, -as our class will only patch the `TVScript` class. +## Manual Installation +1. Clone this repository into a temporary location. +2. Open the folder in your terminal and run `dotnet build` to build the plugin. +3. Copy the generated `LaunchConfirm.dll` from the `bin/Release` folder to your BepInEx plugins directory. +4. Launch the game, and you should see a confirmation dialog when you try to launch it. \ No newline at end of file diff --git a/Release/HerpieDerpiee.LaunchConfirm.dll b/Release/HerpieDerpiee.LaunchConfirm.dll new file mode 100644 index 0000000..f3e9041 Binary files /dev/null and b/Release/HerpieDerpiee.LaunchConfirm.dll differ diff --git a/Release/LaunchConfirm.zip b/Release/LaunchConfirm.zip new file mode 100644 index 0000000..7b33710 Binary files /dev/null and b/Release/LaunchConfirm.zip differ diff --git a/Release/README.md b/Release/README.md new file mode 100644 index 0000000..2ae2012 --- /dev/null +++ b/Release/README.md @@ -0,0 +1,18 @@ +# Launch Confirm +A BepInEx plugin for Lethal Company that adds a confirmation dialog when launching the game, to prevent accidental launches. + +## Features +- Confirmation dialog when trying to launch the ship without pulling the apparatus. +- Works even if you have multiple apparatuses form previous rounds in the ship. + +## Thunderstore / R2ModManager Installation +1. Open Thunderstore or R2ModManager and select your lethal company profile. +2. Switch to the "Online" tab and search for "Launch Confirm". +3. Click on the plugin and then click "Install". +4. Launch the game using the "Start Modded" button. + +## Manual Installation +1. Clone this repository into a temporary location. +2. Open the folder in your terminal and run `dotnet build` to build the plugin. +3. Copy the generated `LaunchConfirm.dll` from the `bin/Release` folder to your BepInEx plugins directory. +4. Launch the game, and you should see a confirmation dialog when you try to launch it. \ No newline at end of file diff --git a/Release/icon.png b/Release/icon.png new file mode 100644 index 0000000..1a1d722 Binary files /dev/null and b/Release/icon.png differ diff --git a/Release/manifest.json b/Release/manifest.json new file mode 100644 index 0000000..ac20c14 --- /dev/null +++ b/Release/manifest.json @@ -0,0 +1,9 @@ +{ + "name": "LaunchConfirm", + "version_number": "1.0.1", + "description": "Add a warning on the pull lever, to prevent launching the ship without pulling the apparatus.", + "website_url": "https://git.herpiederpiee.nl/valentijn/LethalCompany-ApperatusConfirmation", + "dependencies": [ + "BepInEx-BepInExPack-5.4.2100" + ] +} \ No newline at end of file diff --git a/media/api.png b/media/api.png new file mode 100644 index 0000000..642d509 Binary files /dev/null and b/media/api.png differ diff --git a/media/notification.png b/media/notification.png new file mode 100644 index 0000000..3c5af4b Binary files /dev/null and b/media/notification.png differ