public void ReplaceStackWithPawn(CorticalStack stack, Pawn pawn) { var hediff = pawn.health.hediffSet.GetFirstHediffOfDef(AlteredCarbonDefOf.AC_CorticalStack) as Hediff_CorticalStack; if (hediff != null) { hediff.stackGroupID = stack.stackGroupID; if (this.stacksRelationships.ContainsKey(hediff.stackGroupID)) { if (this.stacksRelationships[hediff.stackGroupID].originalStack == stack) { this.stacksRelationships[hediff.stackGroupID].originalStack = null; this.stacksRelationships[hediff.stackGroupID].originalPawn = pawn; } else if (this.stacksRelationships[hediff.stackGroupID].copiedStacks.Contains(stack)) { this.stacksRelationships[hediff.stackGroupID].copiedStacks.Remove(stack); if (this.stacksRelationships[hediff.stackGroupID].copiedPawns == null) { this.stacksRelationships[hediff.stackGroupID].copiedPawns = new List <Pawn>(); } this.stacksRelationships[hediff.stackGroupID].copiedPawns.Add(pawn); } } this.pawnsWithStacks.Add(pawn); } }
public void ReplacePawnWithStack(Pawn pawn, CorticalStack stack) { if (this.stacksRelationships == null) { this.stacksRelationships = new Dictionary <int, StacksData>(); } var hediff = pawn.health.hediffSet.GetFirstHediffOfDef(AlteredCarbonDefOf.AC_CorticalStack) as Hediff_CorticalStack; if (hediff != null) { stack.stackGroupID = hediff.stackGroupID; if (this.stacksRelationships.ContainsKey(hediff.stackGroupID)) { if (this.stacksRelationships[hediff.stackGroupID].originalPawn == pawn) { this.stacksRelationships[hediff.stackGroupID].originalPawn = null; this.stacksRelationships[hediff.stackGroupID].originalStack = stack; } else if (this.stacksRelationships[hediff.stackGroupID].copiedPawns.Contains(pawn)) { this.stacksRelationships[hediff.stackGroupID].copiedPawns.Remove(pawn); if (this.stacksRelationships[hediff.stackGroupID].copiedStacks == null) { this.stacksRelationships[hediff.stackGroupID].copiedStacks = new List <CorticalStack>(); } this.stacksRelationships[hediff.stackGroupID].copiedStacks.Add(stack); } } } }
public void CopyFromOtherStack(CorticalStack otherStack) { this.name = otherStack.name; this.origPawn = otherStack.origPawn; this.hostilityMode = otherStack.hostilityMode; this.areaRestriction = otherStack.areaRestriction; this.ageChronologicalTicks = otherStack.ageChronologicalTicks; this.medicalCareCategory = otherStack.medicalCareCategory; this.selfTend = otherStack.selfTend; this.foodRestriction = otherStack.foodRestriction; this.outfit = otherStack.outfit; this.drugPolicy = otherStack.drugPolicy; this.times = otherStack.times; this.thoughts = otherStack.thoughts; this.faction = otherStack.faction; this.isFactionLeader = otherStack.isFactionLeader; this.traits = otherStack.traits; this.relations = otherStack.relations; this.relatedPawns = otherStack.relatedPawns; this.skills = otherStack.skills; this.childhood = otherStack.childhood; this.adulthood = otherStack.adulthood; this.priorities = otherStack.priorities; this.hasPawn = true; if (this.gender == Gender.None) { this.gender = otherStack.gender; } if (this.race == null) { this.race = otherStack.race; } this.pawnID = otherStack.pawnID; if (ModLister.RoyaltyInstalled) { this.royalTitles = otherStack.royalTitles; this.favor = otherStack.favor; this.heirs = otherStack.heirs; this.bondedThings = otherStack.bondedThings; this.factionPermits = otherStack.factionPermits; this.permitPoints = otherStack.permitPoints; } this.isCopied = true; this.stackGroupID = otherStack.stackGroupID; this.sexuality = otherStack.sexuality; this.romanceFactor = otherStack.romanceFactor; this.psychologyData = otherStack.psychologyData; }
public int GetStackGroupID(CorticalStack corticalStack) { if (corticalStack.stackGroupID != 0) { return(corticalStack.stackGroupID); } if (ACUtils.ACTracker.stacksRelationships != null) { return(ACUtils.ACTracker.stacksRelationships.Count + 1); } else { return(0); } }
public void RegisterStack(CorticalStack stack) { if (this.stacksRelationships == null) { this.stacksRelationships = new Dictionary <int, StacksData>(); } if (!this.stacksRelationships.ContainsKey(stack.stackGroupID)) { this.stacksRelationships[stack.stackGroupID] = new StacksData(); } if (stack.isCopied) { if (this.stacksRelationships[stack.stackGroupID].copiedStacks == null) { this.stacksRelationships[stack.stackGroupID].copiedStacks = new List <CorticalStack>(); } this.stacksRelationships[stack.stackGroupID].copiedStacks.Add(stack); } else { this.stacksRelationships[stack.stackGroupID].originalStack = stack; } }