コード例 #1
0
        // ===================== Setup work =====================
        public override void SpawnSetup(Map map, bool respawningAfterLoad)
        {
            base.SpawnSetup(map, respawningAfterLoad);

            if (respawningAfterLoad == false)
            {
                // Initialize cargo and destroy roof.
                if (this.things == null)
                {
                    this.things = new ThingOwner <Thing>(this);
                    GenerateThings();

                    DestroyRoof();
                }

                // Generate pilots.
                for (int pilotIndex = 0; pilotIndex < pilotsNumber; pilotIndex++)
                {
                    Pawn pilot = MiningCoPawnGenerator.GeneratePawn(Util_PawnKindDefOf.Pilot, this.Map);
                    if (pilot != null)
                    {
                        this.pawnsAboard.Add(pilot);
                    }
                }
            }
        }
コード例 #2
0
        public override void SpawnSetup(Map map, bool respawningAfterLoad)
        {
            base.SpawnSetup(map, respawningAfterLoad);

            if (respawningAfterLoad == false)
            {
                for (int pawnindex = 0; pawnindex < medicsNumber; pawnindex++)
                {
                    Pawn medic = MiningCoPawnGenerator.GeneratePawn(Util_PawnKindDefOf.Medic, this.Map);
                    this.medics.Add(medic);
                    this.pawnsAboard.Add(medic);
                }
            }
        }
コード例 #3
0
        public static List <Pawn> GenerateExpeditionPawns(Map map)
        {
            List <Pawn> expeditionPawns = new List <Pawn>();

            ExpeditionKind expeditionKind            = (ExpeditionKind)Rand.RangeInclusive((int)ExpeditionKind.Geologists, (int)ExpeditionKind.Troopers);
            Dictionary <PawnKindDef, int> expedition = null;

            switch (expeditionKind)
            {
            case ExpeditionKind.Geologists:
                expedition = expeditionGeologist;
                break;

            case ExpeditionKind.Miners:
                expedition = expeditionMiners;
                break;

            case ExpeditionKind.OutpostSettlers:
                expedition = expeditionOutpostSettlers;
                break;

            case ExpeditionKind.Scouts:
                expedition = expeditionScouts;
                break;

            case ExpeditionKind.Troopers:
                expedition = expeditionTroopers;
                break;

            default:
                Log.ErrorOnce("MiningCo. Spaceship: unhandled ExpeditionKind (" + expeditionKind.ToString() + ").", 123456782);
                break;
            }
            if (expedition != null)
            {
                // Generate expedition pawns
                foreach (PawnKindDef pawnKind in expedition.Keys)
                {
                    for (int pawnIndex = 0; pawnIndex < expedition[pawnKind]; pawnIndex++)
                    {
                        Pawn pawn = MiningCoPawnGenerator.GeneratePawn(pawnKind, map);
                        expeditionPawns.Add(pawn);
                    }
                }
            }
            return(expeditionPawns);
        }