Пример #1
0
 //public static bool GetNextResource(IntVec3 p, Map map, out ThingDef resDef, out int countPresent, out IntVec3 cell)
 public static bool Prefix(ref bool __result, IntVec3 p, Map map, ref ThingDef resDef, ref int countPresent, ref IntVec3 cell)
 {
     if (NextDrillResourceComp.Get(map).TryGetValue(p, out DrillData nextDef))
     {
         resDef       = nextDef.resDef;
         countPresent = nextDef.countPresent;
         cell         = nextDef.cell;
         __result     = nextDef.result;
         return(false);
     }
     return(true);
 }
Пример #2
0
        public static void Postfix(bool __result, IntVec3 p, Map map, ref ThingDef resDef, ref int countPresent, ref IntVec3 cell)
        {
            var nextResources = NextDrillResourceComp.Get(map);

            if (nextResources.ContainsKey(p))
            {
                return;
            }

            //Use NextDrillResourceComp if it has it, even if settings is off
            if (!Settings.Get().deepDrillRandom)
            {
                return;
            }

            Log.Message($"Adding drill data {p}, {resDef}, {countPresent}, {cell}, {__result}");
            DrillData drillData;

            drillData.resDef       = resDef;
            drillData.countPresent = countPresent;
            drillData.cell         = cell;
            drillData.result       = __result;
            nextResources[p]       = drillData;
        }
Пример #3
0
 public static void Clear(CompDeepDrill ddComp)
 {
     Log.Message($"Removing Deep Drill {ddComp.parent.Position}");
     NextDrillResourceComp.Get(ddComp.parent.Map).Remove(ddComp.parent.Position);
 }