public bool isSurroundedByIvy(IntVec3 dir) { foreach (IntVec3 current in GenAdj.AdjacentSquares8Way(dir)) { if (!IvyInCell(current)) { return(false); } } return(true); }
public bool hasNoBuildings(IntVec3 dir) { foreach (IntVec3 current in GenAdj.AdjacentSquares8Way(dir)) { if (!current.Standable()) { return(false); } } return(true); }
protected override void Impact(Thing hitThing) { base.Impact(hitThing); MoteMaker.TryThrowSmoke(base.Position.ToVector3Shifted(), 1f); foreach (IntVec3 current in GenAdj.AdjacentSquares8Way(this)) { List <Thing> list = Find.ThingGrid.ThingsListAt(current); for (int i = 0; i < list.Count; i++) { if (list[i].def.eType == EntityType.Fire) { list[i].TakeDamage(new DamageInfo(DamageTypeDefOf.Extinguish, 5, this, null, null)); } } } }
private void Command_Detonate() { radius = base.GetComp <CompExplosive>().props.explosiveRadius; dmgdef = base.GetComp <CompExplosive>().props.explosiveDamageType; this.Destroy(DestroyMode.Vanish); BodyPartDamageInfo value = new BodyPartDamageInfo(null, new BodyPartDepth?(BodyPartDepth.Outside)); ExplosionInfo explosionInfo = default(ExplosionInfo); explosionInfo.center = Position; explosionInfo.radius = radius; explosionInfo.dinfo = new DamageInfo(dmgdef, 100, this, new BodyPartDamageInfo?(value), null); explosionInfo.Explode(); explosionInfo.dinfo = new DamageInfo(dmgdef, 100, this, new BodyPartDamageInfo?(value), null); explosionInfo.dinfo = new DamageInfo(dmgdef, 100, this, new BodyPartDamageInfo?(value), null); explosionInfo.dinfo = new DamageInfo(dmgdef, 100, this, new BodyPartDamageInfo?(value), null); MoteMaker.TryThrowMicroSparks(Position.ToVector3Shifted()); if (Position.GetRoof() != null) { if (Find.RoofGrid.RoofDefAt(Position).isThickRoof == true) { RoofDef roofType = DefDatabase <RoofDef> .GetNamed("RoofRockThin"); Find.RoofGrid.SetRoof(Position, roofType); } else { Find.RoofGrid.SetRoof(Position, null); } } foreach (IntVec3 current in GenAdj.AdjacentSquares8Way(this)) { if (current.GetRoof() != null) { if (Find.RoofGrid.RoofDefAt(current).isThickRoof == true) { RoofDef roofType = DefDatabase <RoofDef> .GetNamed("RoofRockThin"); Find.RoofGrid.SetRoof(current, roofType); } else { Find.RoofGrid.SetRoof(current, null); } } } }
private void PodImpact() { for (int i = 0; i < 6; i++) { Vector3 spawnLoc = base.Position.ToVector3Shifted() + Gen.RandomHorizontalVector(1f); MoteMaker.ThrowDustPuff(spawnLoc, 1.2f); } MoteMaker.ThrowLightningGlow(base.Position.ToVector3Shifted(), 2f); MoteMaker.TryThrowSmoke(base.Position.ToVector3Shifted(), 2f); MoteMaker.ThrowExplosionCell(base.Position); MeteorIncoming.ExplodeSound.PlayOneShot(base.Position); foreach (IntVec3 current in GenAdj.AdjacentSquares8Way(this)) { MoteMaker.ThrowAirPuffUp(base.Position.ToVector3Shifted(), AltitudeLayer.Floor); } Meteor meteor = (Meteor)ThingMaker.MakeThing(ThingDef.Named("Meteor")); meteor.info = this.contents; GenSpawn.Spawn(meteor, base.Position, base.Rotation); this.Destroy(DestroyMode.Vanish); }