Beispiel #1
0
        private Gizmo GetControlTurretAvtivateGizmo()
        {
            Command_Target command = new Command_Target();

            command.defaultLabel    = "WTH_Gizmo_ControlTurretActivate_Label".Translate();
            command.defaultDesc     = "WTH_Gizmo_ControlTurretActivate_Description".Translate(MAXCONTROLLABLETURRETS);
            command.targetingParams = GetTargetingParametersForControlTurret();
            command.icon            = ContentFinder <Texture2D> .Get(("UI/RogueAI_Control_Turret"));

            bool shouldDisable = GlobalShouldDisable(out string reason);

            command.disabled       = shouldDisable;
            command.disabledReason = reason;
            if (controlledTurrets.Count >= MAXCONTROLLABLETURRETS)
            {
                command.disabled        = true;
                command.disabledReason += "\n- " + "WTH_Reason_AtMaximum".Translate(MAXCONTROLLABLETURRETS);
            }
            if (DataLevelComp.curLevel < MINLEVELCONTROLTURRET)
            {
                command.disabled        = true;
                command.disabledReason += "\n- " + "WTH_Reason_LevelInsufficient".Translate(MINLEVELCONTROLTURRET);
            }
            command.action = delegate(Thing target)
            {
                if (target is Building_TurretGun turret)
                {
                    DoAbility(delegate { controlledTurrets.Add(turret); }, 250);
                }
            };
            return(command);
        }
        private static Gizmo GetMeleeAttackGizmo(Pawn pawn)
        {
            Command_Target command_Target = new Command_Target();

            command_Target.defaultLabel    = "CommandMeleeAttack".Translate();
            command_Target.defaultDesc     = "CommandMeleeAttackDesc".Translate();
            command_Target.targetingParams = TargetingParameters.ForAttackAny();
            command_Target.hotKey          = KeyBindingDefOf.Misc2;
            command_Target.icon            = TexCommand.AttackMelee;
            if (FloatMenuUtility.GetMeleeAttackAction(pawn, LocalTargetInfo.Invalid, out string failStr) == null)
            {
                command_Target.Disable(failStr.CapitalizeFirst() + ".");
            }
            command_Target.action = delegate(Thing target)
            {
                IEnumerable <Pawn> enumerable = Find.Selector.SelectedObjects.Where(delegate(object x)
                {
                    Pawn pawn2 = x as Pawn;
                    return(pawn2 != null && pawn2.IsColonistPlayerControlled && pawn2.Drafted);
                }).Cast <Pawn>();
                foreach (Pawn item in enumerable)
                {
                    FloatMenuUtility.GetMeleeAttackAction(item, target, out string _)?.Invoke();
                }
            };
            return(command_Target);
        }
Beispiel #3
0
        private static Gizmo GetSquadAttackGizmo(Pawn pawn)
        {
            Command_Target command_Target = new Command_Target();

            command_Target.defaultLabel    = "CommandSquadAttack".Translate();
            command_Target.defaultDesc     = "CommandSquadAttackDesc".Translate();
            command_Target.targetingParams = TargetingParameters.ForAttackAny();
            command_Target.hotKey          = KeyBindingDefOf.Misc4;
            command_Target.icon            = TexCommand.SquadAttack;
            string str;

            if (FloatMenuUtility.GetAttackAction(pawn, LocalTargetInfo.Invalid, out str) == null)
            {
                command_Target.Disable(str.CapitalizeFirst() + ".");
            }
            command_Target.action = delegate(Thing target)
            {
                IEnumerable <Pawn> enumerable = Find.Selector.SelectedObjects.Where(delegate(object x)
                {
                    Pawn pawn3 = x as Pawn;
                    return(pawn3 != null && pawn3.IsColonistPlayerControlled && pawn3.Drafted);
                }).Cast <Pawn>();
                foreach (Pawn pawn2 in enumerable)
                {
                    string text;
                    Action attackAction = FloatMenuUtility.GetAttackAction(pawn2, target, out text);
                    if (attackAction != null)
                    {
                        attackAction();
                    }
                }
            };
            return(command_Target);
        }
Beispiel #4
0
        private Gizmo GetHackingAvtivateGizmo()
        {
            Command_Target command = new Command_Target();

            command.defaultLabel    = "WTH_Gizmo_HackingAvtivate_Label".Translate();
            command.defaultDesc     = "WTH_Gizmo_HackingAvtivate_Description".Translate(MAXHACKABLE);
            command.targetingParams = GetTargetingParametersForHacking();
            command.hotKey          = KeyBindingDefOf.Misc5;
            command.icon            = ContentFinder <Texture2D> .Get(("UI/RogueAI_Hack"));

            bool shouldDisable = GlobalShouldDisable(out string reason);

            command.disabled       = shouldDisable;
            command.disabledReason = reason;
            if (hackedMechs.Count >= MAXHACKABLE)
            {
                command.disabled        = true;
                command.disabledReason += "\n- " + "WTH_Reason_AtMaximum".Translate(MAXHACKABLE);
            }
            if (DataLevelComp.curLevel < MINLEVELHACKMECH)
            {
                command.disabled        = true;
                command.disabledReason += "\n- " + "WTH_Reason_LevelInsufficient".Translate(MINLEVELHACKMECH);
            }

            command.action = delegate(Thing target)
            {
                if (target is Pawn mech)
                {
                    DoAbility(delegate { HackMech(mech); }, 600);
                }
            };
            return(command);
        }
