public static bool BlockableByShield(this Projectile proj, Building_Shield shieldGen)
 {
     if (!proj.def.projectile.flyOverhead)
     {
         return(true);
     }
     return(!shieldGen.coveredCells.Contains(((Vector3)NonPublicFields.Projectile_origin.GetValue(proj)).ToIntVec3()) &&
            (int)NonPublicFields.Projectile_ticksToImpact.GetValue(proj) / (float)NonPublicProperties.Projectile_get_StartingTicksToImpact(proj) <= 0.5f);
 }
コード例 #2
0
 public static void Postfix(Tornado __instance, IntVec3 c, ref bool __result)
 {
     // Shield-covered cells are immune to damage
     if (!__result)
     {
         List <Building_Shield> shieldGens = __instance.Map.GetComponent <ListerThingsExtended>().ListerShieldGensActive.ToList();
         for (int i = 0; i < shieldGens.Count; i++)
         {
             Building_Shield gen = shieldGens[i];
             if (gen.coveredCells.Contains(c))
             {
                 if (!gen.affectedThings.ContainsKey(__instance))
                 {
                     gen.AbsorbDamage(30, DamageDefOf.TornadoScratch, __instance);
                     gen.affectedThings.Add(__instance, 15);
                 }
                 __result = true;
                 return;
             }
         }
     }
 }