public static void Notify_BuildingDestroying(Thing t, DestroyMode mode) { if (mode == DestroyMode.KillFinalize || mode == DestroyMode.Deconstruct) { if (t.def.IsSmoothed) { for (int i = 0; i < GenAdj.CardinalDirections.Length; i++) { IntVec3 c = t.Position + GenAdj.CardinalDirections[i]; if (c.InBounds(t.Map)) { Building edifice = c.GetEdifice(t.Map); if (edifice != null && edifice.def.IsSmoothed) { bool flag = true; for (int j = 0; j < GenAdj.CardinalDirections.Length; j++) { IntVec3 pos = edifice.Position + GenAdj.CardinalDirections[j]; if (!SmoothableWallUtility.IsBlocked(pos, t.Map)) { flag = false; break; } } if (flag) { edifice.Destroy(DestroyMode.WillReplace); GenSpawn.Spawn(ThingMaker.MakeThing(edifice.def.building.unsmoothedThing, edifice.Stuff), edifice.Position, t.Map, edifice.Rotation, WipeMode.Vanish, false); } } } } } } }
public static void Notify_SmoothedByPawn(Thing t, Pawn p) { for (int i = 0; i < GenAdj.CardinalDirections.Length; i++) { IntVec3 c = t.Position + GenAdj.CardinalDirections[i]; if (c.InBounds(t.Map)) { Building edifice = c.GetEdifice(t.Map); if (edifice != null && edifice.def.IsSmoothable) { bool flag = true; int num = 0; for (int j = 0; j < GenAdj.CardinalDirections.Length; j++) { IntVec3 intVec = edifice.Position + GenAdj.CardinalDirections[j]; if (!SmoothableWallUtility.IsBlocked(intVec, t.Map)) { flag = false; break; } Building edifice2 = intVec.GetEdifice(t.Map); if (edifice2 != null && edifice2.def.IsSmoothed) { num++; } } if (flag && num >= 2) { for (int k = 0; k < GenAdj.DiagonalDirections.Length; k++) { IntVec3 pos = edifice.Position + GenAdj.DiagonalDirections[k]; if (!SmoothableWallUtility.IsBlocked(pos, t.Map)) { SmoothableWallUtility.SmoothWall(edifice, p); break; } } } } } } }
protected void DoEffect() { SmoothableWallUtility.Notify_SmoothedByPawn(SmoothableWallUtility.SmoothWall(base.TargetA.Thing, pawn), pawn); }