Exemple #1
0
        public void UpdatePacks()
        {
            if (enableDebug && multiThreaded)
            {
                Log.Message("Thread started.");
            }
            IEnumerable <Pawn> pawnsOnMap = RimValiUtility.AllPawnsOfRaceOnMap(AvaliDefs.RimVali, map).Where <Pawn>(x => RimValiUtility.GetPackSize(x, x.TryGetComp <PackComp>().Props.relation) < maxSize);

            foreach (Pawn pawn in pawnsOnMap)
            {
                //Log.Message(pawn.Name.ToString() + " updatePacks()");
                PackComp comp = pawn.TryGetComp <PackComp>();
                if (!(comp == null))
                {
                    //Pull the comp info from the pawn
                    SimpleCurve ageCurve = comp.Props.packGenChanceOverAge;
                    //Tells us that this pawn has had a pack
                    if (enableDebug)
                    {
                        Log.Message("Attempting to make pack.. [Base pack]");
                    }
                    //Makes the pack.
                    packs = RimValiUtility.EiPackHandler(packs, pawn, racesInPacks, maxSize);
                }
            }
        }
Exemple #2
0
        public void UpdatePacks()
        {
            IEnumerable <Pawn> pawnsOnMap = RimValiUtility.AllPawnsOfRaceOnMap(AvaliDefs.RimVali, map).Where(x => (RimValiUtility.GetPackSize(x, x.TryGetComp <PackComp>().Props.relation) < maxSize) & racesInPacks.Contains(x.def));

            foreach (Pawn pawn in pawnsOnMap)
            {
                PackComp comp = pawn.TryGetComp <PackComp>();
                if (!(comp == null))
                {
                    //Pull the comp info from the pawn
                    PawnRelationDef relationDef = comp.Props.relation;
                    SimpleCurve     ageCurve    = comp.Props.packGenChanceOverAge;
                    if (RimValiUtility.GetPackSize(pawn, relationDef) == 1)
                    {
                        //Tells us that this pawn has had a pack
                        if (enableDebug)
                        {
                            Log.Message("Attempting to make pack.. [Base pack]");
                        }
                        //Makes the pack.
                        RimValiUtility.KeoBuildMakePack(pawn, relationDef, racesInPacks, maxSize);
                    }
                }
            }
        }
Exemple #3
0
        public void MakeNewPacks()
        {
            if (enableDebug && multiThreaded)
            {
                Log.Message("Thread started.");
            }
            IEnumerable <Pawn> pawnsOnMap = RimValiUtility.AllPawnsOfRaceOnMap(AvaliDefs.RimVali, map).Where <Pawn>(x => RimValiUtility.GetPackSize(x, x.TryGetComp <PackComp>().Props.relation) < maxSize);

            foreach (Pawn pawn in pawnsOnMap)
            {
                PackComp comp = pawn.TryGetComp <PackComp>();
                if (!(comp == null))
                {
                    //Pull the comp info from the pawn
                    PawnRelationDef relationDef = comp.Props.relation;
                    SimpleCurve     ageCurve    = comp.Props.packGenChanceOverAge;
                    //Tells us that this pawn has had a pack
                    if (enableDebug)
                    {
                        Log.Message("Attempting to make pack.. [New/added pack]");
                    }
                    //Makes the pack.
                    foreach (Pawn packmate in pawnsOnMap)
                    {
                        //RimValiUtility.KeoBuildMakeBasePack(pawn, relationDef, racesInPacks, maxSize);
                        RimValiUtility.EiBuildMakeBasePack(pawn, relationDef, racesInPacks, maxSize, packs);
                        if (RimValiUtility.GetPackSize(pawn, relationDef) <= 0)
                        {
                            RimValiUtility.EiBuildMakeBasePack(pawn, relationDef, racesInPacks, maxSize, packs);
                        }
                        else
                        {
                            RimValiUtility.EiBuildMakeBasePack(pawn, relationDef, racesInPacks, maxSize, packs);
                        }
                        if (RimValiUtility.GetPackSize(pawn, relationDef) == maxSize)
                        {
                            break;
                        }
                    }
                }
            }
        }