// Token: 0x06000007 RID: 7 RVA: 0x000021B8 File Offset: 0x000003B8 public override void SpawnSetup(Map map, bool respawningAfterLoad) { base.SpawnSetup(map, respawningAfterLoad); this.Angle = AngleRange.RandomInRange; this.StartTick = Find.TickManager.TicksGame; base.GetComp <CompAffectsSky>().StartFadeInHoldFadeOut(30, this.Duration - 30 - 15, 15, 1f); base.GetComp <CompOrbitalBeam>().StartAnimation(this.Duration, 10, this.Angle); MoteMaker.MakeBombardmentMote(base.Position, base.Map); MoteMaker.MakePowerBeamMote(base.Position, base.Map); }
public override void PawnDied(Corpse corpse) { //Fancy death effect. MoteMaker.MakePowerBeamMote(corpse.Position, corpse.Map); //Hurt all nearby enemy pawns. foreach (var cell in GenRadial.RadialCellsAround(corpse.Position, 3f, true)) { var thingList = new List <Thing>(cell.GetThingList(corpse.Map)); foreach (var thing in thingList) { if (thing.HostileTo(corpse.InnerPawn.Faction)) { //Damage. thing.TakeDamage(new DamageInfo(DamageDefOf.Burn, 40)); } } } }
protected override bool TryExecuteWorker(IncidentParms parms) { Map map = parms.target as Map; Pawn closestCat = TryGetClosestCatOnMap(map); GuardianProperties guardianProps = def.GetModExtension <GuardianProperties>(); if (closestCat != null) { //Transform Cat //Generate guardian Pawn newGuardian = PawnGenerator.GeneratePawn(new PawnGenerationRequest( guardianProps.guardianDef, Faction.OfPlayer, PawnGenerationContext.NonPlayer, -1, true, false, false, false, false, true, 0f, false, true, true, false, false, false, false, false, 0, null, 0, null, null, null, null, null, closestCat.ageTracker.AgeBiologicalYears, closestCat.ageTracker.AgeChronologicalYears, closestCat.gender, null, null)); //Transfer over family trees and relations to guardian from old cat. Pawn_RelationsTracker oldRelations = closestCat.relations; Pawn_RelationsTracker newRelations = newGuardian.relations; //Transfer over relations. List <DirectPawnRelation> relationList = new List <DirectPawnRelation>(oldRelations.DirectRelations); foreach (DirectPawnRelation relation in relationList) { newRelations.AddDirectRelation(relation.def, relation.otherPawn); oldRelations.RemoveDirectRelation(relation); } //Fully train. foreach (TrainableDef trainableDef in DefDatabase <TrainableDef> .AllDefs) { for (int step = 0; step < trainableDef.steps; step++) { newGuardian.training.Train(trainableDef, null); } } //Make a new name. if (closestCat.Name != null) { if (closestCat.gender == Gender.Male) { newGuardian.Name = new NameSingle(NameGenerator.GenerateName(RulePackDef.Named("NamerAnimalGenericMale")), false); } else { newGuardian.Name = new NameSingle(NameGenerator.GenerateName(RulePackDef.Named("NamerAnimalGenericFemale")), false); } } //Dump inventory, if any. closestCat?.inventory.DropAllNearPawn(closestCat.Position); Letter letter = LetterMaker.MakeLetter("Cults_BastGuardianTransformationLabel".Translate(closestCat.Name.ToStringShort), "Cults_BastGuardianTransformationDescription".Translate(closestCat.Name.ToStringFull), LetterDefOf.PositiveEvent, new GlobalTargetInfo(newGuardian)); //Remove old cat. IntVec3 catPosition = closestCat.Position; closestCat.Destroy(DestroyMode.Vanish); //Spawn in guardian. GenSpawn.Spawn(newGuardian, catPosition, map); MoteMaker.MakePowerBeamMote(catPosition, map); Current.Game.letterStack.ReceiveLetter(letter); } return(true); }