Beispiel #5
0
        private Gizmo GetControlMechanoidActivateGizmo()
        {
            Command_Target command = new Command_Target();

            command.defaultLabel    = "WTH_Gizmo_ControlMechanoidActivate_Label".Translate();
            command.defaultDesc     = "WTH_Gizmo_ControlMechanoidActivate_Description".Translate(MAXCONTROLLABLEMECHS);
            command.targetingParams = GetTargetingParametersForControlling();
            command.hotKey          = KeyBindingDefOf.Misc5;
            command.icon            = ContentFinder <Texture2D> .Get(("UI/RogueAI_Control"));

            bool shouldDisable = GlobalShouldDisable(out string reason);

            command.disabled       = shouldDisable;
            command.disabledReason = reason;
            if (controlledMechs.Count >= MAXCONTROLLABLEMECHS)
            {
                command.disabled        = true;
                command.disabledReason += "\n- " + "WTH_Reason_AtMaximum".Translate(MAXCONTROLLABLEMECHS);
            }
            if (DataLevelComp.curLevel < MINLEVELCONTROLMECH)
            {
                command.disabled        = true;
                command.disabledReason += "\n- " + "WTH_Reason_LevelInsufficient".Translate(MINLEVELCONTROLMECH);
            }

            command.action = delegate(LocalTargetInfo target)
            {
                if (target.HasThing && target.Thing is Pawn mech)
                {
                    DoAbility(delegate { ControlMechanoid(mech); }, 250);
                }
            };
            return(command);
        }
Beispiel #6
0
        private static Gizmo GetMeleeAttackGizmo(Pawn pawn)
        {
            Command_Target command_Target = new Command_Target();

            command_Target.defaultLabel    = "CommandMeleeAttack".Translate();
            command_Target.defaultDesc     = "CommandMeleeAttackDesc".Translate();
            command_Target.targetingParams = TargetingParameters.ForAttackAny();
            command_Target.hotKey          = KeyBindingDefOf.Misc2;
            command_Target.icon            = TexCommand.AttackMelee;
            if (FloatMenuUtility.GetMeleeAttackAction(pawn, LocalTargetInfo.Invalid, out var failStr) == null)
            {
                command_Target.Disable(failStr.CapitalizeFirst() + ".");
            }
            command_Target.action = delegate(Thing target)
            {
                foreach (Pawn item in Find.Selector.SelectedObjects.Where(delegate(object x)
                {
                    Pawn pawn2 = x as Pawn;
                    return(pawn2 != null && pawn2.IsColonistPlayerControlled && pawn2.Drafted);
                }).Cast <Pawn>())
                {
                    string failStr2;
                    Action meleeAttackAction = FloatMenuUtility.GetMeleeAttackAction(item, target, out failStr2);
                    if (meleeAttackAction != null)
                    {
                        meleeAttackAction();
                    }
                    else if (!failStr2.NullOrEmpty())
                    {
                        Messages.Message(failStr2, target, MessageTypeDefOf.RejectInput, historical: false);
                    }
                }
            };
            return(command_Target);
        }
