コード例 #1
0
        private static void LayEggTogether()
        {
            var males   = Find.Selector.SelectedPawns.Where(candidate => candidate.gender == Gender.Male);
            var females = Find.Selector.SelectedPawns.Where(candidate => candidate.gender == Gender.Female);

            if (males.Count() != 1 || females.Count() != 1)
            {
                return;
            }

            var female       = females.First();
            var eggLayerComp = female.GetComp <RimWorld.CompEggLayer>();

            if (eggLayerComp == null)
            {
                return;
            }

            eggLayerComp.Fertilize(males.First());

            var egg = eggLayerComp.ProduceEgg();

            if (egg == null)
            {
                return;
            }

            GenSpawn.Spawn(egg, female.Position, female.Map, WipeMode.Vanish);

            DebugActionsUtility.DustPuffFrom(female);
        }
コード例 #2
0
        private static void GiveAbility()
        {
            List <DebugMenuOption> list = new List <DebugMenuOption>();

            foreach (Abilities.AbilityDef def in DefDatabase <Abilities.AbilityDef> .AllDefs)
            {
                Abilities.AbilityDef abilityDef = def;

                list.Add(new
                         DebugMenuOption($"{(abilityDef.requiredHediff != null ? $"{abilityDef.requiredHediff.hediffDef.LabelCap} ({abilityDef.requiredHediff.minimumLevel}): " : string.Empty)}{abilityDef.LabelCap}",
                                         DebugMenuOptionMode.Tool, () =>
                {
                    foreach (Pawn item in (from t in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell())
                                           where t is Pawn
                                           select t).Cast <Pawn>())
                    {
                        CompAbilities abilityComp = item.TryGetComp <CompAbilities>();
                        if (abilityComp != null)
                        {
                            abilityComp.GiveAbility(abilityDef);
                            DebugActionsUtility.DustPuffFrom(item);
                        }
                    }
                }));
            }

            Find.WindowStack.Add(new Dialog_DebugOptionListLister(list));
        }
コード例 #3
0
 static void RecruitFormerHuman(Pawn pawn)
 {
     if (pawn?.IsSapientFormerHuman() == true)
     {
         Worker_FormerHumanRecruitAttempt.DoRecruit(pawn.Map.mapPawns.FreeColonists.FirstOrDefault(), pawn, 1f);
         DebugActionsUtility.DustPuffFrom(pawn);
     }
 }
コード例 #4
0
        public static void ToggleScoreLogging(Pawn p)
        {
            var man = p.Manager();

            man.debugOpts.ScoreLogging = !man.debugOpts.ScoreLogging;
            DebugActionsUtility.DustPuffFrom(p);
            MoteMaker.ThrowText(p.DrawPos, p.Map, p.LabelShort + "\n" + (man.debugOpts.ScoreLogging ? "ON" : "OFF"));
        }
コード例 #5
0
        static void RecruitFormerHuman(Pawn pawn)
        {
            var sapienceState = pawn?.GetSapienceState();

            if (sapienceState?.IsFormerHuman == true)
            {
                Worker_FormerHumanRecruitAttempt.DoRecruit(pawn.Map.mapPawns.FreeColonists.FirstOrDefault(), pawn, 1f);
                DebugActionsUtility.DustPuffFrom(pawn);
            }
        }
コード例 #6
0
 private static void MinHitPoints()
 {
     foreach (Thing thing in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell()).ToList <Thing>())
     {
         if (thing.def.useHitPoints)
         {
             thing.HitPoints = 1;
             DebugActionsUtility.DustPuffFrom(thing);
         }
     }
 }
コード例 #7
0
 private static void UninstalBuilding()
 {
     foreach (Thing thing in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell()).ToList <Thing>())
     {
         DebugActionsUtility.DustPuffFrom(thing);
         if (thing is Building building && building.def.Minifiable)
         {
             MinifiedThing minifiedThing = building.MakeMinified();
             GenSpawn.Spawn(minifiedThing, UI.MouseCell(), Find.CurrentMap, WipeMode.Vanish);
         }
     }
 }
コード例 #8
0
 private static void DecodeBiocoded()
 {
     foreach (Thing thing in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell()).ToList <Thing>())
     {
         CompBiocodable compBiocodable = thing.TryGetComp <CompBiocodable>();
         if (compBiocodable != null && compBiocodable.Biocoded)
         {
             compBiocodable.UnCode();
         }
         DebugActionsUtility.DustPuffFrom(thing);
     }
 }
