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

Topics - Red192

#1
Help / [Harmony] trying to postfix
October 04, 2019, 10:41:48 AM
So, i'm trying to use Harmony for make the mining ticks been affected by a certain tecnology, but it does not work, i tried a bit but i guess is better to try to ask here:

using RimWorld;
using System.Reflection;
using System;
using Verse;
using Harmony;

namespace NoName
{
    [HarmonyPatch(typeof(JobDriver_Mine))]
    [HarmonyPatch("ResetTicksToPickHit")]
    static class JobDriver_Mine_ResearchPatch
    {
        static void Postfix(JobDriver_Mine __istance, ref int ___ticksToPickHit)
        {
            float num = 1;
            if (ResearchProjectDef.Named("IronWorking").IsFinished)
            {
                num = 0.5f;
            }
           ___ticksToPickHit = (int)(___ticksToPickHit*num);
        }
    }
}


Is something wrong?

EDIT: A reference cannot be modified... of course
#2
I'm new to modding and to c# and i find my self quite overwhelmed. I think it is a simple problem in reality but i wasn't able to figure it out and i'm quite ashamed from it, please be merciful, i'm new.

I tried a bit but i can't find how to define if the building is currently used for bill production or not. Can someone please help me?