public bool WillProjectileBeBlocked(Verse.Projectile projectile) { // Dont intercept projectiles without a Damage Def - Fire Spread if (projectile.def.projectile.damageDef == null) { return(false); } IEnumerable <Building_Shield> _ShieldBuildings = map.listerBuildings.AllBuildingsColonistOfClass <Building_Shield>(); Building_Shield _BlockingShield = _ShieldBuildings.FirstOrFallback(x => x.WillProjectileBeBlocked(projectile)); if (_BlockingShield != null) { _BlockingShield.TakeDamageFromProjectile(projectile); //On hit effects MoteMaker.ThrowLightningGlow(projectile.ExactPosition, this.map, 0.5f); //On hit sound HitSoundDef.PlayOneShot((SoundInfo) new TargetInfo(projectile.Position, projectile.Map, false)); projectile.Destroy(); return(true); } return(false); }
public bool WillProjectileBeBlocked(Verse.Projectile projectile) { IEnumerable<Building_Shield> _ShieldBuildings = map.listerBuildings.AllBuildingsColonistOfClass<Building_Shield>(); Building_Shield _BlockingShield = _ShieldBuildings.FirstOrFallback(x => x.WillProjectileBeBlocked(projectile)); if (_BlockingShield != null) { _BlockingShield.TakeDamageFromProjectile(projectile); //On hit effects FleckMaker.ThrowLightningGlow(projectile.ExactPosition, this.map, 0.5f); //On hit sound HitSoundDef.PlayOneShot((SoundInfo)new TargetInfo(projectile.Position, projectile.Map, false)); projectile.Destroy(); return true; } return false; }