コード例 #9
0
 private static void TransGender(Pawn pawn)
 {
     if (pawn.gender == Gender.Male)
     {
         pawn.gender = Gender.Female;
     }
     else if (pawn.gender == Gender.Female)
     {
         pawn.gender = Gender.Male;
     }
     pawn.Drawer.renderer.graphics.ResolveAllGraphics();
     DebugActionsUtility.DustPuffFrom(pawn);
 }
コード例 #10
0
ファイル: Debug.cs プロジェクト: gregorycu/AnimalGenetics
        private static void GiveBirthTogether()
        {
            var males   = Find.Selector.SelectedPawns.Where(candidate => candidate.gender == Gender.Male);
            var females = Find.Selector.SelectedPawns.Where(candidate => candidate.gender == Gender.Female);

            if (males.Count() != 1 || females.Count() != 1)
            {
                return;
            }

            Hediff_Pregnant.DoBirthSpawn(females.First(), males.First());
            DebugActionsUtility.DustPuffFrom(females.First());
        }
コード例 #11
0
        public static void ForceMilk(Pawn p)
        {
            CompMilkable compMilkable = p.TryGetComp <CompMilkable>();

            if (compMilkable != null)
            {
                while (compMilkable.Fullness < 1)
                {
                    compMilkable.CompTick();
                }
                DebugActionsUtility.DustPuffFrom(p);
            }
        }
コード例 #12
0
        public static void ForceWool(Pawn p)
        {
            CompShearable compShearable = p.TryGetComp <CompShearable>();

            if (p.Faction != null && compShearable != null)
            {
                while (compShearable.Fullness < 1)
                {
                    compShearable.CompTick();
                }
                DebugActionsUtility.DustPuffFrom(p);
            }
        }
コード例 #13
0
        public static void LogManagedVerbs(Pawn p)
        {
            var man = p.Manager();

            if (man == null)
            {
                return;
            }
            DebugActionsUtility.DustPuffFrom(p);
            Log.Message("All ManagedVerbs for " + p.LabelCap);
            foreach (var verb in man.ManagedVerbs)
            {
                Log.Message("  " + verb.Verb + ": " + (verb.Enabled ? "Enabled" : "Disabled"));
            }
        }
コード例 #14
0
        private static void RemoveAbility(Pawn pawn)
        {
            List <DebugMenuOption> list = new List <DebugMenuOption>();

            foreach (Ability ability in pawn.abilities.abilities)
            {
                list.Add(new DebugMenuOption(ability.def.LabelCap, DebugMenuOptionMode.Action, delegate()
                {
                    //pawn.abilities.abilities.Remove(ability);
                    pawn.abilities.RemoveAbility(ability.def);
                    DebugActionsUtility.DustPuffFrom(pawn);
                }));
            }
            Find.WindowStack.Add(new Dialog_DebugOptionListLister(list));
        }
コード例 #15
0
        private static void GiveBirthTogether()
        {
            var males   = Find.Selector.SelectedPawns.Where(candidate => candidate.gender == Gender.Male);
            var females = Find.Selector.SelectedPawns.Where(candidate => candidate.gender == Gender.Female);

            if (males.Count() != 1 || females.Count() != 1)
            {
                return;
            }

            Hediff_Pregnant hediff_Pregnant = (Hediff_Pregnant)HediffMaker.MakeHediff(RimWorld.HediffDefOf.Pregnant, females.First(), null);

            hediff_Pregnant.father = males.First();
            females.First().health.AddHediff(hediff_Pregnant, null, null, null);

            Hediff_Pregnant.DoBirthSpawn(females.First(), males.First());
            DebugActionsUtility.DustPuffFrom(females.First());
        }
コード例 #16
0
        private static void ConvertToSilver()
        {
            float money = 0f;

            foreach (Thing thing in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell()).ToList <Thing>())
            {
                DebugActionsUtility.DustPuffFrom(thing);
                money += thing.GetStatValue(StatDefOf.MarketValue, true) * thing.stackCount;
                thing.Destroy(DestroyMode.Vanish);
            }
            int silverCount = Mathf.RoundToInt(money);

            if (silverCount > 0)
            {
                Thing silver = ThingMaker.MakeThing(ThingDefOf.Silver);
                silver.stackCount = silverCount;
                GenPlace.TryPlaceThing(silver, UI.MouseCell(), Find.CurrentMap, ThingPlaceMode.Near);
            }
        }
