Skip to content

Latest commit

 

History

History
240 lines (204 loc) · 4.54 KB

File metadata and controls

240 lines (204 loc) · 4.54 KB

API-REST-RimwOrld-Mod

ARROM is a mod that give you an API useable for your current rimworld game

ARROM exposes a small REST API from inside RimWorld. The API listens on http://localhost:8765/ by default once the game reaches the main menu. The port can be changed in the mod settings.

Usage

  1. Start RimWorld with the mod enabled. When the main menu loads the API server will begin listening.
  2. The default address is http://localhost:8765/. You can change the port from the ARROM mod settings.
  3. Use any HTTP client (curl, Postman, etc.) to call the endpoints.

Example:

curl http://localhost:8765/colony

This returns a JSON summary of your colony.

Endpoints

  • /colony summary information about the current colony
  • /letters recent in-game letters
  • /colonists list of free colonists
  • /colonists/<id> detail about a specific colonist
  • /mods list of loaded mods
  • /factions relations with other factions
  • /research current research project and finished list
  • /buildings list colony buildings (filter with ?type=)
  • /map current map status (weather, temperature...)
  • /animals animals owned by the colony
  • /storage stockpiles and storage contents
  • /alerts active alerts
  • /jobs colonist jobs and queues
  • /map/tiles list of all map tile coordinates
  • /map/tiles/<x>/<y> details of a map tile

Endpoint details

/colony

Returns basic information about the currently loaded colony:

{
  "colonyName": "Colony name",
  "colonistCount": 3,
  "wealth": 12345.0
}

/letters

List of recent letters shown in game:

[
  {
    "label": "Raid!",
    "type": "NegativeEvent",
    "arrivalTime": 123456.0
  }
]

/colonists

Summary for all free colonists on the current map:

[
  {
    "id": 1,
    "name": "Pawn",
    "age": 24,
    "gender": "Male",
    "position": { "x": 0, "y": 0 },
    "mood": 75.0,
    "health": 1.0,
    "currentJob": "CutPlant",
    "traits": ["Industrious"],
    "workPriorities": [
      { "workType": "Doctor", "priority": 2 }
    ]
  }
]

/colonists/<id>

Detailed data for a single colonist including needs, skills and inventory:

{
  "id": 1,
  "name": "Pawn",
  "backstory": "Colony settler",
  "gender": "Male",
  "age": 24,
  "lifeStage": "Adult",
  "mood": 75.0,
  "needs": [ { "need": "Food", "level": 80.0 } ],
  "health": 1.0,
  "hediffs": [],
  "bleedingRate": 0.0,
  "isDowned": false,
  "isDrafted": false,
  "currentJob": "CutPlant",
  "skills": [ { "skill": "Plants", "level": 6, "passion": "None" } ],
  "equipment": [],
  "apparel": [],
  "inventory": [],
  "relations": []
}

/mods

List of all currently loaded mods:

[
  { "name": "Core", "packageId": "Ludeon.RimWorld" }
]

/factions

List of non-player factions and their relation to the colony:

[
  {
    "name": "Pirates",
    "def": "Pirate",
    "relation": "Hostile",
    "goodwill": -100
  }
]

/research

Current research progress and completed projects:

{
  "currentProject": "Hydroponics",
  "progress": 0.25,
  "finishedProjects": ["Stonecutting"]
}

/buildings

Returns the colony buildings. You can filter by type with ?type=:

[
  { "id": 1, "def": "Battery", "position": { "x": 10, "y": 5 } }
]

/map

Information about the current map:

{
  "weather": "Rain",
  "temperature": 22.5,
  "hour": 13,
  "season": "Summer"
}

/animals

List of colony animals:

[
  {
    "id": 3,
    "name": "Muffalo",
    "def": "Muffalo",
    "position": { "x": 5, "y": 30 },
    "trainer": 1,
    "trainings": { "Tameness": 3 },
    "pregnant": false
  }
]

/storage

Content of stockpiles and storage buildings:

[
  {
    "name": "Stockpile Zone 1",
    "items": { "Steel": 75, "WoodLog": 100 }
  }
]

/alerts

Active in-game alerts:

[
  { "label": "Need colonist beds", "priority": "High" }
]

/jobs

Current job and queued jobs for each colonist:

[
  {
    "id": 1,
    "name": "Pawn",
    "current": "CutPlant",
    "queue": ["Haul", "Research"]
  }
]

/map/tiles

List all map tile coordinates:

[
  { "x": 0, "y": 0 },
  { "x": 0, "y": 1 }
]

/map/tiles/<x>/<y>

Detail about a single map tile:

{
  "terrain": "Soil",
  "zone": "Growing Zone",
  "things": ["PlantPotato"]
}

Contributions

All contributions are welcome — forks, pull requests, and ideas are appreciated. If you reuse my work outside of this repository, please make sure to follow the MIT License and keep the original copyright notice.