Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - AncientGammoner

#1
I just haven't seen a good, clear example of the format for calling a private method with inputs and returning a value.

I'm trying to call:
public static class CaravanEnterMapUtility
     private static IntVec3 FindNearEdgeCell(Map map, Predicate<IntVec3> extraCellValidator)

What I've been able to cobble together so far doesn't work (below).  Does anyone have an actual example I could look at, I would think this is a rather common thing to do.

MethodInfo methodInfo = typeof(CaravanEnterMapUtility).GetMethod("FindNearEdgeCell", BindingFlags.NonPublic | BindingFlags.Instance);
var parameters = new object[] { map, extraCellValidator };
__result = (IntVec3)methodInfo.Invoke(null, parameters);

Edit: Actually I think I got it to work, it should be BindingFlags.Static not BindingFlags.Instance since the method is static
#2
Help / Harmony Patching and Private Method Calls
July 21, 2021, 11:54:28 AM
Let me preface this by saying the only C# I know is from modding and most of that is from modifying existing code, so I'm very much a beginner.  My question is:

If I'm trying to patch a method using Harmony (like with a Prefix) and the original method calls out a private method that I also need to call out, how do I reference that?  Google mentions reflections and publicized assemblies and honestly I'm lost.  An example would be very helpful.
#3
Just equip them with a smoke/EMP launcher and fire at a tamed animal (in a zoned area so it doesn't wander off)
#4
General Discussion / Re: Warg can't haul in 1.3
July 14, 2021, 08:33:03 PM
Wargs are fictional animals
#5
I ended up writing this mod myself (my first one!), link below if you're interested:
https://steamcommunity.com/sharedfiles/filedetails/?id=2356822769
#6
All the vanilla expanded mods (https://steamcommunity.com/workshop/filedetails/?id=1884025115), that alone is like several expansions worth of content. 

And Save Our Ship 2 (https://steamcommunity.com/sharedfiles/filedetails/?id=1909914131) for a real endgame.
#7
We've all been there, you're trying to throw a grenade, launch a doomsday, or target an orbital strike and the game keeps snapping on the (often moving) enemies when what you might want is to target the ground tile underneath them.  Is it maybe possible for a mod to allow you to hold down a key (like Shift) to disable the snap-to-enemy mechanic and let you only target ground tiles?