コード例 #17
0
        public static void ResurrectPawnFromVoid(Map map, IntVec3 loc, Pawn pawn)
        {
            Corpse corpse = pawn.Corpse;

            if (corpse != null)
            {
                corpse.Destroy(DestroyMode.Vanish);
            }
            if (pawn.IsWorldPawn())
            {
                Find.WorldPawns.RemovePawn(pawn);
            }
            pawn.ForceSetStateToUnspawned();
            PawnComponentsUtility.CreateInitialComponents(pawn);
            pawn.health.Notify_Resurrected();
            if (pawn.Faction != null && pawn.Faction.IsPlayer)
            {
                if (pawn.workSettings != null)
                {
                    pawn.workSettings.EnableAndInitialize();
                }
                Find.StoryWatcher.watcherPopAdaptation.Notify_PawnEvent(pawn, PopAdaptationEvent.GainedColonist);
            }
            GenSpawn.Spawn(pawn, loc, map, WipeMode.Vanish);
            for (int i = 0; i < 10; i++)
            {
                //MoteMaker.ThrowAirPuffUp(pawn.DrawPos, map);
                DebugActionsUtility.DustPuffFrom(pawn);
            }
            if (pawn.Faction != null && pawn.Faction != Faction.OfPlayer && pawn.HostileTo(Faction.OfPlayer))
            {
                LordMaker.MakeNewLord(pawn.Faction, new LordJob_AssaultColony(pawn.Faction, true, true, false, false, true), pawn.Map, Gen.YieldSingle <Pawn>(pawn));
            }
            if (pawn.apparel != null)
            {
                List <Apparel> wornApparel = pawn.apparel.WornApparel;
                for (int j = 0; j < wornApparel.Count; j++)
                {
                    wornApparel[j].Notify_PawnResurrected();
                }
            }
            PawnDiedOrDownedThoughtsUtility.RemoveDiedThoughts(pawn);
        }
コード例 #18
0
        private static void FlashRulePassability(DebugCellPassRule rule, Pawn pawn, TraverseMode traverseMode, bool canBash)
        {
            Map             map           = pawn.Map;
            CellRef         pawnPosition  = map.GetCellRef(pawn.Position);
            TraverseParms   traverseParms = TraverseParms.For(pawn, mode: traverseMode, canBash: canBash);
            LocalTargetInfo targetInfo    = new LocalTargetInfo(pawnPosition);
            PathfindData    pathfindData  = new PathfindData(map, pawnPosition, targetInfo, traverseParms, PathEndMode.OnCell);

            CellPassabilityRule passRule = rule.ruleFactory.Invoke(pathfindData);

            if (passRule.Applies())
            {
                foreach (IntVec3 c in map.AllCells)
                {
                    float color = passRule.IsPassable(map.GetCellRef(c)) ? 0.5f : 0f;
                    map.debugDrawer.FlashCell(c, color);
                }
            }
            DebugActionsUtility.DustPuffFrom(pawn);
        }
コード例 #19
0
        private static void FlashRuleCost(DebugCellCostRule rule, Pawn pawn, TraverseMode traverseMode, bool canBash)
        {
            Map             map           = pawn.Map;
            CellRef         pawnPosition  = map.GetCellRef(pawn.Position);
            TraverseParms   traverseParms = TraverseParms.For(pawn, mode: traverseMode, canBash: canBash);
            LocalTargetInfo targetInfo    = new LocalTargetInfo(pawnPosition);
            PathfindData    pathfindData  = new PathfindData(map, pawnPosition, targetInfo, traverseParms, PathEndMode.OnCell);

            CellCostRule costRule = rule.ruleFactory.Invoke(pathfindData);

            if (costRule.Applies())
            {
                foreach (IntVec3 c in map.AllCells)
                {
                    int cost = costRule.GetCost(map.GetCellRef(c));
                    map.debugDrawer.FlashCell(c, cost / 100f, cost.ToString());
                }
            }
            DebugActionsUtility.DustPuffFrom(pawn);
        }
コード例 #20
0
        private static void RemoveTrait(Pawn pawn)
        {
            List <DebugMenuOption> list = new List <DebugMenuOption>();

            foreach (Trait trait in pawn.story.traits.allTraits)
            {
                list.Add(new DebugMenuOption(string.Concat(new object[]
                {
                    trait.LabelCap,
                    " (",
                    trait.Degree,
                    ")"
                }), DebugMenuOptionMode.Action, delegate()
                {
                    PolarisUtility.GainSkillsExtra(pawn, trait.CurrentData.skillGains, false);
                    pawn.story.traits.RemoveTrait(trait);
                    DebugActionsUtility.DustPuffFrom(pawn);
                }));
            }
            Find.WindowStack.Add(new Dialog_DebugOptionListLister(list));
        }
