public override AcceptanceReport AllowsPlacing(BuildableDef checkingDef, IntVec3 loc, Rot4 rot, Map map, Thing thingToIgnore = null, Thing thing = null) { ThingDef thingDef = (ThingDef)checkingDef; tmpCells.Clear(); int num = GenRadial.NumCellsInRadius(thingDef.building.instrumentRange); for (int i = 0; i < num; i++) { IntVec3 intVec = loc + GenRadial.RadialPattern[i]; if (Building_MusicalInstrument.IsAffectedByInstrument(thingDef, loc, intVec, map)) { tmpCells.Add(intVec); } } GenDraw.DrawFieldEdges(tmpCells); return(true); }
protected override ThoughtState CurrentStateInternal(Pawn p) { if (!p.health.capacities.CapableOf(PawnCapacityDefOf.Hearing)) { return(false); } ThingDef def = InstrumentDef; return(GenClosest.ClosestThingReachable(p.Position, p.Map, ThingRequest.ForDef(def), PathEndMode.ClosestTouch, TraverseParms.For(p), def.building.instrumentRange, delegate(Thing thing) { Building_MusicalInstrument building_MusicalInstrument = thing as Building_MusicalInstrument; return building_MusicalInstrument != null && building_MusicalInstrument.IsBeingPlayed && Building_MusicalInstrument.IsAffectedByInstrument(def, building_MusicalInstrument.Position, p.Position, p.Map); }) != null); }