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 Pawn PawnToUpload() { ThingWithComps parent = this.parent; List <Pawn> pawns = RimValiUtility.CheckAllPawnsInMapAndFaction(parent.Map, parent.Faction).ToList <Pawn>(); foreach (Pawn pawn in pawns) { PhysicalInteractionReservationManager physicalInteractionReservationManager = new PhysicalInteractionReservationManager(); if (physicalInteractionReservationManager.IsReservedBy(pawn, this.parent) == true) { return(pawn); } } return(null); }
public void UpdatePawns(Map map) { AvaliPackDriver AvaliPackDriver = Current.Game.GetComponent <AvaliPackDriver>(); IEnumerable <Pawn> pawns = RimValiUtility.CheckAllPawnsInMapAndFaction(map, Faction.OfPlayer).Where(x => AvaliPackDriver.racesInPacks.Contains(x.def)); IEnumerable <AvaliPack> packs = AvaliPackDriver.packs; foreach (Pawn pawn in pawns) { AvaliThoughtDriver avaliThoughtDriver = pawn.TryGetComp <AvaliThoughtDriver>(); PackComp packComp = pawn.TryGetComp <PackComp>(); if (!(avaliThoughtDriver == null)) { //Log.Message("Pawn has pack comp, moving to next step..."); if (AvaliPackDriver.packs == null || AvaliPackDriver.packs.Count == 0) { //Log.Message("How did we get here? [Pack list was 0 or null]"); return; } AvaliPack pawnPack = null; //This errors out when pawns dont have a pack, in rare cases. That is bad. This stops it from doing that. try { pawnPack = pawn.GetPack(); } catch { return; } //Log.Message("Tried to get packs pack, worked."); if (pawnPack == null) { //Log.Message("How did we get here? [Pack was null.]"); break; } foreach (Pawn packmate in pawnPack.pawns) { Thought_Memory thought_Memory2 = (Thought_Memory)ThoughtMaker.MakeThought(packComp.Props.togetherThought); if (!(packmate == pawn) && packmate != null && pawn != null) { bool bubble; if (!thought_Memory2.TryMergeWithExistingMemory(out bubble)) { //Log.Message("Adding thought to pawn."); pawn.needs.mood.thoughts.memories.TryGainMemory(thought_Memory2, packmate); } } } } } }
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); } } } } }