Skip to content

Commit c04d8bf

Browse files
authored
Merge pull request #36 from IlyaChichkov/develop
Develop v1.5.0
2 parents 3984cb8 + 88d0901 commit c04d8bf

28 files changed

Lines changed: 1266 additions & 55 deletions

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"isRoot": true,
44
"tools": {
55
"csharpier": {
6-
"version": "1.4.1",
6+
"version": "1.5.0",
77
"commands": [
88
"csharpier"
99
],

About/About.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<description>RIMAPI is a mod that give you an REST API useable for your current game</description>
55
<packageId>RedEyeDev.RIMAPI</packageId>
66
<author>RedEyeDev</author>
7-
<modVersion>1.4.1</modVersion>
7+
<modVersion>1.5.0</modVersion>
88
<url></url>
99
<supportedVersions>
1010
<li>1.5</li>

About/Manifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
22
<Manifest>
33
<identifier>redeyedev.rimapi</identifier>
4-
<version>1.4.1</version>
4+
<version>1.5.0</version>
55
<manifestUri>
66
https://raw.githubusercontent.com/IlyaChichkov/RIMAPI/refs/heads/main/About/Manifest.xml</manifestUri>
77
<downloadUri>https://github.com/IlyaChichkov/RIMAPI/releases</downloadUri>

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,25 @@
11
# Changelog
2+
## v1.5.0
3+
4+
Impliment API server launch at game menu screen (previously lauched when game map loaded).
5+
6+
Fix GetColonist, GetColonistDetailed output when colonist with Id not found to display error.
7+
8+
Add new endpoints:
9+
10+
[POST] /api/v1/item/spawn
11+
[POST] /api/v1/game/save
12+
[POST] /api/v1/game/load
13+
[POST] /api/v1/game/start/devquick
14+
[POST] /api/v1/game/start
15+
[GET] /api/v1/game/settings
16+
17+
Update README.
18+
19+
## v1.4.1
20+
21+
Fix UI blinking during texture make readable
22+
223
## v1.4.0
324

425
Author: IlyaChichkov

README.md

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,33 @@
1-
![alt text](About/preview.png)
1+
![alt text](../media/media/banner_title.jpg)
22

33
![Status](https://img.shields.io/badge/Status-In_Progress-blue.svg)
44
![RimWorld Version](https://img.shields.io/badge/RimWorld-v1.5+-blue.svg)
55
![API Version](https://img.shields.io/badge/API-v0.1.0-green.svg)
66
![Build](https://github.com/IlyaChichkov/RIMAPI/actions/workflows/release_build.yml/badge.svg)
77
![Release](https://img.shields.io/github/v/release/IlyaChichkov/RIMAPI)
88

9-
# RIMAPI
9+
# RimAPI
1010

11-
RIMAPI is a RimWorld mod that gives you an API Server to interact with your current game.
11+
It's a RimWorld mod that gives you an API Server to interact with the game.
1212

13-
RIMAPI exposes a comprehensive REST API from inside RimWorld.
13+
RimAPI exposes a comprehensive REST API from inside RimWorld.
1414
The API listens on `http://localhost:8765/` by default once the
15-
game reaches the main menu. The port can be changed in the mod settings.
16-
17-
[ Documentation ](https://ilyachichkov.github.io/RIMAPI/index.html)|
18-
[ Discord Server ](https://discord.gg/Css9b9BgnM)
15+
game reaches the main menu.
16+
17+
<table>
18+
<tr>
19+
<td align="center">
20+
<a href="https://ilyachichkov.github.io/RIMAPI/index.html" target="_blank">
21+
<img src="../media/media/banner_documentation.jpg" alt="Documentation" width="520"/>
22+
</a>
23+
</td>
24+
<td align="center">
25+
<a href="https://discord.gg/Css9b9BgnM" target="_blank">
26+
<img src="../media/media/banner_discord.jpg" alt="Discord Server" width="520"/>
27+
</a>
28+
</td>
29+
</tr>
30+
</table>
1931

2032
## 🚀 Features
2133

@@ -34,20 +46,22 @@ game reaches the main menu. The port can be changed in the mod settings.
3446
- **ETag support** - Intelligent caching with 304 Not Modified responses
3547
- **Non-blocking operations** - Game non-blocking API operations
3648

37-
## 🔍 Integrations
49+
![alt text](../media/media/banner_get_colonist.jpg)
3850

39-
Share your projects - send integrations to be featured here
51+
## 🔍 Integrations
4052

41-
| Name | Link |
42-
|--- |--- |
43-
|Rimworld Dashboard | https://github.com/IlyaChichkov/rimapi-dashboard |
44-
|Food Analysis Script (Python) | https://gist.github.com/IlyaChichkov/1c4455c9f797a277693ee5a3e016ac3d |
53+
Share your projects - send integrations on discord server
4554

4655
## 🛠️ Usage
56+
4757
1. Start new RimWorld game or load one from saves with the mod enabled. When game map is loaded the API server will begin listening.
4858
2. The default address is `http://localhost:8765/`. You can change the port from the RIMAPI mod settings.
4959
3. Use any HTTP client (curl, Postman, etc.) to call the endpoints.
5060

61+
> More information in the documentation.
62+
63+
![alt text](../media/media/banner_post_edit_pawn.jpg)
64+
5165
## 📄 License
5266
This project is licensed under the GNU GPLv3 License - see the [LICENSE](https://github.com/IlyaChichkov/RIMAPI/blob/main/LICENSE) file for details.
5367

Source/RIMAPI/RIMAPI_GameComponent.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,13 @@ public RIMAPI_GameComponent(Game game)
1818
public override void FinalizeInit()
1919
{
2020
base.FinalizeInit();
21-
StartServer();
2221

2322
GameObject go = new GameObject("MyTextureExporter");
2423
go.AddComponent<TextureExportManager>();
2524
UnityEngine.Object.DontDestroyOnLoad(go);
2625
}
2726

28-
public void StartServer()
27+
public static void StartServer()
2928
{
3029
lock (_serverLock)
3130
{
@@ -84,13 +83,22 @@ public static IRimApiExtension GetExtension(string extensionId)
8483
return _serverInitialized ? _apiServer?.GetExtension(extensionId) : null;
8584
}
8685

87-
public void RestartServer()
86+
public static void RestartServer()
8887
{
8988
Log.Message("Restarting API server...");
9089
Shutdown();
9190
StartServer();
9291
}
9392

93+
public static void ProcessServerQueues()
94+
{
95+
if (!_serverInitialized || _apiServer == null)
96+
return;
97+
98+
_apiServer.ProcessQueuedRequests();
99+
_apiServer.ProcessBroadcastQueue();
100+
}
101+
94102
public override void GameComponentTick()
95103
{
96104
base.GameComponentTick();

Source/RIMAPI/RIMAPI_Mod.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,7 @@ public override void DoSettingsWindowContents(Rect inRect)
5555

5656
if (list.ButtonText("RIMAPI.RestartServer".Translate()))
5757
{
58-
RIMAPI_GameComponent component = Current.Game.GetComponent<RIMAPI_GameComponent>();
59-
if (component != null)
60-
{
61-
component.RestartServer();
62-
}
58+
RIMAPI_GameComponent.RestartServer();
6359
}
6460

6561
bool tempEnableLogging = Settings.EnableLogging;

Source/RIMAPI/RIMAPI_Settings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace RIMAPI
55
{
66
public class RIMAPI_Settings : ModSettings
77
{
8-
public string version = "1.4.1";
8+
public string version = "1.5.0";
99
public string apiVersion = "v1";
1010
public int serverPort = 8765;
1111
public int refreshIntervalTicks = 300;

Source/RIMAPI/RIMAPI_Startup.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using Verse;
2+
using RIMAPI.Core;
3+
4+
namespace RIMAPI
5+
{
6+
[StaticConstructorOnStartup]
7+
public static class RIMAPI_Startup
8+
{
9+
static RIMAPI_Startup()
10+
{
11+
RIMAPI_GameComponent.StartServer();
12+
}
13+
}
14+
}

Source/RIMAPI/RimApi.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<RootNamespace>RIMAPI</RootNamespace>
77
<AssemblyName>RIMAPI</AssemblyName>
88
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
9-
<Version>1.4.1</Version>
9+
<Version>1.5.0</Version>
1010
</PropertyGroup>
1111

1212
<!-- Conditional properties for RimWorld 1.5 -->

0 commit comments

Comments
 (0)