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); } } } }
public void AddThought(ThoughtDef thought, PawnRelationDef relationDef, Pawn pawn) { if (RimValiUtility.GetPackSize(pawn, relationDef) == 1 && packLossEnabled) { RimValiUtility.AddThought(pawn, thought); } }
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); } } } }
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; } } } } }
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); } } } } }
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); } } }