public static bool TryGetValue(this ToolComp comp, ToolType toolType, StatDef stat, out float factor, out float offset)
        {
            factor = 1f;
            offset = 0f;
            if (!comp.TryGetValue(toolType, out var val))
            {
                return(false);
            }
            bool flag = false;

            factor = toolType.workStatFactors.GetStatValueFromList(stat, 0f);
            if (factor != 0f)
            {
                factor *= val;
                flag    = true;
            }
            else
            {
                factor = 1f;
            }
            offset = toolType.workStatOffset.GetStatValueFromList(stat, 0f);
            if (offset != 0f)
            {
                flag   = true;
                offset = val - offset;
            }
            return(flag);
        }
        public static bool TryGetValue(this ToolComp comp, JobDef job, StatDef stat, out float factor, out float offset, ToolType toolType = null)
        {
            factor = 1f;
            offset = 0f;
            if (toolType == null && !Dictionaries.jobToolType.TryGetValue(job, out toolType))
            {
                return(false);
            }
            if (!comp.TryGetValue(job, out var val, toolType))
            {
                return(false);
            }
            bool flag = false;

            factor = toolType.workStatFactors.GetStatValueFromList(stat, 0f);
            if (factor != 0f)
            {
                factor *= val;
                flag    = true;
            }
            else
            {
                factor = 1f;
            }
            offset = toolType.workStatOffset.GetStatValueFromList(stat, 0f);
            if (offset != 0f)
            {
                flag   = true;
                offset = val - offset;
            }
            return(flag);
        }
 public static bool TryGetValue(this ToolComp comp, ThingDef billGiver, StatDef stat, out float factor, out float offset, ToolType toolType = null)
 {
     factor = 1f;
     offset = 0f;
     if (toolType == null && !Dictionaries.billGiverToolType.TryGetValue(billGiver, out toolType))
     {
         return(false);
     }
     if (!comp.TryGetValue(billGiver, out var val, toolType))
     {
         return(false);
     }
     factor = toolType.workStatFactors.GetStatValueFromList(stat, 0f);
     if (factor != 0f)
     {
         factor *= val;
     }
     else
     {
         factor = 1f;
     }
     offset = toolType.workStatOffset.GetStatValueFromList(stat, 0f);
     if (offset != 0f)
     {
         offset = val - offset;
     }
     return(true);
 }
 public static bool IsForced(this ToolComp comp)
 {
     if (!(comp.HoldingPawn is Pawn pawn) || !pawn.CanUseTools(out var tracker))
     {
         return(false);
     }
     return(tracker.forcedHandler.ForcedTools.Contains(comp.parent));
 }
 public static float GetValue(this ToolComp comp, JobDef job, ToolType toolType = null, float fallback = 0f)
 {
     if (comp.TryGetValue(job, out float val, toolType))
     {
         return(val);
     }
     return(fallback);
 }
 public static float GetValue(this ToolComp comp, ToolType toolType, float fallback = 0f)
 {
     if (comp.TryGetValue(toolType, out float val))
     {
         return(val);
     }
     return(fallback);
 }
 public static bool TryGetValue(this ToolComp comp, ToolType toolType, out float val)
 {
     val = 0f;
     if (!comp.ToolTypes.Contains(toolType))
     {
         return(false);
     }
     val = comp.parent.GetStatValue(toolType, StatDefOf.ToolEffectivenessFactor);
     return(true);
 }
 public static bool TryGetValue(this ToolComp comp, ThingDef billGiver, out float val, ToolType toolType = null)
 {
     val = 0f;
     if (toolType == null && !Dictionaries.billGiverToolType.TryGetValue(billGiver, out toolType))
     {
         return(false);
     }
     if (!comp.TryGetValue(toolType, out val))
     {
         return(false);
     }
     val *= comp.CompProp.billGiverBonus.GetBillGiverValueFromList(billGiver, 1f);
     return(true);
 }
 public static bool TryGetValue(this ToolComp comp, JobDef job, out float val, ToolType toolType = null)
 {
     val = 0f;
     if (toolType == null && !Dictionaries.jobToolType.TryGetValue(job, out toolType))
     {
         return(false);
     }
     if (!comp.TryGetValue(toolType, out val))
     {
         return(false);
     }
     val *= comp.CompProp.jobBonus.GetJobValueFromList(job, 1f);
     return(true);
 }
 public ToolInfo(ThingWithComps tool, ToolComp comp)
 {
     this.tool = tool;
     this.comp = comp;
 }
 public static bool CanDrop(this ToolComp comp) => !comp.IsForced();