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.
Will there ever be a documentation site for all the assemblies and stuff?
Thanks a lot!!!!
@Azamwasgamingnowismakinggames @NathanMikeska there's this old tutorial by @XxxNico420xxX, not sure if it's 100% up to date.
@NathanMikeska Thanks for the reply :)
@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.
What About Custom Parts?
@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.
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
and then looping through each part
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
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
Here are the scripts
@pedro16797 OK
@sujun you should upload it with the new method, uploading it in mod posts will soon be deprecated
@pedro16797 Yes, I know, but uploading my solar system works to the mod post requires the sr2-mod file
@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
how to turn a solarsystem.xml into a sr2_mod file
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.
The tutorials have to be updated to prompt people to use unity 2019.2
@AndrewGarrison thank you so much!
@McDuetchVan You could check the
fuelSource.FuelType.Id
to just add to certain fuel types. Check the Propulsion.xml for fuel type IDs.@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.
@McDuetchVan Something like this should do the trick:
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.
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.
@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.also is there a script/function to get infos on the craft like speed/height?
@AnotherFireFox I would like to know too
@MorrissetteAirplaneCo yes