コード例 #21
0
 private static void RemoveWeaponTrait()
 {
     foreach (Thing thing in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell()).ToList <Thing>())
     {
         if (thing.IsBladelinkWeapon(out CompBladelinkWeapon compBladelink))
         {
             List <WeaponTraitDef>  curTraits = compBladelink.TraitsListForReading;
             List <DebugMenuOption> list      = new List <DebugMenuOption>();
             foreach (WeaponTraitDef curTrait in curTraits)
             {
                 list.Add(new DebugMenuOption(curTrait.label, DebugMenuOptionMode.Action, delegate()
                 {
                     //curTraits.Remove(curTrait);
                     //typeof(CompBladelinkWeapon).GetField("traits", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(compBladelink, curTraits);
                     compBladelink.RemoveWeaponTrait(curTrait);
                 }));
             }
             Find.WindowStack.Add(new Dialog_DebugOptionListLister(list));
         }
         DebugActionsUtility.DustPuffFrom(thing);
     }
 }
コード例 #22
0
        private static void AddSkillPoints()
        {
            List <DebugMenuOption> list = new List <DebugMenuOption>();

            for (int i = 500; i <= 5000; i += 500)
            {
                list.Add(new DebugMenuOption(i.ToString(), DebugMenuOptionMode.Tool, delegate()
                {
                    Pawn pawn = (from t in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell())
                                 where t is Pawn
                                 select t).Cast <Pawn>().FirstOrDefault <Pawn>();
                    if (pawn == null)
                    {
                        return;
                    }
                    // something
                    Log.Message("Poof, extra xp");
                    DebugActionsUtility.DustPuffFrom(pawn);
                }));
            }
            Find.WindowStack.Add(new Dialog_DebugOptionListLister(list));
        }
コード例 #23
0
        private static void ChangeBodyType()
        {
            List <DebugMenuOption> list = new List <DebugMenuOption>();

            foreach (BodyTypeDef bodyType in DefDatabase <BodyTypeDef> .AllDefs)
            {
                list.Add(new DebugMenuOption(bodyType.defName, DebugMenuOptionMode.Tool, delegate()
                {
                    foreach (Pawn pawn in (from t in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell())
                                           where t is Pawn
                                           select t).Cast <Pawn>())
                    {
                        pawn.story.bodyType = bodyType;
                        PortraitsCache.SetDirty(pawn);
                        PortraitsCache.PortraitsCacheUpdate();
                        pawn.Drawer.renderer.graphics.SetAllGraphicsDirty();
                        pawn.Drawer.renderer.graphics.ResolveAllGraphics();
                        DebugActionsUtility.DustPuffFrom(pawn);
                    }
                }));
            }
            Find.WindowStack.Add(new Dialog_DebugOptionListLister(list));
        }
コード例 #24
0
        private static void AddWeaponTrait()
        {
            foreach (Thing thing in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell()).ToList <Thing>())
            {
                if (thing.IsBladelinkWeapon(out CompBladelinkWeapon compBladelink))
                {
                    List <DebugMenuOption> list = new List <DebugMenuOption>();
                    foreach (WeaponTraitDef traitDef in DefDatabase <WeaponTraitDef> .AllDefs)
                    {
                        /*bool canAddTrait = true;
                         * if (!curTraits.NullOrEmpty<WeaponTraitDef>())
                         * {
                         *  for (int i = 0; i < curTraits.Count; i++)
                         *  {
                         *      if (traitDef.Overlaps(curTraits[i]))
                         *      {
                         *          canAddTrait = false;
                         *      }
                         *  }
                         * }*/
                        if (compBladelink.CanAddWeaponTrait(traitDef))
                        {
                            list.Add(new DebugMenuOption(traitDef.label, DebugMenuOptionMode.Action, delegate()
                            {
                                compBladelink.AddWeaponTrait(traitDef);

                                /*curTraits.Add(traitDef);
                                 * typeof(CompBladelinkWeapon).GetField("traits", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(compBladelink, curTraits);*/
                            }));
                        }
                    }
                    Find.WindowStack.Add(new Dialog_DebugOptionListLister(list));
                }
                DebugActionsUtility.DustPuffFrom(thing);
            }
        }