diff --git a/CODING_STANDARDS.md b/CODING_STANDARDS.md index feff7812..81b83eea 100644 --- a/CODING_STANDARDS.md +++ b/CODING_STANDARDS.md @@ -3,6 +3,9 @@ While I don't want to be overly-strict on coding style, there are specific stand The standards in place aren't meant to cause headache. They are to keep the project consistent and predictable. +## General Best Practice +* Please review the codebase thoroughly before doing a PR. + ## File and Namespace Structure * All classes must exist in a logical namespace matching the folder structure. * Internal API code should be placed in `S1API.Internal` sub-namespaces. @@ -11,6 +14,8 @@ namespace S1API.Internal.Utils { ... } ``` ## Naming Conventions +These are purely based on my preference. +Feel free to discuss with me if you feel otherwise. * In general, naming follows the default Jetbrains Rider suggestions. * **PascalCase** is to be utilized for class names, methods, properties, and non-private fields. * **camelCase** is to be used for local variables and private fields. @@ -19,15 +24,30 @@ namespace S1API.Internal.Utils { ... } private int _myInteger; public float AddFloats(float floatOne, float floatTwo) => ... ``` +* Enums do not need to be prefixed with `E`. I'd like us to keep this consistent. +* Utilize existing common naming conventions from the codebase. + I don't want to see `SomeManager`, `SomeHandler`, `SomeSystem`, etc. throughout this codebase. + See what is already in use naming-wise, and commit to it like everyone else. ## Access Modifiers * Internal classes must be marked as `internal` to prevent confusion for modders. * Modder-facing API classes, methods, properties, and fields should use `public`. +* The exception to this rule is when you want a property available for abstraction by modders, but not publicly accessible. + * An example of this is the `NPC.cs`. We utilize the `protected` access modifier to allow them to override, but not access from outside the class. ```C# public static string GenerateString(int length) { ... } ``` * Explicit usage of access methods at all times. * Arrow functions (`=>`) are used for simple methods and properties. They are to be placed below the declaration and indented once. +```C# +// property example +public string Name => + S1NPC.FullName; + +// method example +public float AddNumbers(float a, float b) => + a + b; +``` * Use `readonly` or `const` for immutable values. * Nullable variables should be declared as so using `?`. @@ -39,13 +59,15 @@ public static string GenerateString(int length) { ... } /// public void DestroyGameWorld() { ... } ``` +* This is now enforced and **will** produce build warnings. Please keep your code documented. ## Conditional Build Compilation -* Use `#if (MONO)` and `#elif (IL2CPP)` for platform-specific logic. -* Wrap and alias `using` statements to provide platform-agonstic support. +* Use `#if (MONOMELON || MONOBEPINEX)` and `#elif (IL2CPPBEPINEX || MONOBEPINEX)` for platform-specific logic. +* Wrap and alias `using` statements to provide platform-agnostic support. ## What **NOT** to Do -* Do not leak Il2Cpp types across the API. -* Utilize `CrossType` helper methods when possible instead of repeating logic. -* \ No newline at end of file +* Do not leak Il2Cpp types across the API. + The API is intended to leave the modder in the native C# `System` environment. +* Utilize the tools present in our `Internal` namespace. + They are there because we've collectively agreed on a better solution to a common problem. \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6837d66f..d9380c58 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,11 +3,34 @@ Welcome potential contributor! I appreciate your interest in this project. Please read over the below in full to help you get started and set expectations 😊 +## Important!!! +- Please thoroughly read over [CODING_STANDARDS.md](CODING_STANDARDS.md) before contributing. +- Do **NOT** alter my GitHub actions unless you have a good reason. + I will close your PR and ban you from the project if malicious intent is found. + ## How to Build the Project -[This section needs filled out.] +1. Clone the project using `git clone https://github.com/KaBooMa/S1API` +2. Copy the `example.build.props` file to a new file named `local.build.props`. This file located in the base repository directory. +3. Update all properties in `local.build.props` to proper paths for your local system. + - Personally, I have four copies of Schedule I locally. This way I can test all four builds independently. + You can swap between just one if you switch. It will just be a bit more of a hassle 😊. +4. If you're using a light IDE / editor, you will need to manually restore packages. + `dotnet restore` should get this done for you. + - You also will need to manually build in this case. This is as simple as `dotnet build ./S1API.sln`. + - If you need to build just for `netstandard2.1` or `net6.0`, you can do so using `dotnet build ./S1API.sln -f netstandard2.1`. -## Proper Contributing Channels -[This section needs filled out.] +## PR Preparations +Verify your changes will successfully build for all **four** build configurations prior to PR please. +Regardless, we have a GitHub action that will verify proper build before commit to `bleeding-edge`. +Ultimately, this just saves you time and gets your changes into the API faster. -## Understanding the Coding Standards -Please thoroughly read over [CODING_STANDARDS.md](CODING_STANDARDS.md) before contributing. \ No newline at end of file +| Build Type | Description | +|---------------|------------------------------------------------| +| Il2CppMelon | MelonLoader for Il2Cpp (base game) builds | +| Il2CppBepInEx | BepInEx 6.0 for Il2Cpp (base game) builds | +| MonoMelon | MelonLoader for Mono (alternate branch) builds | +| MonoBepInEx | MelonLoader for Mono (alternate branch) builds | + +## Proper Contributing Channels +All pull requests **must** go into `bleeding-edge` before `stable`. +If you make a pull request for `stable`, I **will** be changing it to verify build. \ No newline at end of file diff --git a/Public/README.md b/Public/README.md index fe3cf098..3168ecbb 100644 --- a/Public/README.md +++ b/Public/README.md @@ -7,16 +7,24 @@ The goal is to provide a standard place for common functionalities so you can fo ## Do I need this? If you're using or plan to use any mods that depend on S1API, then yes. +## How do I manually install this mod? +Installation is pretty straight-forward. +- Download the ZIP file from Nexus Mods or Thunderstore. +- Extract all files locally so you have them in a folder. +- Copy the `Plugins/` and `Mods/` folder into your `Schedule I` folder. + - This is typically found under `C:\Program Files (x86)\Steam\steamapps\common\Schedule I\` + +**To uninstall, remove the associated plugins and mods files from the respective directories.** + ## How do I use this to make mods? Go check out the extremely helpful resources on our [GitHub](https://github.com/KaBooMa/S1API). ## I'm getting errors from S1API, what do I do? Please head over to the [GitHub](https://github.com/KaBooMa/S1API) page and create a new issue for us. -You can also post in the modding Discord under our thread 😀. +This helps us keep track of what problems people are experiencing! ___ # Drop us an endorsement ❤️ - It's not easy being an API. Content is always king, not the backend glue! Endorsements are free and really helps drive our motivation for this project. \ No newline at end of file diff --git a/README.md b/README.md index 25574929..9eca7784 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,8 @@ The goal is to provide a standard place for common functionalities so you can fo ## How It's Designed to Work S1API is designed to compile for Mono and Il2Cpp separately. -Mod users install the version applicable to they're preferred build. +Mod users don't need to worry about this though. +The standard installation ships with all builds and a plugin to dynamically load the proper version! Mod developers can develop their mods on whichever build, Mono or Il2Cpp, without having to step into the Il2Cpp environment. Caveat: If you do utilize Il2Cpp functionality within your mod, you lose cross compatibility.