コード例 #1
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);
                    }
                }
            }
        }
コード例 #2
0
ファイル: AvaliThoughtDriver.cs プロジェクト: Nyinxie/RimVali
 public void AddThought(ThoughtDef thought, PawnRelationDef relationDef, Pawn pawn)
 {
     if (RimValiUtility.GetPackSize(pawn, relationDef) == 1 && packLossEnabled)
     {
         RimValiUtility.AddThought(pawn, thought);
     }
 }
コード例 #3
0
ファイル: AvaliThoughtDriver.cs プロジェクト: Nyinxie/RimVali
        public void UpdatePawns(Map map)
        {
            IEnumerable <Pawn> pawns = RimValiUtility.CheckAllPawnsInMapAndFaction(map, Faction.OfPlayer).Where(x => x.def == AvaliDefs.RimVali);

            foreach (Pawn pawn in pawns)
            {
                AvaliThoughtDriver avaliThoughtDriver = pawn.TryGetComp <AvaliThoughtDriver>();
                PackComp           packComp           = pawn.TryGetComp <PackComp>();
                if (!(avaliThoughtDriver == null))
                {
                    if (pawn.def == AvaliDefs.RimVali)
                    {
                        if (RimValiUtility.GetPackSize(pawn, avaliThoughtDriver.Props.relationDef) > 1)
                        {
                            PawnRelationDef relationDef = avaliThoughtDriver.Props.relationDef;
                            UpdateSharedRoomThought(pawn, relationDef, avaliThoughtDriver.Props.inSameRoomThought);
                            UpdateBedRoomThought(pawn, relationDef, avaliThoughtDriver.Props.sharedBedroomThought, avaliThoughtDriver.Props.sleptApartThought);
                        }
                    }
                }
                if (!(packComp == null))
                {
                    if (packComp.Props.canHaveAloneThought)
                    {
                        UpdateThought(pawn, packComp.Props.relation, packComp.Props.aloneThought);
                    }
                }
            }
        }
コード例 #4
0
ファイル: PackDiverMapComp.cs プロジェクト: Plythios/RimVali
        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;
                        }
                    }
                }
            }
        }
コード例 #5
0
        public void UpdatePawns(Map map)
        {
            List <ThingDef>    races = RimvaliPotentialPackRaces.potentialPackRaces.ToList <ThingDef>();
            IEnumerable <Pawn> pawns = RimValiUtility.CheckAllPawnsInMapAndFaction(map, Faction.OfPlayer);

            foreach (Pawn pawn in pawns)
            {
                if (pawn.IsHashIntervalTick(120))
                {
                    AvaliThoughtDriver avaliThoughtDriver = pawn.TryGetComp <AvaliThoughtDriver>();
                    if (pawn.def == AvaliDefs.RimVali)
                    {
                        if (RimValiUtility.GetPackSize(pawn, avaliThoughtDriver.Props.relationDef) > 0)
                        {
                            PawnRelationDef relationDef = avaliThoughtDriver.Props.relationDef;
                            UpdateSharedRoomThought(pawn, relationDef, avaliThoughtDriver.Props.inSameRoomThought);
                            UpdateBedRoomThought(pawn, relationDef, avaliThoughtDriver.Props.sharedBedroomThought, avaliThoughtDriver.Props.sleptApartThought);
                        }
                    }
                }
            }
        }
コード例 #6
0
ファイル: PackDiverMapComp.cs プロジェクト: Plythios/RimVali
        public void UpdatePacks()
        {
            if (enableDebug && multiThreaded)
            {
                //Log.Message("Thread started.");
            }
            IEnumerable <Pawn> pawnsOnMap = RimValiUtility.AllPawnsOfRaceInWorld(AvaliDefs.RimVali).Where <Pawn>(x => RimValiUtility.GetPackSize(x) < maxSize);

            foreach (Pawn pawn in pawnsOnMap)
            {
//Log.Message(pawn.Faction.Name);
                //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.
                    //Log.Message("EiPackHandlerFromPackDriverMapComp started.");
                    packs = RimValiUtility.EiPackHandler(packs, pawn, racesInPacks, maxSize);
                }
            }
        }