Beispiel #7
0
 public Command_Target_Extended(Command_Target original)
 {
     defaultLabel    = original.defaultLabel;
     defaultDesc     = original.defaultDesc;
     targetingParams = original.targetingParams;
     hotKey          = original.hotKey;
     icon            = original.icon;
     action          = original.action;
     disabled        = original.disabled;
     disabledReason  = original.disabledReason;
 }
        private static void PawnAttackGizmoUtility_GetSquadAttackGizmoPostfix(Pawn pawn, ref Gizmo __result)
        {
            Command_Target command_Target = (Command_Target)__result;
            bool           flag           = false;
            List <object>  selectedObjectsListForReading = Find.Selector.SelectedObjectsListForReading;

            if (selectedObjectsListForReading.Count > 1)
            {
                for (int i = 0; i < selectedObjectsListForReading.Count; i++)
                {
                    Pawn pawn2 = selectedObjectsListForReading[i] as Pawn;
                    if (pawn2 != null && pawn2.IsColonistPlayerControlled && pawn2.GetComp <VEF_Comp_Pawn_RangedVerbs>().CurRangedVerb != null && pawn2.GetComp <VEF_Comp_Pawn_RangedVerbs>().CurRangedVerb.IsStillUsableBy(pawn2) && (pawn2.GetComp <VEF_Comp_Pawn_RangedVerbs>().CurRangedVerb.EquipmentSource == null || pawn2.GetComp <VEF_Comp_Pawn_RangedVerbs>().CurRangedVerb.EquipmentSource != pawn2.equipment.Primary))
                    {
                        flag = true;
                    }
                }
            }
            if (flag || (VEF_Comp_Pawn_RangedVerbs.ShouldUseSquadAttackGizmo()))
            {
                command_Target.defaultLabel = "CommandSquadEquipmentAttack".Translate();
                command_Target.defaultDesc  = "CommandSquadEquipmentAttackDesc".Translate();
                if (FloatMenuUtility.GetAttackAction(pawn, LocalTargetInfo.Invalid, out string str) == null)
                {
                    command_Target.Disable(str.CapitalizeFirst() + ".");
                }
                command_Target.action = delegate(Thing target)
                {
                    IEnumerable <Pawn> pawns = Find.Selector.SelectedObjects.Where(delegate(object x)
                    {
                        Pawn pawn3 = x as Pawn;
                        return(pawn3 != null && pawn3.IsColonistPlayerControlled && pawn3.Drafted);
                    }).Cast <Pawn>();
                    foreach (Pawn pawn2 in pawns)
                    {
                        if (pawn2.equipment != null && pawn2.equipment.Primary != null && !pawn2.equipment.PrimaryEq.PrimaryVerb.IsMeleeAttack && (pawn2.GetComp <VEF_Comp_Pawn_RangedVerbs>().CurRangedVerb.EquipmentSource == null || pawn2.GetComp <VEF_Comp_Pawn_RangedVerbs>().CurRangedVerb.EquipmentSource.def != pawn2.equipment.Primary.def))
                        {
                            pawn2.GetComp <VEF_Comp_Pawn_RangedVerbs>().SetCurRangedVerb(pawn2.equipment.PrimaryEq.PrimaryVerb, null);
                        }
                        string text;
                        FloatMenuUtility.GetAttackAction(pawn2, target, out text)?.Invoke();
                    }
                };
                __result = command_Target;
            }
            return;
        }
        private static Gizmo GetRemoteControlActivateGizmo(Pawn pawn)
        {
            Command_Target command_Target = new Command_Target();

            command_Target.defaultLabel    = "WTH_Gizmo_RemoteControlActivate_Label".Translate();
            command_Target.defaultDesc     = "WTH_Gizmo_RemoteControlActivate_Description".Translate();
            command_Target.targetingParams = GetTargetingParametersForHacking();
            command_Target.hotKey          = KeyBindingDefOf.Misc5;
            if (pawn.Drafted)
            {
                command_Target.Disable("WTH_Reason_PawnCannotBeDrafted".Translate());
            }
            command_Target.icon = ContentFinder <Texture2D> .Get(("Things/MechControllerBelt"));

            command_Target.action = delegate(Thing target)
            {
                if (target is Pawn)
                {
                    pawn.jobs.EndCurrentJob(JobCondition.InterruptForced, false);
                    Pawn             mech     = (Pawn)target;
                    ExtendedPawnData pawnData = Base.Instance.GetExtendedDataStorage().GetExtendedDataFor(pawn);
                    ExtendedPawnData mechData = Base.Instance.GetExtendedDataStorage().GetExtendedDataFor(mech);
                    pawnData.remoteControlLink = mech;
                    mechData.remoteControlLink = pawn;
                    mechData.isActive          = true;
                    mech.drafter.Drafted       = true;
                    Find.Selector.ClearSelection();
                    Find.Selector.Select(mech);
                    if (pawn.GetLord() == null || pawn.GetLord().LordJob == null)
                    {
                        LordMaker.MakeNewLord(Faction.OfPlayer, new LordJob_ControlMechanoid(), pawn.Map, new List <Pawn> {
                            pawn
                        });
                        pawn.mindState.duty.focus = mech;
                    }
                }
            };
            return(command_Target);
        }
Beispiel #10
0
        private Gizmo GetCombineGizmo(Thing objectA)
        {
            Command_Target command_Target = new Command_Target();

            command_Target.defaultLabel    = GetLabel();
            command_Target.defaultDesc     = GetDescription();
            command_Target.targetingParams = GetTargetingParameters();
            command_Target.hotKey          = KeyBindingDefOf.Misc1;
            command_Target.icon            = GetIcon();
            command_Target.action          = delegate(Thing objectB)
            {
                if (CanCombine(objectA, objectB))
                {
                    CombineAction(objectA, objectB);
                }
                else
                {
                    SoundDefOf.ClickReject.PlayOneShotOnCamera();
                }
            };
            return(command_Target);
        }
