This page is meant to be a resource for information about creating mods for SimpleRockets 2. It is a work in progress so please bear with us as we continue adding additional content and refine the page.

With the 0.7.2 release, official mod support is finally here! The initial release of mod support focused primarily on the core modding framework, part creation, and some UI related modding. The goal is to continue to add additional support and features over time. The most notable thing we did not do for this release is planet modding. With the planet builder on the horizon, we held off on planet related modding for now since we are not yet sure how planet builder related changes would impact things. You are still welcome to experiment with it, but just be aware that things may change in the future.

Getting Started

Mod Tutorial: Getting Started
Mod Tutorial: Custom Parts
Mod Tutorial: Rocket Engines
Mod Tutorial: UI Basics
Mod Tutorial: Inspector Panels

FAQ

What is up with all these assemblies in the mod tools? Should I only use the ModApi namespace?

When we first started SimpleRockets 2, we started with the same modding framework we used in SimplePlanes. All interaction with the game was done via a few SimplePlanes mod tools assemblies and more advanced mods needed to use lots of reflection to access anything in the core game assembly. During the development of SR2, a few Unity updates really opened the doors and allowed us to take things to the next level (while also simplifying implementaion). To give modders as much control as possible while avoiding painful reflection-based code, we have included most of the game's assemblies in the mod tools package for use by modders. Because of this, there was no longer a technical need for a modding API separated out into its own assembly, however we were way too far down this path when these changes were made, so it's here to stay. We recommend trying do most stuff via the ModApi namespace (may be more stable between updates), but if you want to do some advanced stuff, by all means, access whatever you need from wherever you need it.

Will the Steam Workshop be supported?

The game does not currently support the Steam Workshop but it is something that we are considering.

There is no API method/event to do what I want to do. Can you add it?

Maybe, please ask! We would love to help, but we can't always predict what you may want or need. Let us know what exactly you need and we can see what we can do to help.


