Exemple #1
0
        public static bool SCP_SpawnCheck(Thing newThing, IntVec3 loc, Map map, Rot4 rot, WipeMode wipeMode, bool respawningAfterLoad)
        {
            if (newThing is SCP newPawn && newPawn.kindDef is CustomPawnKindDef newPkd && newPkd.isUnique)
            {
                //SCPs should not be spawned as mechanoids in shrines.
                //Spawn lancers instead.
                if (Find.TickManager.TicksGame < 500) //(int)(DefDatabase<DevSettings>.AllDefs.First().daysUntilSCPArrival.min * GenDate.TicksPerDay))
                {
                    newThing = PawnGenerator.GeneratePawn(CustomPawnKindDef.Named("Mech_Lancer"));
                    Log.Message(newPkd.label + " attempted to spawn before arrival time in dev settings. Denied");
                    return(true);
                }

                var worldComp = Find.World.GetComponent <WorldComponent_UniqueTracker>();
                if (worldComp == null)
                {
                    return(true);
                }

                if (worldComp.uniquePawnTypes == null)
                {
                    worldComp.uniquePawnTypes = new List <CustomPawnKindDef>();
                }

                //Check to see if the unique pawn type has already been spawned.
                if (worldComp.uniquePawnTypes.Count != 0 &&
                    worldComp.uniquePawnTypes.Contains(newPkd))
                {
                    //If the pawn is a newly created or different pawn, it will not be spawned.
                    if (worldComp.uniquePawns == null)
                    {
                        worldComp.uniquePawns = new List <Pawn>();
                    }

                    if (worldComp.uniquePawns.Count != 0 &&
                        !worldComp.uniquePawns.Contains(newPawn))
                    {
                        Log.Warning("SCP attempted to reappear without permissions. SCP Spawning Denied.");
                        return(false);
                    }
                }
                else
                {
                    worldComp.uniquePawnTypes.Add(newPkd);
                    worldComp.uniquePawns.Add(newPawn);
                }
            }
            return(true);
        }
Exemple #2
0
 public static bool SCP_GeneratePawnCheck(PawnGenerationRequest request, ref Pawn __result)
 {
     if (request.KindDef is CustomPawnKindDef newPkd && newPkd.isUnique)
     {
         //SCPs should not be spawned as mechanoids in shrines.
         //Spawn lancers instead.
         if (Find.TickManager.TicksGame < (int)(DefDatabase <DevSettings> .AllDefs.First().daysUntilSCPArrival.min *GenDate.TicksPerDay))
         {
             __result = PawnGenerator.GeneratePawn(CustomPawnKindDef.Named("Mech_Lancer"));
             Log.Message("Attempted to spawn unique pawn before SCP arrival in dev settings. Spawning mech lancer instead.");
             return(false);
         }
     }
     return(true);
 }
Exemple #3
0
        public static void SpawnFirstSCPGroup(Map map)
        {
            Predicate <IntVec3> validator = (IntVec3 c) => map.reachability.CanReachColony(c) && !c.Fogged(map);
            IntVec3             spawnSpotOne;
            IntVec3             spawnSpotTwo;

            CellFinder.TryFindRandomEdgeCellWith(validator, map, CellFinder.EdgeRoadChance_Neutral, out spawnSpotOne);
            CellFinder.TryFindRandomEdgeCellWith(validator, map, CellFinder.EdgeRoadChance_Neutral, out spawnSpotTwo);

            Pawn pawnA = PawnGenerator.GeneratePawn(CustomPawnKindDef.Named("SCP_ONE_THREE_ONE_A"));
            Pawn pawnB = PawnGenerator.GeneratePawn(CustomPawnKindDef.Named("SCP_ONE_THREE_ONE_B"));

            GenSpawn.Spawn(pawnA, spawnSpotOne, map);
            GenSpawn.Spawn(pawnB, spawnSpotTwo, map);

            CreateSCPLetter(pawnA);
            CreateSCPLetter(pawnB);
        }