Пример #1
0
 public static bool Prefix(SmokepopBelt __instance, DamageInfo dinfo)
 {
     if (!dinfo.Def.isExplosive &&
         dinfo.Def.harmsHealth &&
         dinfo.Def.externalViolence &&
         dinfo.WeaponGear != null &&
         (dinfo.WeaponGear.IsRangedWeapon || dinfo.WeaponGear.projectile is ProjectilePropertiesCE))     // Add a check for CE projectiles since we're using them as weaponGear to pass data to our ArmorUtility
     {
         ThingDef gas_Smoke = ThingDefOf.Gas_Smoke;
         GenExplosion.DoExplosion(__instance.Wearer.Position, __instance.Wearer.Map, __instance.GetStatValue(StatDefOf.SmokepopBeltRadius, true), DamageDefOf.Smoke, null, null, null, null, gas_Smoke, 1f, 1, false, null, 0f, 1);
         __instance.Destroy(DestroyMode.Vanish);
     }
     return(false);
 }
 private static void SmokepopBelt_CheckPreAbsorbDamagePostfix(SmokepopBelt __instance, DamageInfo dinfo)
 {
     if (!dinfo.Def.isExplosive && dinfo.Def.harmsHealth && dinfo.Def.ExternalViolenceFor(__instance.Wearer))
     {
         if (dinfo.Instigator is Pawn instigatorPawn && instigatorPawn.TryGetComp <VEF_Comp_Pawn_RangedVerbs>() is VEF_Comp_Pawn_RangedVerbs comp && comp.CurRangedVerb is Verb verb && !(dinfo.Weapon != null && verb.EquipmentSource != null && dinfo.Weapon == verb.EquipmentSource.def) && !verb.IsMeleeAttack)
         {
             IntVec3   position   = __instance.Wearer.Position;
             Map       map        = __instance.Wearer.Map;
             float     statValue  = __instance.GetStatValue(StatDefOf.SmokepopBeltRadius, true);
             DamageDef smoke      = DamageDefOf.Smoke;
             Thing     instigator = null;
             ThingDef  gas_Smoke  = ThingDefOf.Gas_Smoke;
             GenExplosion.DoExplosion(position, map, statValue, smoke, instigator, -1, -1f, null, null, null, null, gas_Smoke, 1f, 1, false, null, 0f, 1, 0f, false);
             __instance.Destroy(DestroyMode.Vanish);
         }
     }
     return;
 }
 public static bool Prefix(SmokepopBelt __instance, DamageInfo dinfo)
 {
     if (!dinfo.Def.isExplosive &&
         dinfo.Def.harmsHealth &&
         dinfo.Def.ExternalViolenceFor(dinfo.IntendedTarget) &&
         dinfo.Weapon != null &&
         (dinfo.Weapon.IsRangedWeapon || dinfo.Weapon.projectile is ProjectilePropertiesCE))     // Add a check for CE projectiles since we're using them as weaponGear to pass data to our ArmorUtility
     {
         IntVec3   position   = __instance.Wearer.Position;
         Map       map        = __instance.Wearer.Map;
         float     statValue  = __instance.GetStatValue(StatDefOf.SmokepopBeltRadius, true);
         DamageDef smoke      = DamageDefOf.Smoke;
         Thing     instigator = null;
         ThingDef  gas_Smoke  = ThingDefOf.Gas_Smoke;
         GenExplosion.DoExplosion(position, map, statValue, smoke, instigator, -1, -1, null, null, gas_Smoke, null, null, 1f, 1, false, null, 0f, 1, 0f, false);
         __instance.Destroy(DestroyMode.Vanish);
     }
     return(false);
 }