protected override bool CanScatterAt(IntVec3 loc, Map map) { if (!base.CanScatterAt(loc, map)) { return(false); } if (!TryGetRandomValidRotation(loc, map, out Rot4 rot)) { return(false); } if (terrainValidationRadius > 0f) { foreach (IntVec3 current in GenRadial.RadialCellsAround(loc, terrainValidationRadius, true)) { if (GenGrid.InBounds(current, map)) { TerrainDef terrain = GridsUtility.GetTerrain(current, map); for (int i = 0; i < terrainValidationDisallowed.Count; i++) { if (terrain.HasTag(terrainValidationDisallowed[i])) { return(false); } } } } return(true); } return(true); }
protected override void Impact(Thing hitThing) { Map map = base.Map; base.Impact(hitThing); BattleLogEntry_RangedImpact battleLogEntry_RangedImpact = new BattleLogEntry_RangedImpact(this.launcher, hitThing, this.intendedTarget.Thing, ThingDef.Named("Gun_Autopistol"), this.def, this.targetCoverDef); Find.BattleLog.Add(battleLogEntry_RangedImpact); bool flag = hitThing != null; if (flag) { DamageDef damageDef = this.def.projectile.damageDef; float num = (float)base.DamageAmount; float armorPenetration = base.ArmorPenetration; float y = this.ExactRotation.eulerAngles.y; Thing launcher = this.launcher; ThingDef equipmentDef = this.equipmentDef; DamageInfo damageInfo = new DamageInfo(damageDef, num, armorPenetration, y, launcher, null, null, 0, this.intendedTarget.Thing);; hitThing.TakeDamage(damageInfo).AssociateWithLog(battleLogEntry_RangedImpact); Pawn pawn = hitThing as Pawn; bool flag2 = pawn != null && pawn.stances != null && pawn.BodySize <= this.def.projectile.StoppingPower + 0.001f; if (flag2) { pawn.stances.StaggerFor(95); } } else { SoundStarter.PlayOneShot(SoundDefOf.BulletImpact_Ground, new TargetInfo(base.Position, map, false)); //MoteMaker.MakeStaticMote(this.ExactPosition, map, ThingDefOf.Mote_ShotHit_Dirt, 1f); bool takeSplashes = GridsUtility.GetTerrain(base.Position, map).takeSplashes; if (takeSplashes) { //MoteMaker.MakeWaterSplash(this.ExactPosition, map, Mathf.Sqrt((float)base.DamageAmount) * 1f, 4f); } } }
// Token: 0x0600003E RID: 62 RVA: 0x00004794 File Offset: 0x00002994 internal static string GetCamoType(Pawn pawn) { string text = "notDefined"; if (!(text != "notDefined") && GridsUtility.GetSnowDepth(pawn.Position, pawn.Map) >= 0.25f) { return("Arctic"); } TerrainDef terrain = GridsUtility.GetTerrain(pawn.Position, pawn.Map); if (!(text != "notDefined") && terrain != null) { if ((terrain?.smoothedTerrain) != null || terrain.affordances.Contains(TerrainAffordanceDefOf.SmoothableStone)) { return("Stone"); } if (CamoGearUtility.IsFluffyStuffed(terrain, out string text2)) { text = text2; } else { text = CamoDefGet.GetCamoDefTerrain(terrain); } if (Prefs.DevMode && Controller.Settings.ShowTerrainLogs && Find.TickManager.TicksGame % 120 == 0) { Log.Message("Terrain: " + terrain.defName + " : " + text, false); } } if (!(text != "notDefined") && !GridsUtility.UsesOutdoorTemperature(pawn.Position, pawn.Map)) { return("Urban"); } if (!(text != "notDefined")) { text = CamoDefGet.GetCamoDefBiome(pawn.Map.Biome); } return(text); }