private bool NearbyActiveBroadshield() { float radius = BroadshieldProjectileInterceptorProperties().radius; foreach (Thing item in GenRadial.RadialDistinctThingsAround(base.PositionHeld, base.MapHeld, radius, useCenter: true)) { CompProjectileInterceptor compProjectileInterceptor = item.TryGetComp <CompProjectileInterceptor>(); if (item.def == ThingDefOf.BroadshieldProjector && compProjectileInterceptor != null && compProjectileInterceptor.Active) { return(true); } } return(false); }
public override void Notify_BulletImpactNearby(BulletImpactData impactData) { base.Notify_BulletImpactNearby(impactData); Pawn wearer = base.Wearer; if (!wearer.Dead && !impactData.bullet.def.projectile.damageDef.isExplosive && CompProjectileInterceptor.InterceptsProjectile(BroadshieldProjectileInterceptorProperties(), impactData.bullet) && impactData.bullet.Launcher != null && impactData.bullet.Launcher.HostileTo(base.Wearer) && !wearer.IsColonist && wearer.Spawned && !NearbyActiveBroadshield()) { Verb_DeployBroadshield.Deploy(this.TryGetComp <CompReloadable>()); } }