public static float progressGACTimer(float prevTimerValue, float step, GenericAutoCrafterNew gac)
        {
            float pf    = gac.mrCurrentPower / gac.mrMaxPower;
            float speed = gac.mrMaxPower <= 0 || float.IsInfinity(pf) || float.IsNaN(pf) ? 1 : Math.Max(1, (pf - 0.5F) * 4 * config.getFloat(FTConfig.ConfigEntries.GAC_RAMP));

            return(Math.Max(0, prevTimerValue - step * speed));
        }
Exemple #2
0
    public static bool UpdateLookingForResources(GenericAutoCrafterNew __instance)
    {
        if (__instance.mRecipe.Costs.Count == 0)
        {
            // Harmony caches the reflection internally so it is *supposed* to be fast
            Harmony.Traverse.Create(__instance).Method("SetNewState", GenericAutoCrafterNew.eState.eCrafting).GetValue();

            return(false); // We're done skip the rest of the method
        }

        return(true);
    }