Code for solar flares

Started by Kyna Tiona, December 29, 2016, 05:47:57 PM

Previous topic - Next topic

Kyna Tiona

So I'm using ILSpy to look through the C# assembly, and utterly failing to find the code governing solar flares. The XML entry in WeatherDef points towards "IncidentWorker_MakeMapCondition" with the value "SolarFlare". "SolarFlare" relates to a couple of dynamic references floating around in MapConditionDef and IncidentDefOf, but I can't find anything pointing me to the solar flare code itself.

I looked up a mod that messed with solar flares in the hopes that it'd point me to in the right direction, but no luck. Searches for "solar", "flare", "solar flare", and "solarflare" turned up nothing useful. Does anyone happen to know where it is, or how to find it?

Profugo Barbatus

The solar flare check is actually handled in Rimworld.PowerNet.PowerNetTick(). The incident def itself doesn't actually do anything, all it does is check to see if an incident by the exact name exists, and then all power grids know to start shutting themselves down.

Kyna Tiona

Gotcha. That could be a little tricky to work around, but I bet I can do something with replacing the SolarFlare incident with differently titled one that conditionally recreates the current effect of PowerNet.PowerNetTick() during a SolarFlare incident. Thanks!

Knedl

Check the code of RT SolarFlareShield mod, maybe it will help you out.

Kyna Tiona

Quote from: Knedl on December 30, 2016, 03:32:52 AM
Check the code of RT SolarFlareShield mod, maybe it will help you out.

I was actually dutiful and did that before starting this thread~

It's written fairly cleverly, actually. It kidnaps the normal solar flare event, but then if the player's shield goes down, it just turns the normal map condition back on. It never actually touches the solar flare code, which is why I hadn't known where to look.