[A16] Less/More faction bases

Started by Greep, March 30, 2017, 07:53:13 PM

Previous topic - Next topic

Greep

Another mod request.  Below are three mods with preset values (too lazy to make one that reads from xml).  Unzip into mods folder

A)Minimal:  each faction has one base
B)Less: each faction has 1/3 bases
C) More: Each faction has 3x bases

Licence: Steal and upload for all I care, this is pretty tiny.  Link to this thread and/or a name crediting would be nice, though.

Source:

namespace LessBases
{
    [StaticConstructorOnStartup]
    internal class Main
    {
        static Main()
        {
            HarmonyInstance.Create("com.greep.rimworld.mod.variablebases").PatchAll(Assembly.GetExecutingAssembly());
        }
    }

    [HarmonyPatch(typeof(FactionGenerator))]
    [HarmonyPatch("GenerateFactionsIntoWorld")]
    class Patch
    {
        static void Prefix(ref string seedString)
        {
           
           Type type = typeof(FactionGenerator);
            FieldInfo info = type.GetField("FactionBasesPer100kTiles", BindingFlags.NonPublic | BindingFlags.Static);
            info.SetValue(null, new FloatRange(25f, 30f));
        }
    }
}

[attachment deleted by admin due to age]
1.0 Mods: Raid size limiter:
https://ludeon.com/forums/index.php?topic=42721.0

MineTortoise:
https://ludeon.com/forums/index.php?topic=42792.0
HELLO!

(WIPish)Strategy Mode: The experienced player's "vanilla"
https://ludeon.com/forums/index.php?topic=43044.0

Spdskatr

Since you have Harmony, why not use Traverse? It's a lot faster and better than Reflection in many ways.

so like


static void Prefix(ref string seedString)
        {
            Traverse.Create(typeof(FactionGenerator)).Field("FactionBasesPer100kTiles").SetValue(new FloatRange(25f, 30f)); //No BindingFlags needed
        }


Also btw why do you have seedString in your method? It is optional and I don't see you using it :P
My mods

If 666 is evil, does that make 25.8069758011 the root of all evil?

Greep

Ah, well I just don't know all of harmony's uses yet.

As for the ref string, heh, cruft from a refactor where I gave up and modified the whole method.  Thought I was having issues modifying the variable because it was readonly, turns out I made a really stupid mistake instead.  Not going to bother ripping it out tho :P
1.0 Mods: Raid size limiter:
https://ludeon.com/forums/index.php?topic=42721.0

MineTortoise:
https://ludeon.com/forums/index.php?topic=42792.0
HELLO!

(WIPish)Strategy Mode: The experienced player's "vanilla"
https://ludeon.com/forums/index.php?topic=43044.0

Dragoon

Sweet. I often found a crap ton of them and wished there were a bit fewer.
Quote from: faltonico
I truly can't understand that sense of balancing a LOT of modders have, pouring more resources on something doesn't make it more difficult, but more annoying. It is not engaging, even if i'm swimming in silver at late game ¿why to bother?, why all the effort to get there?.

Alex3Wood

Question, is it possible to make bases even more diffuse? Like this is supposed to be a RIMworld right? How many settlements could there be for other factions? Normal game it seems like there are just cities on an under developed world, nothing more. Really I wanna make them like 1/6th as populous as normal game.

Greep

I'm still pretty new to modding, so it's three mods because at the time I didn't feel like learning how to make a dll that reads from XML.  If I were to add yet another mod for 1/6, it'd make sense to just roll them all up into one at that point and let the player set it in a file.  I may do that at some point, but I'm currently on a short mod break xD.

There's still the option of minimal right now, which has almost no faction bases.
1.0 Mods: Raid size limiter:
https://ludeon.com/forums/index.php?topic=42721.0

MineTortoise:
https://ludeon.com/forums/index.php?topic=42792.0
HELLO!

(WIPish)Strategy Mode: The experienced player's "vanilla"
https://ludeon.com/forums/index.php?topic=43044.0

Alex3Wood

Ooo yeah I understand that, I was going to alter the modded file to make it even less if I could, but I dont know what I'm looking at so have no clue. But that idea of giving people the option of choosing sounds cool, but this will have to do for now!! Eitherway it helps my immersion by a lot.

Sixdd

#7
So I'm trying to learn some basics by updating this mod but I'm having no luck at all. I updated the libraries and I'm not getting any errors in Visual Studio but I can't for the life of me get it to do anything. Any help would be great.

EDIT: Nevermind, I figured out how to accomplish this in pure XML . I'll post it to the releases board in the next day or so if it works out as well as I hope it will.

EDIT: Ok, didn't figure it out.

dwlatrel