Greep's Misc. Mods (Newest: InfiniDrill!)

Started by Greep, April 20, 2017, 05:11:41 AM

Previous topic - Next topic

Greep

I'm starting to accumulate a bunch of tiny mods, so I figure I should do the nice thing and make a thread for them all.  Discuss miscellaneous mods of mine in this thread, and major mods of mine in their respectve threads.  Going to bed soon, so this first post is very minimal, but the new infinidrill will be explained in the second post and it's zip attached below here.  Older misc  mod threads will be closed and their downloads moved here, eventually to a mod download center like nexus.

[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

Greep

#1
InfiniDrill

Infinidrill is an offshoot of the deep drill that gives random metal and stone.  It should automatically fetch new stone and metal from any mod, so long as the metal is marked Metallic and the stone is in the map.  Even though the quarry and deep core mining mods exist, they didn't have quite what I needed for the parent mod, Armok.   

Infinidrill works twice as fast as the deep drill, but has slightly lower metal output due to large amounts of stonechunks and slightly lower metal yield.  Extremely long term infinidrills start pumping out more and more metal and less and less stone, though.   This trend can be reset by simply deconstructing the drill and starting a new one.  Newly constructed infinidrills always yield stone, to prevent you sneaky cheaters from cheating ;)

Keep in mind, the nature of these things are highly random.  You can potentially get buckets of gold or nothing but stone.  This is far less noticeable if you're only using this for endgame and have several miners, but an early colony can be in quite the pickle if you're relying on one of these drills.

It is built for a few uses, though you can use it whenever you want of course:

-Post end-game, when deep drill has run out
-Midgame, if you just can't wait for the scanner and have exhausted all of the metal you want on the map.
-Wanting to get more of that metal from your favorite mod
-Need stone
..etc

License

Include wherever, this took far less time than I expected.  But do credit me, and ideally link to this thread and the parent mod, Armok.

Choose next resource code

For those curious as to exactly how likely they will get what resource, here's the relevant function:

public void SetNextResourceDef()
        {
            if (this.resourceDef != null)
            {
                if (this.resourceType == "stone")
                {
                    if (Rand.RangeInclusive(0, 3) <= 2)
                    {
                        return;
                    }
                }
                else
                {
                    if (15 * Math.Pow(this.resourceDef.BaseMarketValue, 0.35f) < Rand.Range(0f, 100f))
                    {
                        return;
                    }
                }
            }

            this.resourceType = "metal";
            if (pullCount == 0)
            {
                this.resourceType = "stone";
            } else if (pullCount >= 5 && 50f - Mathf.Pow(pullCount,0.4f) < Rand.Range(0f, 100f))
            {
                // less chance of stone the deeper you drill
                this.resourceType = "stone";
            }

            //stone
            // just get a random stone on the map
            if (this.resourceType == "stone")
            {
                ThingDef stoneDef = Find.World.NaturalRockTypesIn(this.parent.Map.Tile).RandomElement<ThingDef>().building.mineableThing;
                this.resourceDef = stoneDef;
            } else
            {

                // metal
                ThingDef metalDef = DefDatabase<ThingDef>.AllDefs.RandomElementByWeight(delegate (ThingDef d)
                {
                    if (d.stuffProps == null)
                    {
                        return 0f;
                    }
                    if (!d.stuffProps.categories.Contains(StuffCategoryDefOf.Metallic))
                    {
                        return 0f;
                    }

                    float marketValMult = d.BaseMarketValue + 1;
                    float volMult = Mathf.Pow(d.VolumePerUnit, 0.5f);

                    return Mathf.Pow(1 / marketValMult, 0.5f) * volMult;
                });

                this.resourceDef = metalDef;
            }

            // too lazy to make a fallback
        }

Edit:  Or you know, I can be a dork and accidentally make them pump out more and more stone with age >.> whoops.  The effect is very small, so it's still fine to download for the moment lol.  Will fix tomorrow.
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