public override IEnumerable <FloatMenuOption> GetFloatMenuOptions(Pawn selPawn) { // do nothing if not of colony if (selPawn.Faction != Faction.OfPlayer) { yield break; } // base float menus foreach (FloatMenuOption fmo in base.GetFloatMenuOptions(selPawn)) { yield return(fmo); } // do shooting menu // ================ // Check Reachability if (!selPawn.CanReserve(this, 1)) { yield return(new FloatMenuOption("CannotUseReserved".Translate(), null)); yield break; } if (!selPawn.CanReach(this, PathEndMode.InteractionCell, Danger.Deadly)) { yield return(new FloatMenuOption("CannotUseNoPath".Translate(), null)); yield break; } // Check weapon status Verb attackVerb = null; if (selPawn != null) { attackVerb = selPawn.TryGetAttackVerb(this, true); } if (attackVerb != null && attackVerb.verbProps != null && attackVerb.verbProps.IsMeleeAttack) { Thing chair; JoyGiverDef joyGiverDef = this.GetJoyGiverDef(); IntVec3 standCell = Utility_PositionFinder.TryFindWatchBuildingPosition(selPawn, this, this.def.building.watchBuildingStandDistanceRange, joyGiverDef.desireSit, out chair); Action action_PracticeMartialArts = delegate { selPawn.drafter.Drafted = false; Job job = new Job(this.GetJobDef(), this, standCell, chair); if (job != null) { selPawn.jobs.TryTakeOrderedJob(job); } }; yield return(new FloatMenuOption("TrainingFacility_PracticeMartialArts".Translate(), action_PracticeMartialArts)); } else { yield return(new FloatMenuOption("TrainingFacility_MeleeWeaponRequired".Translate(), null)); } }
public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot) { //JoyGiverDef joyGiverDef = DefDatabase<JoyGiverDef>.GetNamed("PracticeShooting"); GenDraw.DrawFieldEdges(Utility_PositionFinder.FindAllWatchBuildingCells(center, Find.VisibleMap, def.rotatable, rot, def.building.watchBuildingStandDistanceRange).ToList <IntVec3>()); }
public IEnumerable <IntVec3> CalculateShootingCells() { JoyGiverDef joyGiverDef = this.GetJoyGiverDef(); return(Utility_PositionFinder.FindAllWatchBuildingCells(this, this.def.building.watchBuildingStandDistanceRange)); }
public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot, Color ghostCol, Thing thing = null) { //JoyGiverDef joyGiverDef = DefDatabase<JoyGiverDef>.GetNamed("PracticeMartialArts"); GenDraw.DrawFieldEdges(Utility_PositionFinder.FindAllWatchBuildingCells(center, Find.CurrentMap, def.rotatable, rot, def.building.watchBuildingStandDistanceRange).ToList <IntVec3>(), ghostCol); }