[ADVICE]Trying mod Heatwave/Coldsnap to be much harsher, what toinclude in dll?

Started by Helpful Bot, July 30, 2016, 08:27:31 PM

Previous topic - Next topic

Helpful Bot

Trying mod Heatwave/Coldsnap events to be much harsher, what do I include in my mod solution? So I put in unity engine and assembly associations blah blah. If I want my mod to alter just the temperature offset do I only need to include the MapCondition_Coldsnap CS?

Full disclosure that while I've modded countless games; the closest to visual studio modding I've come is a full (and well done if I may say do) voice mod for Xcom 2. Compiling and all that nonsense I get but how do I get the game to recognize that change and inject it in place of the game's default code?

RemingtonRyder

If you make a modded map condition class i.e. a copy of the original map condition class but with some changes, you need to alter the map condition XML to point to your class.

For example:

<MapConditionDefs>

  <MapConditionDef>
    <defName>SolarApocalypse</defName>
    <conditionClass>MarvsDisasters.MapCondition_SolarApocalypse</conditionClass>
    <label>solar apocalypse</label>
    <description>Your world is slowly being cooked by an increasingly active local star. Now would be a good time to build a spaceship, yes?</description>
    <canBePermanent>true</canBePermanent>
    <endMessage>You still here?</endMessage>
  </MapConditionDef>
 
</MapConditionDefs>


Not actually the best example, since it's a custom map condition of my own, but you get the idea.

Helpful Bot

@Marvin First of all thank you for the reply. As I said in the OP I'm reasonably new to c# and your advice is golden to me.

So the name of the condition class in my mod is planned to be the same as vanilla unless there's a reason not to do it that way. But then again,  the existence of your advice suggests that my mod name is gonna change that and need to be pointed at it in some way. Hmmm... I really wish I could find a single existing mod that I could reverse engineer to see how they went about it. Closest I could find is zombie apocalypse but thats an incident completely detached from the storyteller incident triggers.

Question....Which do you think would be easier to mod: The climate incidents to be more harsh; or The natural climate algorithm to have larger extremes ( Day is generally way hotter and night much colder)?

I left this in here so you can see my level of knowledge and thought pattern if you cared but its pretty much inner monologue lol.
If what you say is true then that means there's no simply overwriting the vanilla class to include my changes. And if there's no overwriting, that means I need to approach this as if i'm cloning the vanilla event. Which means that i'm going to need to link a def file to my solution and the trigger map condition classes that incidents rely upon? So I can't just include the edited MapCondition_ColdSnap.cs & MapCondition_HeatWave.cs in my solution, compile and be done with it... Fair enough.I can't keep the same names for the vanilla incidents i'm guessing? I've gotta be reading into your statement you because I'm having a hard time convincing my brain that we can't fundamentally change a core mechanic...........oh wait


RemingtonRyder

Well, just so you know, I'm a bit new to c# myself. What I've done has been along the same sort of lines. In fact, a couple of alphas ago I had a Harsher Map Conditions mod., so I'm probably the best person to ask.

It doesn't actually matter what your classes/methods are called, so you could use the same name. However, RimWorld still needs context to know where to find them. So in the XML example above, MarvsDisasters is the namespace and MapCondition_SolarApocalypse is a method inside that namespace.

One way to get an idea what goes on in someone else's mod is to use a decompiler to have a look in the assembly file.

Personally, I think that the harshness of map conditions is fine at the moment, but it could adapt according to the state of play a bit more. For example, start with a basic temperature offset, and then add to the magnitude of that a bit if Complex Clothing is researched. Add to it a bit more if Electricity/Air Conditioning is researched.