Comments

  • Log in to leave a comment
  • Profile image
    3,494 vghfr

    Will there ever be a documentation site for all the assemblies and stuff?

    +1 2.2 years ago
  • Profile image
    212 Altius

    Thanks a lot!!!!

    3.5 years ago
  • Profile image
    Dev Pedro

    @Azamwasgamingnowismakinggames @NathanMikeska there's this old tutorial by @XxxNico420xxX, not sure if it's 100% up to date.

    3.8 years ago
  • Profile image
    106 Azam

    @NathanMikeska Thanks for the reply :)

    3.8 years ago
  • Profile image

    @Azamwasgamingnowismakinggames Custom parts are supported. We don't have a tutorial, but there is some documentation in the mod tools project. Also, some of the mods posted in the mod section have links to source code that may help.

    3.8 years ago
  • Profile image
    106 Azam

    What About Custom Parts?

    3.8 years ago
  • Profile image

    @Mrmaraunet You might need to do a combination of the two. Some crafts that are loaded in the scene have not written their XML to file yet, so the LoadCraftXml method would throw an exception. You should probably attempt to use the craftNode.CraftScript property, and if it is null, then try loading XML via _flightState.LoadCraftXml (craftNode.NodeId);

    Completely untested, but it might work.

    4.1 years ago
  • Profile image
    21.4k AramL

    Hi @AndrewGarrison, for one of my mod project I need to get a list of all the parts in every craft in the flight scene to find wich crafts have a specific part. I've tried many different things and asked Nathan for some help but nothing really worked. What do you think would be the best way to achieve that? I've tried to load each craft xml with

    craftXml = _flightState.LoadCraftXml (craftNode.NodeId);

    and then looping through each part

    foreach (XElement element in craftXml.Element ("Assembly").Element
    ("Parts").Elements ()) {

    but when I launched a craft this craft xml wouldn't load (image 1) I had to quit and resume the flight for it to work. Then I tried using

    foreach (PartData part in craftNode.CraftScript.Data.Assembly.Parts) {

    I think for this to work the craft has to be loaded but even then, loaded or not it just doesn't find the CraftScript or CraftData (image 2). I also tried to have some delay between the flight scene start and the time I try to access the parts but it doesn't change anything. Btw I find the craftnode with

    foreach (CraftNode craftNode in _flightState.CraftNodes) {

    Here are the scripts

    4.1 years ago
  • Profile image
    10.2k Sibonitro

    @pedro16797 OK

    4.1 years ago
  • Profile image
    Dev Pedro

    @sujun you should upload it with the new method, uploading it in mod posts will soon be deprecated

    4.1 years ago
  • Profile image
    10.2k Sibonitro

    @pedro16797 Yes, I know, but uploading my solar system works to the mod post requires the sr2-mod file

    4.1 years ago
  • Profile image
    Dev Pedro

    @sujun solar systems don't work like that, they're stored internally in GameData/CelestialDatabase and in UserData/CelestialDatabase for custom systems you're making

    4.1 years ago
  • Profile image
    10.2k Sibonitro

    how to turn a solarsystem.xml into a sr2_mod file

    4.1 years ago
  • Profile image

    How are you able to update data/text? Such as I have multiple variables containing data about the craft. The problem is that they dont update. I tried a while loop and a IEnumerator in which none of them worked. How can I get it to update? It is being used in Text Models. Sorry for all the questions im just stuck on this one.

    +1 4.7 years ago
  • Profile image
    Dev Pedro

    The tutorials have to be updated to prompt people to use unity 2019.2

    +1 4.8 years ago
  • Profile image
    8,452 McDuetchVan

    @AndrewGarrison thank you so much!

    4.8 years ago
  • Profile image

    @McDuetchVan You could check the fuelSource.FuelType.Id to just add to certain fuel types. Check the Propulsion.xml for fuel type IDs.

    4.8 years ago
  • Profile image
    8,452 McDuetchVan

    @AndrewGarrison so would that work if I just pasted it into the parts script? Also how would I be able to just add certain fuels? Sorry for all the questions.

    4.8 years ago
  • Profile image

    @McDuetchVan Something like this should do the trick:

    foreach (var fuelSource in this.CraftScript.FuelSources.FuelSources)
    {
        fuelSource.AddFuel(100);
        fuelSource.RemoveFuel(100);
    }

    +1 4.8 years ago
  • Profile image
    8,452 McDuetchVan

    Is there a function I could use to add/subtract from a crafts fuel in a parts script? Im sorta new to this so any advice will help.

    4.8 years ago
  • Profile image
    100 JoshuaW

    My most wanted feature of SR2/SP modding:
    Custom I/O channels (in other words more spare input channels) for existing parts !

    For example, vanilla rotators can only be controlled by existing game inputs (pitch, roll, trim etc), when I want to control it with a custom variable, either one of the existing channels should be occupied, either I have to make a new rotator by my own, which is super complex and brings tons of problems.

    Plz plz help me with this, just add like 16 more "trim"s with different names, shouldn't be a huge challenge.

    4.9 years ago
  • Profile image

    @Mrmaraunet ICraftScript.FlightData has a bunch of stuff related to velocity and altitude. Game.Instance.FlightScene.CraftNode.CraftScript.FlightData I think is how you would go about accessing that stuff in a script.

    +1 5.0 years ago
  • Profile image
    21.4k AramL

    also is there a script/function to get infos on the craft like speed/height?

    5.0 years ago
  • Profile image
    21.4k AramL

    @AnotherFireFox I would like to know too

    5.0 years ago
  • Profile image

    @MorrissetteAirplaneCo yes

    5.0 years ago
  • Log in to see more comments

39 Upvotes

Log in in to upvote this post.
45.4k MarioG
9,645 AnotherFireFox
36 Gabepasc
Mod SupremeDorian
15.2k Mod
Dev Pedro
7,196 Exospaceman
100 Roswell
4,114 KitKart
40.6k KellyNyanbinary
675 InConstantStagnation
Dev HellFireKoder
507 swope
6,271 Pjork
21.4k AramL
3,688 QarabinaKa
240 ActionStations
3,242 Chancey21
255 Fressabr
Dev WNP78
21.0k Rafaele
1,883 AN2FellllaSR2EditionYeet
6,831 Yoon
10 SuperCracket
11.7k KraZIvan
345 JVGG
Mod InfinityTechnology
872 deusalgor
75 talhahtaco
Dev PhilipTarpley
8,452 McDuetchVan
10.0k IcePing
106 Azam
1,326 CaveatEmperor
25.6k VosAerospace
14.4k ChuckNotChunk
7,766 IntegratedSpaceSystems
2,660 Brixxter