Beispiel #11
0
        public static void AddGizmo(Pawn __instance, ref IEnumerable <Gizmo> __result)
        {
            //I want access to the pawn object, and want to modify the original method's result
            var pawn   = __instance;
            var gizmos = __result.ToList();
            // First two flags detect if the pawn is mine, and if it is

            bool flagIsCreatureMine      = pawn.Faction != null && pawn.Faction.IsPlayer;
            bool flagIsCreatureDraftable = (pawn.TryGetComp <CompDraftable>() != null);

            /* I check these flags only inside flagIsCreatureDraftable true to avoid errors due to pawn.TryGetComp<CompDraftable>() being null in most pawns. The code inside
             * the conditional only executes if it isn't*/
            bool flagIsCreatureRageable         = false;
            bool flagIsCreatureExplodable       = false;
            bool flagIsCreatureChickenRimPox    = false;
            bool flagCanCreatureCarryMore       = false;
            bool flagCanCreatureAdrenalineBurst = false;
            bool flagCanCanDoInsectClouds       = false;
            bool flagCanStampede         = false;
            bool flagCanDoPoisonousCloud = false;
            bool flagCanBurrow           = false;
            bool flagCanStamina          = false;
            bool flagCanHorrorize        = false;
            bool flagCanMechaBlast       = false;
            bool flagCanKeenSenses       = false;
            bool flagCanCatReflexes      = false;



            bool flagIsMindControlBuildingPresent = false;

            if (flagIsCreatureDraftable)
            {
                /*Inside here, I check if the Building is present in the map. I only want to do the check for
                 * hybrids, or it will do this iterator for every creature in the map
                 */
                foreach (Thing t in pawn.Map.listerThings.ThingsOfDef(ThingDef.Named("GR_AnimalControlHub")))
                {
                    Thing mindcontrolhub = t as Thing;
                    if (t != null)
                    {
                        flagIsCreatureRageable         = pawn.TryGetComp <CompDraftable>().GetRage;
                        flagIsCreatureExplodable       = pawn.TryGetComp <CompDraftable>().GetExplodable;
                        flagIsCreatureChickenRimPox    = pawn.TryGetComp <CompDraftable>().GetChickenRimPox;
                        flagCanCreatureCarryMore       = pawn.TryGetComp <CompDraftable>().GetCanCarryMore;
                        flagCanCreatureAdrenalineBurst = pawn.TryGetComp <CompDraftable>().GetAdrenalineBurst;
                        flagCanCanDoInsectClouds       = pawn.TryGetComp <CompDraftable>().GetCanDoInsectClouds;
                        flagCanStampede         = pawn.TryGetComp <CompDraftable>().GetCanStampede;
                        flagCanDoPoisonousCloud = pawn.TryGetComp <CompDraftable>().GetCanDoPoisonousCloud;
                        flagCanBurrow           = pawn.TryGetComp <CompDraftable>().GetCanBurrow;
                        flagCanStamina          = pawn.TryGetComp <CompDraftable>().HasDinoStamina;
                        flagCanHorrorize        = pawn.TryGetComp <CompDraftable>().GetHorror;
                        flagCanMechaBlast       = pawn.TryGetComp <CompDraftable>().GetMechablast;
                        flagCanKeenSenses       = pawn.TryGetComp <CompDraftable>().GetKeenSenses;
                        flagCanCatReflexes      = pawn.TryGetComp <CompDraftable>().GetCatReflexes;


                        flagIsMindControlBuildingPresent = true;
                    }
                }
            }


            /*Is the creature part of the colony, and draftable (the custom comp class)? Then display the drafting gizmo, called
             * Mind Control. It's action is just calling on toggle the Drafted method in the pawn's drafter, which
             * we initialized in the first Harmony Postfix
             */
            if ((pawn.drafter != null) && flagIsCreatureMine && flagIsCreatureDraftable && flagIsMindControlBuildingPresent || pawn.def.defName == "GR_ArchotechCentipede")
            {
                Command_Action GR_Gizmo_MindControl = new Command_Action();
                GR_Gizmo_MindControl.action = delegate
                {
                    pawn.drafter.Drafted = !pawn.drafter.Drafted;
                };
                GR_Gizmo_MindControl.defaultLabel = "GR_CreatureMindControl".Translate();
                GR_Gizmo_MindControl.defaultDesc  = "GR_CreatureMindControlDesc".Translate();
                GR_Gizmo_MindControl.icon         = ContentFinder <Texture2D> .Get("ui/commands/GR_ControlAnimal", true);

                gizmos.Insert(0, GR_Gizmo_MindControl);
            }

            /*If the creature is draftable, drafted at the moment and the rage property (which is passed through XML and the custom comp class) is true,
             * we add a second gizmo, which copies the code from melee attacks, and thus allows targeting melee attacks
             */
            if ((pawn.drafter != null) && flagIsCreatureRageable && flagIsCreatureMine && pawn.drafter.Drafted && flagIsMindControlBuildingPresent)
            {
                Command_Target GR_Gizmo_AttackRage = new Command_Target();
                GR_Gizmo_AttackRage.defaultLabel    = "GR_CreatureRageAttack".Translate();
                GR_Gizmo_AttackRage.defaultDesc     = "GR_CreatureRageAttackDesc".Translate();
                GR_Gizmo_AttackRage.targetingParams = TargetingParameters.ForAttackAny();
                GR_Gizmo_AttackRage.icon            = ContentFinder <Texture2D> .Get("Things/Item/AnimalPaws", true);

                GR_Gizmo_AttackRage.action = delegate(Thing target)
                {
                    IEnumerable <Pawn> enumerable = Find.Selector.SelectedObjects.Where(delegate(object x)
                    {
                        Pawn pawn2 = x as Pawn;
                        return(pawn2 != null && pawn2.Drafted);
                    }).Cast <Pawn>();
                    foreach (Pawn current in enumerable)
                    {
                        Job  job   = new Job(JobDefOf.AttackMelee, target);
                        Pawn pawn2 = target as Pawn;
                        if (pawn2 != null)
                        {
                            job.killIncappedTarget = pawn2.Downed;
                        }
                        pawn.jobs.TryTakeOrderedJob(job, JobTag.Misc);
                    }
                };
                gizmos.Insert(1, GR_Gizmo_AttackRage);
            }

            /*This adds a gizmo that makes the creature attack once, and then cause a Hediff disease (GR_ChickenRimPox), then cancels the draft. I used a custom Jobdriver class for that
             */
            if ((pawn.drafter != null) && flagIsCreatureChickenRimPox && flagIsCreatureMine && pawn.drafter.Drafted && flagIsMindControlBuildingPresent || pawn.def.defName == "GR_ArchotechCentipede")
            {
                Command_Target GR_Gizmo_AttackPox = new Command_Target();
                GR_Gizmo_AttackPox.defaultLabel    = "GR_InflictChickenRimPox".Translate();
                GR_Gizmo_AttackPox.defaultDesc     = "GR_InflictChickenRimPoxDesc".Translate();
                GR_Gizmo_AttackPox.targetingParams = TargetingParameters.ForAttackAny();
                GR_Gizmo_AttackPox.icon            = ContentFinder <Texture2D> .Get("ui/commands/GR_ChickenRimPox", true);

                GR_Gizmo_AttackPox.action = delegate(Thing target)
                {
                    IEnumerable <Pawn> enumerable = Find.Selector.SelectedObjects.Where(delegate(object x)
                    {
                        Pawn pawn2 = x as Pawn;
                        return(pawn2 != null && pawn2.Drafted);
                    }).Cast <Pawn>();
                    foreach (Pawn current in enumerable)
                    {
                        Job  job   = new Job(DefDatabase <JobDef> .GetNamed("GR_AttackMeleeOnceAndChickenRimPox", true), target);
                        Pawn pawn2 = target as Pawn;
                        if (pawn2 != null)
                        {
                            job.killIncappedTarget = pawn2.Downed;
                        }
                        pawn.jobs.TryTakeOrderedJob(job, JobTag.Misc);
                    }
                };
                gizmos.Insert(1, GR_Gizmo_AttackPox);
            }

            /*If the creature is explodable, we add this gizmo, which causes a Heddif called "sudden explosion" (GR_Kamikaze), and increases severity to
             * 1 to make the creature die. This only works if the creature also has DeathActionWorker.
             */
            if ((pawn.drafter != null) && flagIsCreatureExplodable && flagIsCreatureMine && flagIsMindControlBuildingPresent)
            {
                Command_Action GR_Gizmo_Detonate = new Command_Action();
                GR_Gizmo_Detonate.action = delegate
                {
                    pawn.health.AddHediff(HediffDef.Named("GR_Kamikaze"));
                    HealthUtility.AdjustSeverity(pawn, HediffDef.Named("GR_Kamikaze"), 1);
                };
                GR_Gizmo_Detonate.defaultLabel = "GR_DetonateChemfuel".Translate();
                GR_Gizmo_Detonate.defaultDesc  = "GR_DetonateChemfuelDesc".Translate();
                GR_Gizmo_Detonate.icon         = ContentFinder <Texture2D> .Get("UI/Commands/Detonate", true);

                gizmos.Insert(1, GR_Gizmo_Detonate);
            }

            /* This is a dummy gizmo. It only displays, but does nothing on click. The processing is done below in another Harmony patch to MassUtility.Capacity
             */
            if ((pawn.drafter != null) && flagCanCreatureCarryMore && flagIsCreatureMine && flagIsMindControlBuildingPresent)
            {
                Command_Action GR_Gizmo_Carry = new Command_Action();
                GR_Gizmo_Carry.action = delegate
                {
                };
                GR_Gizmo_Carry.defaultLabel = "GR_CarryMore".Translate();
                GR_Gizmo_Carry.defaultDesc  = "GR_CarryMoreDesc".Translate();
                GR_Gizmo_Carry.icon         = ContentFinder <Texture2D> .Get("ui/commands/GR_IncreasedCarry", true);

                gizmos.Insert(1, GR_Gizmo_Carry);
            }

            /*This gizmo applies a Hediff that makes the pawn move faster for a while
             */
            if ((pawn.drafter != null) && flagCanCreatureAdrenalineBurst && flagIsCreatureMine && flagIsMindControlBuildingPresent || pawn.def.defName == "GR_ArchotechCentipede")
            {
                Command_Action GR_Gizmo_AdrenalineBurst = new Command_Action();
                GR_Gizmo_AdrenalineBurst.defaultLabel = "GR_StartAdrenalineBurst".Translate();
                GR_Gizmo_AdrenalineBurst.defaultDesc  = "GR_StartAdrenalineBurstDesc".Translate();
                GR_Gizmo_AdrenalineBurst.icon         = ContentFinder <Texture2D> .Get("ui/commands/GR_AdrenalineBurst", true);

                GR_Gizmo_AdrenalineBurst.action = delegate
                {
                    if (!pawn.health.hediffSet.HasHediff(HediffDef.Named("GR_AdrenalineBurst")))
                    {
                        pawn.health.AddHediff(HediffDef.Named("GR_AdrenalineBurst"));
                    }
                    else
                    {
                        Messages.Message("GR_AbilityRecharging".Translate(), pawn, MessageTypeDefOf.NeutralEvent);
                    }
                };
                gizmos.Insert(1, GR_Gizmo_AdrenalineBurst);
            }

            /*This gizmo applies a Hediff that makes the pawn release insect clouds for a while
             */
            if ((pawn.drafter != null) && flagCanCanDoInsectClouds && flagIsCreatureMine && flagIsMindControlBuildingPresent)
            {
                Command_Action GR_Gizmo_InsectClouds = new Command_Action();
                GR_Gizmo_InsectClouds.defaultLabel = "GR_ReleaseInsectClouds".Translate();
                GR_Gizmo_InsectClouds.defaultDesc  = "GR_ReleaseInsectCloudsDesc".Translate();
                GR_Gizmo_InsectClouds.icon         = ContentFinder <Texture2D> .Get("ui/commands/GR_Insectclouds", true);

                GR_Gizmo_InsectClouds.action = delegate
                {
                    if (!pawn.health.hediffSet.HasHediff(HediffDef.Named("GR_InsectClouds")))

                    {
                        pawn.health.AddHediff(HediffDef.Named("GR_InsectClouds"));
                    }
                    else
                    {
                        Messages.Message("GR_AbilityRecharging".Translate(), pawn, MessageTypeDefOf.NeutralEvent);
                    }
                };
                gizmos.Insert(1, GR_Gizmo_InsectClouds);
            }

            /*This gizmo applies a Hediff that makes the pawn generate stampede clouds for a while
             */
            if ((pawn.drafter != null) && flagCanStampede && flagIsCreatureMine && flagIsMindControlBuildingPresent || pawn.def.defName == "GR_ArchotechCentipede")
            {
                Command_Action GR_Gizmo_Stampede = new Command_Action();
                GR_Gizmo_Stampede.defaultLabel = "GR_StartStampede".Translate();
                GR_Gizmo_Stampede.defaultDesc  = "GR_StartStampedeDesc".Translate();
                GR_Gizmo_Stampede.icon         = ContentFinder <Texture2D> .Get("ui/commands/GR_StampedeClouds", true);

                GR_Gizmo_Stampede.action = delegate
                {
                    if (!pawn.health.hediffSet.HasHediff(HediffDef.Named("GR_Stampeding")))
                    {
                        pawn.health.AddHediff(HediffDef.Named("GR_Stampeding"));
                    }
                    else
                    {
                        Messages.Message("GR_AbilityRecharging".Translate(), pawn, MessageTypeDefOf.NeutralEvent);
                    }
                };
                gizmos.Insert(1, GR_Gizmo_Stampede);
            }

            /*This gizmo adds an attack that spawns a poison cloud at a target's location
             */
            if ((pawn.drafter != null) && flagCanDoPoisonousCloud && flagIsCreatureMine && flagIsMindControlBuildingPresent)
            {
                Command_Target GR_Gizmo_PoisonCloud = new Command_Target();
                GR_Gizmo_PoisonCloud.defaultLabel    = "GR_CreatePoisonousCloud".Translate();
                GR_Gizmo_PoisonCloud.defaultDesc     = "GR_CreatePoisonousCloudDesc".Translate();
                GR_Gizmo_PoisonCloud.targetingParams = TargetingParameters.ForAttackAny();
                GR_Gizmo_PoisonCloud.icon            = ContentFinder <Texture2D> .Get("ui/commands/GR_PoisonousCloud", true);

                GR_Gizmo_PoisonCloud.action = delegate(Thing target)
                {
                    if (!pawn.health.hediffSet.HasHediff(HediffDef.Named("GR_CausedPoisonCloud")))
                    {
                        Pawn pawn2 = target as Pawn;
                        if (pawn2 != null)
                        {
                            if (pawn.Position.InHorDistOf(pawn2.Position, 10))
                            {
                                List <IntVec3> list = GenAdj.AdjacentCells8WayRandomized();
                                for (int i = 0; i < 8; i++)
                                {
                                    IntVec3 c2 = pawn2.Position + list[i];
                                    if (c2.InBounds(pawn2.Map))
                                    {
                                        Thing thing = ThingMaker.MakeThing(ThingDef.Named("GR_Poison_Cloud"), null);

                                        GenSpawn.Spawn(thing, c2, pawn2.Map);
                                    }
                                }
                                pawn.health.AddHediff(HediffDef.Named("GR_CausedPoisonCloud"));
                            }
                            else
                            {
                                Messages.Message("GR_PoisonCloudRange".Translate(), pawn, MessageTypeDefOf.NeutralEvent);
                            }
                        }
                    }
                    else
                    {
                        Messages.Message("GR_AbilityRecharging".Translate(), pawn, MessageTypeDefOf.NeutralEvent);
                    }
                };
                gizmos.Insert(1, GR_Gizmo_PoisonCloud);
            }

            /*This gizmo puts the creature into burrowing mode
             */
            if ((pawn.drafter != null) && flagCanBurrow && flagIsCreatureMine && flagIsMindControlBuildingPresent || pawn.def.defName == "GR_ArchotechCentipede")
            {
                Command_Action GR_Gizmo_Burrowing = new Command_Action();
                GR_Gizmo_Burrowing.action = delegate
                {
                    if (!pawn.health.hediffSet.HasHediff(HediffDef.Named("GR_Burrowing")))
                    {
                        pawn.health.AddHediff(HediffDef.Named("GR_Burrowing"));
                    }
                    else
                    {
                        Messages.Message("GR_AbilityRecharging".Translate(), pawn, MessageTypeDefOf.NeutralEvent);
                    }
                };
                GR_Gizmo_Burrowing.defaultLabel = "GR_StartBurrowing".Translate();
                GR_Gizmo_Burrowing.defaultDesc  = "GR_StartBurrowingDesc".Translate();
                GR_Gizmo_Burrowing.icon         = ContentFinder <Texture2D> .Get("Things/Pawn/Animal/Special/GR_Special_Burrowing", true);

                gizmos.Insert(1, GR_Gizmo_Burrowing);
            }

            /*This gizmo makes the animal more resistant for a while
             */
            if ((pawn.drafter != null) && flagCanStamina && flagIsCreatureMine && flagIsMindControlBuildingPresent)
            {
                Command_Action GR_Gizmo_Stamina = new Command_Action();
                GR_Gizmo_Stamina.action = delegate
                {
                    if (!pawn.health.hediffSet.HasHediff(HediffDef.Named("GR_Stamina")))
                    {
                        pawn.health.AddHediff(HediffDef.Named("GR_Stamina"));
                    }
                    else
                    {
                        Messages.Message("GR_AbilityRecharging".Translate(), pawn, MessageTypeDefOf.NeutralEvent);
                    }
                };
                GR_Gizmo_Stamina.defaultLabel = "GR_StartStamina".Translate();
                GR_Gizmo_Stamina.defaultDesc  = "GR_StartStaminaDesc".Translate();
                GR_Gizmo_Stamina.icon         = ContentFinder <Texture2D> .Get("ui/commands/GR_Stamina", true);

                gizmos.Insert(1, GR_Gizmo_Stamina);
            }

            /*This gizmo makes the animal more aware (sight and consciousness) for a while
             */
            if ((pawn.drafter != null) && flagCanKeenSenses && flagIsCreatureMine && flagIsMindControlBuildingPresent)
            {
                Command_Action GR_Gizmo_KeenSenses = new Command_Action();
                GR_Gizmo_KeenSenses.action = delegate
                {
                    if (!pawn.health.hediffSet.HasHediff(HediffDef.Named("GR_KeenSenses")))
                    {
                        pawn.health.AddHediff(HediffDef.Named("GR_KeenSenses"));
                    }
                    else
                    {
                        Messages.Message("GR_AbilityRecharging".Translate(), pawn, MessageTypeDefOf.NeutralEvent);
                    }
                };
                GR_Gizmo_KeenSenses.defaultLabel = "GR_StartKeenSenses".Translate();
                GR_Gizmo_KeenSenses.defaultDesc  = "GR_StartKeenSensesDesc".Translate();
                GR_Gizmo_KeenSenses.icon         = ContentFinder <Texture2D> .Get("ui/commands/GR_KeenSenses", true);

                gizmos.Insert(1, GR_Gizmo_KeenSenses);
            }

            /*This gizmo activates cat reflexes, improving melee combat
             */
            if ((pawn.drafter != null) && flagCanCatReflexes && flagIsCreatureMine && flagIsMindControlBuildingPresent || pawn.def.defName == "GR_ArchotechCentipede")
            {
                Command_Action GR_Gizmo_CatReflexes = new Command_Action();
                GR_Gizmo_CatReflexes.action = delegate
                {
                    if (!pawn.health.hediffSet.HasHediff(HediffDef.Named("GR_CatReflexes")))
                    {
                        pawn.health.AddHediff(HediffDef.Named("GR_CatReflexes"));
                    }
                    else
                    {
                        Messages.Message("GR_AbilityRecharging".Translate(), pawn, MessageTypeDefOf.NeutralEvent);
                    }
                };
                GR_Gizmo_CatReflexes.defaultLabel = "GR_StartCatReflexes".Translate();
                GR_Gizmo_CatReflexes.defaultDesc  = "GR_StartCatReflexesDesc".Translate();
                GR_Gizmo_CatReflexes.icon         = ContentFinder <Texture2D> .Get("ui/commands/GR_CatReflexes", true);

                gizmos.Insert(1, GR_Gizmo_CatReflexes);
            }

            /*This gizmo makes the animal cast a horror ability
             */
            if ((pawn.drafter != null) && flagCanHorrorize && flagIsCreatureMine && flagIsMindControlBuildingPresent)
            {
                Command_Target GR_Gizmo_Horror = new Command_Target();
                GR_Gizmo_Horror.defaultLabel    = "GR_StartInvokingInsanity".Translate();
                GR_Gizmo_Horror.defaultDesc     = "GR_StartInvokingInsanityDesc".Translate();
                GR_Gizmo_Horror.targetingParams = TargetingParameters.ForAttackAny();
                GR_Gizmo_Horror.icon            = ContentFinder <Texture2D> .Get("Item/Weapon/MiGoCasterWeapon/MiGoCasterWeaponA", true);

                GR_Gizmo_Horror.action = delegate(Thing target)
                {
                    if (!pawn.health.hediffSet.HasHediff(HediffDef.Named("GR_CausedHorror")))
                    {
                        Pawn pawn2 = target as Pawn;
                        if (pawn2 != null)
                        {
                            if (pawn.Position.InHorDistOf(pawn2.Position, 10))
                            {
                                List <IntVec3> list = GenAdj.AdjacentCells8WayRandomized();
                                for (int i = 0; i < 8; i++)
                                {
                                    IntVec3 c2 = pawn2.Position + list[i];
                                    if (c2.InBounds(pawn2.Map))
                                    {
                                        Thing thing = ThingMaker.MakeThing(ThingDef.Named("GR_Insanity_Cloud"), null);

                                        GenSpawn.Spawn(thing, c2, pawn2.Map);
                                    }
                                }
                                pawn.health.AddHediff(HediffDef.Named("GR_CausedHorror"));
                            }
                            else
                            {
                                Messages.Message("GR_InvokingInsanityRange".Translate(), pawn, MessageTypeDefOf.NeutralEvent);
                            }
                        }
                    }
                    else
                    {
                        Messages.Message("GR_AbilityRecharging".Translate(), pawn, MessageTypeDefOf.NeutralEvent);
                    }
                };
                gizmos.Insert(1, GR_Gizmo_Horror);
            }

            /*This gizmo makes the animal release a burning explosion
             */
            if ((pawn.drafter != null) && flagCanMechaBlast && flagIsCreatureMine && flagIsMindControlBuildingPresent || pawn.def.defName == "GR_ArchotechCentipede")
            {
                Command_Action GR_Gizmo_MechaBlast = new Command_Action();
                GR_Gizmo_MechaBlast.action = delegate
                {
                    if (!pawn.health.hediffSet.HasHediff(HediffDef.Named("GR_VentedExhaust")))
                    {
                        foreach (IntVec3 c in GenAdj.CellsAdjacent8Way(pawn))
                        {
                            GenExplosion.DoExplosion(c, pawn.Map, (float)0.25, DamageDefOf.Flame, pawn, 25, 5, null, null, null, null, ThingDef.Named("Filth_Ash"), .7f, 1, false, null, 0f, 1);
                        }


                        pawn.health.AddHediff(HediffDef.Named("GR_VentedExhaust"));
                    }
                    else
                    {
                        Messages.Message("GR_AbilityRecharging".Translate(), pawn, MessageTypeDefOf.NeutralEvent);
                    }
                };
                GR_Gizmo_MechaBlast.defaultLabel = "GR_StartMechaBlast".Translate();
                GR_Gizmo_MechaBlast.defaultDesc  = "GR_StartMechaBlastDesc".Translate();
                GR_Gizmo_MechaBlast.icon         = ContentFinder <Texture2D> .Get("ui/commands/GR_MechaBlast", true);

                gizmos.Insert(1, GR_Gizmo_MechaBlast);
            }

            /*This gizmo activates the orbital beam
             */
            if ((pawn.drafter != null) && flagIsCreatureMine && pawn.def.defName == "GR_ArchotechCentipede")
            {
                Command_Target GR_Gizmo_Orbital = new Command_Target();
                GR_Gizmo_Orbital.defaultLabel    = "GR_Orbital".Translate();
                GR_Gizmo_Orbital.defaultDesc     = "GR_OrbitalDesc".Translate();
                GR_Gizmo_Orbital.targetingParams = TargetingParameters.ForAttackAny();
                GR_Gizmo_Orbital.icon            = ContentFinder <Texture2D> .Get("ui/commands/GR_Orbital", true);

                GR_Gizmo_Orbital.action = delegate(Thing target)
                {
                    if (!pawn.health.hediffSet.HasHediff(HediffDef.Named("GR_CausedPowerBeam")))
                    {
                        if (target.Map == pawn.Map)
                        {
                            PowerBeam powerBeam = (PowerBeam)GenSpawn.Spawn(ThingDefOf.PowerBeam, target.Position, pawn.Map, WipeMode.Vanish);
                            powerBeam.duration   = 600;
                            powerBeam.instigator = pawn;
                            powerBeam.weaponDef  = null;
                            powerBeam.StartStrike();
                            pawn.health.AddHediff(HediffDef.Named("GR_CausedPowerBeam"));
                        }
                    }
                    else
                    {
                        Messages.Message("GR_AbilityRecharging".Translate(), pawn, MessageTypeDefOf.NeutralEvent);
                    }
                };
                gizmos.Insert(1, GR_Gizmo_Orbital);
            }



            __result = gizmos;
        }