Contributing to RIMAPI¶
Thank you for your interest in contributing to RIMAPI! This guide provides everything you need to know to contribute code, documentation, or ideas to the project. Your contributions help make RIMAPI a more powerful tool for the RimWorld community.
Ways to Contribute¶
- Code: Implement new features, fix bugs, or improve performance.
- Documentation: Enrich our guides, add examples, or fix typos. Every clarification helps.
- Testing: Help us find and squash bugs by testing new features in-game.
- Feature Ideas: Suggest new functionality or improvements by opening an issue.
- Community Support: Assist other users in GitHub Discussions or on Discord.
Getting Started: Your First Contribution¶
Prerequisites¶
- A licensed copy of RimWorld (1.5 or later).
- An IDE for .NET development:
- Visual Studio: Install the
.NET desktop developmentworkload. - VSCode: Install the
C# Dev Kitextension (ms-dotnettools.csdevkit).
- Visual Studio: Install the
- The .NET Framework 4.8 Developer Pack (or the version targeted by the project).
- Git for version control.
Development Setup¶
-
Fork & Clone:
- Fork the repository on GitHub to create your own copy.
- Clone your fork to your local machine:
git clone https://github.com/Your-Username/RIMAPI.git cd RIMAPI
-
Configure RimWorld Path:
- The project needs to know where your RimWorld installation is to reference its assemblies.
- Locate the
Source/Directory.Build.propsfile. - Update the
<RimWorldPath>property to point to your RimWorld installation directory.
-
Build the Project:
- Open the
Source/RimApi.slnsolution in your IDE. - Build the solution to ensure all dependencies are resolved and the project compiles correctly.
- Open the
-
Create a Feature Branch:
- Create a new branch for your changes. This keeps the
mainbranch clean.git checkout -b feature/your-awesome-feature
- Create a new branch for your changes. This keeps the
Creating a New Endpoint¶
Adding a new endpoint is a great way to start contributing. We have a detailed, step-by-step guide for this.
- Read the Creating Endpoints guide to learn about the architecture and the process from DTO creation to controller implementation.
Development Workflow¶
Coding & Architecture Standards¶
- Follow Existing Patterns: Strive for consistency with the existing codebase.
- Controllers are Thin: Controllers should only parse requests and return responses. All business logic belongs in the service layer.
- Services Coordinate, Helpers Execute: Services orchestrate the workflow, while helpers mostly contain reusable code.
- Use DTOs: Never expose RimWorld's internal types in an API response. Map all data to Data Transfer Objects (DTOs) in the
Modelsdirectory.
Testing Your Changes¶
Before submitting your contribution, please test it thoroughly:
- The mod loads in RimWorld without errors.
- The API server starts up correctly.
- Your new endpoint responds with the correct data and status codes.
- Run a quick check on a few existing endpoints to ensure you haven't introduced any regressions.
- Error handling works as expected (e.g., providing an invalid ID).
Updating Documentation¶
Accurate documentation is as important as the code itself.
- If you add or modify an endpoint, you must update the documentation in
docs/_endpoints_examples/examples.yml. - If you add a major new feature, create or update a corresponding guide in the
docs/directory.
Submitting a Pull Request¶
-
Push to Your Fork:
git push origin feature/your-awesome-feature -
Open a Pull Request:
- Go to the original RIMAPI repository on GitHub.
- Click "New Pull Request" and select your feature branch.
- Fill out the pull request template, explaining what your PR does and how you tested it.
Getting Help¶
- GitHub Discussions: For questions, ideas, and general feedback.
- GitHub Issues: To report a bug or request a specific feature.
- Discord: Join the official RimWorld Modding Discord for real-time help in the
#rimapichannel.