Ludeon Forums

RimWorld => Mods => Help => Topic started by: Legionnairegames on June 23, 2019, 01:46:51 AM

Title: Help with game start year
Post by: Legionnairegames on June 23, 2019, 01:46:51 AM
I would like to change the starting year to something before the default for a scenario. I know it doesn't effect gameplay at all, it would just be nice to see the desired year in the game. I have taken peak through the XML files, some configuration files, and have searched the internet with no luck. I have even tried one suggestion that was given to me, which was to edit the save file, again no luck. If anyone can help me or even tell me whether if it is even possible, would be greatly appreciated.
Title: Re: Help with game start year
Post by: K on June 24, 2019, 12:45:01 PM
The start year is hardcoded in the GenDate class, but it can be changed with a harmony patch that changes the Year method. I wrote this little patch that accomplishes it:


    [HarmonyPatch(typeof(GenDate), "Year")]
    static class GenDatePatch {

        static void Postfix(long absTicks, float longitude, ref int __result) {
            var longAdj = GenDate.TimeZoneAt(longitude) * 2500L;
            __result = 2070 + (int)((absTicks + longAdj) / 3600000f);
        }
    }


This changes the start year to 2070. It's pretty cumbersome, but it seems like this is the only way to change it.
Title: Re: Help with game start year
Post by: Legionnairegames on June 24, 2019, 04:18:43 PM
Thank you so much! You are a life saver! I'll give it go.
Title: Re: Help with game start year
Post by: Legionnairegames on June 26, 2019, 10:39:11 AM
It worked perfectly. Thank you so much. I am very new to C# coding and it took me a while to figure it out. But once I figured it out, it was super easy.
Title: Re: Help with game start year
Post by: LWM on June 27, 2019, 11:35:02 AM
Quote from: Legionnairegames on June 26, 2019, 10:39:11 AM
It worked perfectly. Thank you so much. I am very new to C# coding and it took me a while to figure it out. But once I figured it out, it was super easy.

Welcome to the Dark Side.  We have cookies!