protected override IEnumerable <Toil> MakeNewToils() { yield return(Toils_Reserve.Reserve(TargetIndex.A, 1, -1, null)); yield return(Toils_Reserve.Reserve(TargetIndex.B, 1, -1, null)); yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch)); yield return(Toils_Haul.StartCarryThing(TargetIndex.A, false, false)); yield return(Toils_Haul.CarryHauledThingToCell(TargetIndex.B)); Toil t2 = Toils_General.Wait(1000); t2.AddFailCondition(() => !this.Emitter.GetComp <CompPowerTrader>().PowerOn); t2 = t2.WithProgressBar(TargetIndex.A, () => (1000f - (float)this.ticksLeftThisToil) / 1000f, false, -0.5f); yield return(t2); yield return(new Toil { defaultCompleteMode = ToilCompleteMode.Instant, initAction = delegate() { Pawn simPawn = this.MakeGeniusPawn(); this.Emitter.GetComp <CompHoloEmitter>().SimPawn = simPawn; this.Emitter.GetComp <CompHoloEmitter>().SetUpPawn(); this.Disk.Destroy(DestroyMode.Vanish); } }); yield return(Toils_Reserve.Release(TargetIndex.B)); yield break; }
protected override IEnumerable <Toil> MakeNewToils() { this.FailOnDestroyedNullOrForbidden(PrisonerInd); this.FailOnDestroyedNullOrForbidden(CollarInd); this.FailOnBurningImmobile(CollarInd); yield return(Toils_Reserve.Reserve(PrisonerInd, 1)); yield return(Toils_Reserve.Reserve(CollarInd, 1)); yield return(Toils_Goto.GotoThing(CollarInd, PathEndMode.ClosestTouch)); yield return(Toils_Haul.StartCarryThing(CollarInd)); var gotoToil = Toils_Goto.GotoThing(PrisonerInd, PathEndMode.ClosestTouch); yield return(gotoToil); yield return(Toils_Haul.PlaceHauledThingInCell(CollarCellInd, gotoToil, false)); yield return(Toils_Reserve.Release(CollarInd)); yield return(Toils_Prisoner.Enslave(PrisonerInd, CollarInd)); yield return(Toils_Reserve.Release(PrisonerInd)); }
protected override IEnumerable <Toil> MakeNewToils() { yield return(Toils_Reserve.Reserve(TargetIndex.A, 1, 1, null)); yield return(Toils_Reserve.Reserve(TargetIndex.B, 1, 1, null)); yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch)); yield return(Toils_Haul.StartCarryThing(TargetIndex.A, false, false)); yield return(Toils_Haul.CarryHauledThingToCell(TargetIndex.B)); yield return(Toils_General.Wait(1500).WithProgressBar(TargetIndex.B, () => 1f - 1f * (float)this.ticksLeftThisToil / 1500f, false, -0.5f)); yield return(new Toil { defaultCompleteMode = ToilCompleteMode.Instant, initAction = delegate() { DamageInfo value = new DamageInfo(DamageDefOf.ExecutionCut, 500, -1f, -1f, base.GetActor(), null, null, 0); this.Animal.Kill(new DamageInfo?(value)); this.Altar.GetComp <CompPsionicEmanator>().DoPsychicShockwave(); } }); yield return(Toils_Reserve.Release(TargetIndex.B)); yield break; }
protected override IEnumerable <Toil> MakeNewToils() { yield return(Toils_Reserve.Reserve(terraformerIndex)); yield return(Toils_Goto.GotoCell(terraformerIndex, PathEndMode.InteractionCell).FailOnDestroyed(terraformerIndex)); yield return(Toils_General.Wait(600).FailOnDestroyed(terraformerIndex)); Toil secureBuildingToil = new Toil() { initAction = () => { (this.TargetThingA as Building_MechanoidTerraformer).reverseEngineeringState = Building_MechanoidTerraformer.ReverseEngineeringState.Studying; string eventText = " You have secured the strange building.\n\nYou are now sure of one thing: this is a mechanoid device.\n" + "As usual when dealing with mechanoid technology, be really careful. You should better be prepared for anything...\n"; Find.LetterStack.ReceiveLetter("Artifact secured", eventText, LetterType.BadNonUrgent, this.pawn.Position); }, defaultCompleteMode = ToilCompleteMode.Instant }; yield return(secureBuildingToil); yield return(Toils_Reserve.Release(terraformerIndex)); }
protected override IEnumerable <Toil> MakeNewToils() { yield return(Toils_Reserve.Reserve(casketTarget)); yield return(Toils_Goto.GotoCell(casketTarget, PathEndMode.InteractionCell).FailOnDestroyedOrNull(casketTarget)); yield return(Toils_General.Wait(300).FailOnDestroyedOrNull(casketTarget)); Toil openCasketToil = new Toil() { initAction = () => { Building_CryptosleepCasket casket = this.CurJob.targetA.Thing as Building_CryptosleepCasket; if (casket != null) { casket.Open(); } }, defaultCompleteMode = ToilCompleteMode.Instant }; yield return(openCasketToil); yield return(Toils_Reserve.Release(casketTarget)); }
protected override IEnumerable <Toil> MakeNewToils() { yield return(Toils_Reserve.Reserve(TargetIndex.A, 1, -1, null)); yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch)); Toil t2 = Toils_General.Wait(1000); t2 = t2.WithEffect(EffecterDefOf.Research, TargetIndex.A); float fResearchScore = base.GetActor().GetStatValue(StatDefOf.ResearchSpeed, true); t2.tickAction = delegate() { if (180000f * Rand.Value < fResearchScore) { this.TriggerFindStargate(); this.EndJobWith(JobCondition.Succeeded); } }; yield return(t2); yield return(Toils_Reserve.Release(TargetIndex.A)); yield break; }
protected override IEnumerable <Toil> MakeNewToils() { Building_AquacultureBasin aquacultureBasin = this.TargetThingA as Building_AquacultureBasin; yield return(Toils_Goto.GotoThing(aquacultureBasinIndex, PathEndMode.InteractionCell)); yield return(Toils_General.Wait(120).WithProgressBarToilDelay(aquacultureBasinIndex)); Toil getAquacultureBasinProduction = new Toil() { initAction = () => { Job curJob = this.pawn.jobs.curJob; Thing product = aquacultureBasin.GetProduction(); if (product == null) { this.pawn.jobs.EndCurrentJob(JobCondition.Succeeded); } else { while (product.stackCount > product.def.stackLimit) { Thing meatStack = ThingMaker.MakeThing(product.def); meatStack.stackCount = product.def.stackLimit; GenPlace.TryPlaceThing(meatStack, this.GetActor().Position, this.Map, ThingPlaceMode.Near); product.stackCount -= product.def.stackLimit; } GenSpawn.Spawn(product, aquacultureBasin.InteractionCell, this.Map); IntVec3 storageCell; if (StoreUtility.TryFindBestBetterStoreCellFor(product, this.pawn, this.Map, StoragePriority.Unstored, this.pawn.Faction, out storageCell, true)) { this.pawn.Reserve(product, this.job); this.pawn.Reserve(storageCell, this.job, 1); this.pawn.CurJob.SetTarget(TargetIndex.B, storageCell); this.pawn.CurJob.SetTarget(TargetIndex.A, product); this.pawn.CurJob.count = 99999; this.pawn.CurJob.haulMode = HaulMode.ToCellStorage; } else { this.pawn.jobs.EndCurrentJob(JobCondition.Succeeded); } } } }; yield return(getAquacultureBasinProduction); yield return(Toils_Reserve.Release(aquacultureBasinIndex)); yield return(Toils_Haul.StartCarryThing(TargetIndex.A)); Toil carryToCell = Toils_Haul.CarryHauledThingToCell(TargetIndex.B); yield return(carryToCell); yield return(Toils_Haul.PlaceHauledThingInCell(TargetIndex.B, carryToCell, true)); }
protected override IEnumerable <Toil> MakeNewToils() { this.FailOnDestroyedNullOrForbidden(tableTI); this.FailOnBurningImmobile(objectTI); this.FailOnDestroyedNullOrForbidden(objectTI); this.FailOnBurningImmobile(objectTI); yield return(Toils_Reserve.Reserve(tableTI)); yield return(Toils_Reserve.Reserve(objectTI)); yield return(Toils_Goto.GotoThing(objectTI, PathEndMode.Touch)); yield return(Toils_Haul.StartCarryThing(objectTI)); yield return(Toils_Goto.GotoThing(tableTI, PathEndMode.InteractionCell)); yield return(Toils_Haul.PlaceHauledThingInCell(tableTI, null, false)); yield return(DoBill()); yield return(Store()); yield return(Toils_Reserve.Reserve(haulTI)); yield return(Toils_Haul.CarryHauledThingToCell(haulTI)); yield return(Toils_Haul.PlaceHauledThingInCell(haulTI, null, false)); yield return(Toils_Reserve.Release(objectTI)); yield return(Toils_Reserve.Release(haulTI)); yield return(Toils_Reserve.Release(tableTI)); }
protected override IEnumerable <Toil> MakeNewToils() { this.FailOnDespawnedNullOrForbidden(TargetIndex.A); yield return(Toils_Reserve.Reserve(TargetIndex.A, 1)); var reserveSeeds = ReserveSeedsIfWillPlantWholeStack(); yield return(reserveSeeds); yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.ClosestTouch) .FailOnDespawnedNullOrForbidden(TargetIndex.B) .FailOnSomeonePhysicallyInteracting(TargetIndex.B)); yield return(Toils_Haul.StartCarryThing(TargetIndex.B, false, false) .FailOnDestroyedNullOrForbidden(TargetIndex.B)); Toils_Haul.CheckForGetOpportunityDuplicate(reserveSeeds, TargetIndex.B, TargetIndex.None, false, null); var toil = Toils_Goto.GotoCell(TargetIndex.A, PathEndMode.Touch); yield return(toil); yield return(SowSeedToil()); yield return(Toils_Reserve.Release(TargetIndex.A)); yield return(TryToSetAdditionalPlantingSite()); yield return(Toils_Reserve.Reserve(TargetIndex.A, 1)); yield return(Toils_Jump.Jump(toil)); }
protected override IEnumerable <Toil> MakeNewToils() { this.FailOnDestroyedNullOrForbidden(SlaveInd); this.FailOnBurningImmobile(SlaveInd); this.FailOn(() => { var slave = (Pawn)this.GetActor().CurJob.GetTarget(SlaveInd).Thing; return(slave.guest.interactionMode != (PrisonerInteractionMode)Data.PIM_FreeSlave); }); this.FailOnDowned(SlaveInd); this.FailOnAggroMentalState(SlaveInd); yield return(Toils_Reserve.Reserve(SlaveInd, 1)); yield return(Toils_Goto.GotoThing(SlaveInd, PathEndMode.ClosestTouch)); yield return(Toils_Haul.StartCarryThing(SlaveInd)); var gotoToil = Toils_Goto.GotoCell(ReleaseCellInd, PathEndMode.ClosestTouch); yield return(gotoToil); yield return(Toils_Haul.PlaceHauledThingInCell(ReleaseCellInd, gotoToil, false)); yield return(Toils_Reserve.Release(SlaveInd)); yield return(Toils_Prisoner.FreeSlave(SlaveInd, CollarInd)); }
protected override IEnumerable <Toil> MakeNewToils() { Building_SpaceshipCargo cargoSpaceship = this.TargetThingA as Building_SpaceshipCargo; yield return(Toils_Goto.GotoCell(TargetIndex.A, PathEndMode.Touch).FailOn(delegate() { return (cargoSpaceship.DestroyedOrNull() || (cargoSpaceship.CanTradeNow == false)); })); Toil faceSpaceshipToil = new Toil() { initAction = () => { this.GetActor().rotationTracker.FaceCell(cargoSpaceship.Position); } }; yield return(faceSpaceshipToil); Toil tradeWithSpacehipToil = new Toil() { initAction = () => { Find.WindowStack.Add(new Dialog_Trade(this.GetActor(), cargoSpaceship as ITrader)); }, defaultCompleteMode = ToilCompleteMode.Instant }; yield return(tradeWithSpacehipToil); yield return(Toils_Reserve.Release(cargoSpaceshipIndex)); }
protected override IEnumerable <Toil> MakeNewToils() { const float skillGainPerTick = 0.08f; this.FailOnDespawnedNullOrForbidden(TargetIndex.A); this.FailOnBurningImmobile(TargetIndex.A); this.FailOn(delegate { return((this.CurJob.targetA.Thing as Building_MiningTurret).targetPosition == IntVec3.Invalid); }); yield return(Toils_Reserve.Reserve(drillTurretIndex)); yield return(Toils_Goto.GotoCell(drillTurretIndex, PathEndMode.InteractionCell)); Toil operateDrillTurretToil = new Toil() { tickAction = () => { Pawn actor = this.GetActor(); float miningEfficiency = (float)actor.skills.GetSkill(SkillDefOf.Mining).Level / (float)SkillRecord.MaxLevel; (this.CurJob.targetA.Thing as Building_MiningTurret).SetOperatorEfficiency(miningEfficiency); this.GetActor().skills.Learn(SkillDefOf.Mining, skillGainPerTick); }, defaultCompleteMode = ToilCompleteMode.Never }; yield return(operateDrillTurretToil); yield return(Toils_Reserve.Release(drillTurretIndex)); }
/// <summary> /// 行为过程 /// </summary> /// <returns></returns> protected override IEnumerable <Toil> MakeNewToils() { this.FailOnDestroyedOrNull(TargetIndex.A); //报空 this.FailOnAggroMentalStateAndHostile(TargetIndex.A); //B精神不正常 yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch)); //走到犯人旁边 Pawn prisoner = (Pawn)Target; if (prisoner != null && !prisoner.Dead) { yield return(Toils_General.WaitWith(TargetIndex.A, 60, true, true)); //交互1秒 yield return(Toils_Reserve.Release(TargetIndex.A)); //释放 yield return(new Toil { initAction = delegate() { if (prisoner != null) { CompUsableRemoveEffectChians compUseEffect = prisoner.TryGetComp <CompUsableRemoveEffectChians>();//触发效果 if (compUseEffect != null) { compUseEffect.UsedBy(prisoner); MoteMaker.ThrowText(prisoner.PositionHeld.ToVector3(), prisoner.MapHeld, "SR_Release".Translate(), 4f); } } }, defaultCompleteMode = ToilCompleteMode.Instant }); } yield break; }
// Token: 0x0600012B RID: 299 RVA: 0x0000C0A4 File Offset: 0x0000A4A4 protected override IEnumerable <Toil> MakeNewToils() { yield return(Toils_Reserve.Reserve((Verse.AI.TargetIndex) 1, 1, -1, null)); yield return(Toils_Reserve.Reserve((Verse.AI.TargetIndex) 2, 1, -1, null)); yield return(Toils_Goto.GotoThing((Verse.AI.TargetIndex) 1, (Verse.AI.PathEndMode) 3)); yield return(Toils_Haul.StartCarryThing((Verse.AI.TargetIndex) 1, false, false)); yield return(Toils_Haul.CarryHauledThingToCell((Verse.AI.TargetIndex) 2)); Toil t2 = Toils_General.Wait(1000); t2.AddFailCondition(() => !this.Emitter.GetComp <CompPowerTrader>().PowerOn); t2 = ToilEffects.WithProgressBar(t2, (Verse.AI.TargetIndex) 1, () => (1000f - (float)this.ticksLeftThisToil) / 1000f, false, -0.5f); yield return(t2); yield return(new Toil { defaultCompleteMode = (Verse.AI.ToilCompleteMode) 1, initAction = delegate() { this.Emitter.GetComp <CompHoloEmitter>().Scan(this.Corpse); } }); yield return(Toils_Reserve.Release((Verse.AI.TargetIndex) 2)); yield break; }
protected override IEnumerable <Toil> MakeNewToils() { yield return(Toils_Reserve.Reserve(TargetIndex.A, 4, 0, null)); yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch)); Toil t2 = Toils_General.Wait(6000); t2.AddFailCondition(() => this.Building.GetComp <CompWeatherSat>() == null); t2 = t2.WithEffect(EffecterDefOf.Research, TargetIndex.A); t2.tickAction = delegate() { float num = 0.0002f; num *= 1f + 0.5f * (float)base.GetActor().story.traits.DegreeOfTrait(TraitDef.Named("PsychicSensitivity")); CompWeatherSat comp = this.Building.GetComp <CompWeatherSat>(); if (comp != null) { comp.mana += num; if (comp.mana < 0f) { comp.mana = 0f; } if (comp.mana > 100f) { comp.mana = 100f; } } }; yield return(t2); yield return(Toils_Reserve.Release(TargetIndex.A)); yield break; }
protected override IEnumerable <Toil> MakeNewToils() { AddFailCondition(JobHasFailed); var wire = TargetThingA as Building_DetonatorWire; if (wire == null) { yield break; } yield return(Toils_Reserve.Reserve(TargetIndex.A)); yield return(Toils_Goto.GotoCell(TargetIndex.A, PathEndMode.Touch)); var jobDuration = wire.DryOffJobDuration; yield return(Toils_General.Wait(jobDuration).WithEffect(EffecterDefOf.Clean, TargetIndex.A).WithProgressBarToilDelay(TargetIndex.A, jobDuration)); yield return(new Toil { initAction = () => { if (wire.WantDrying) { wire.DryOff(); } }, defaultCompleteMode = ToilCompleteMode.Instant }); yield return(Toils_Reserve.Release(TargetIndex.A)); }
protected override IEnumerable <Toil> MakeNewToils() { this.FailOnDespawnedNullOrForbidden(TargetIndex.A); yield return(Toils_Reserve.Reserve(TargetIndex.A, 1)); //Toil 1: Go to the pruning site. yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch)); //Toil 2: Begin pruning. Toil toil = new Toil(); toil.defaultCompleteMode = ToilCompleteMode.Delay; toil.defaultDuration = JobDriver_PruneAndRepair.remainingDuration; toil.WithProgressBarToilDelay(TargetIndex.A, false, -0.5f); toil.initAction = delegate { this.ticksToNextRepair = 80f; }; toil.tickAction = delegate { Pawn actor = this.pawn; actor.skills.Learn(SkillDefOf.Construction, 0.5f, false); actor.skills.Learn(SkillDefOf.Plants, 0.5f, false); float statValue = actor.GetStatValue(StatDefOf.ConstructionSpeed, true); this.ticksToNextRepair -= statValue; if (this.ticksToNextRepair <= 0f) { this.ticksToNextRepair += 16f; this.TargetThingA.HitPoints++; this.TargetThingA.HitPoints = Mathf.Min(this.TargetThingA.HitPoints, this.TargetThingA.MaxHitPoints); //if (this.TargetThingA.HitPoints == this.TargetThingA.MaxHitPoints) //{ // actor.records.Increment(RecordDefOf.ThingsRepaired); // actor.jobs.EndCurrentJob(JobCondition.Succeeded, true); //} } }; toil.WithEffect(base.TargetThingA.def.repairEffect, TargetIndex.A); toil.defaultCompleteMode = ToilCompleteMode.Delay; yield return(toil); //Toil 3 Unreserve yield return(Toils_Reserve.Release(TargetIndex.A)); //Toil 4: Transform the altar once again. yield return(new Toil { initAction = delegate { PruneResult(); }, defaultCompleteMode = ToilCompleteMode.Instant }); yield break; }
protected override IEnumerable <Toil> MakeNewToils() { yield return(Toils_Reserve.Reserve(aquacultureBasinIndex)); Building_AquacultureBasin aquacultureBasin = this.TargetThingA as Building_AquacultureBasin; yield return(Toils_Goto.GotoThing(aquacultureBasinIndex, PathEndMode.InteractionCell)); yield return(Toils_General.Wait(120).WithProgressBarToilDelay(aquacultureBasinIndex)); Toil getAquacultureBasinProduction = new Toil() { initAction = () => { Job curJob = this.pawn.jobs.curJob; Thing product = aquacultureBasin.GetProduction(); if (product == null) { this.pawn.jobs.EndCurrentJob(JobCondition.Succeeded); } else { GenSpawn.Spawn(product, aquacultureBasin.InteractionCell, this.Map); IntVec3 storageCell; if (StoreUtility.TryFindBestBetterStoreCellFor(product, this.pawn, this.Map, StoragePriority.Unstored, this.pawn.Faction, out storageCell, true)) { this.pawn.carryTracker.TryStartCarry(product); curJob.targetB = storageCell; curJob.targetC = product; curJob.count = 99999; } else { this.pawn.jobs.EndCurrentJob(JobCondition.Succeeded); } } } }; yield return(getAquacultureBasinProduction); // Reserve the product and storage cell. yield return(Toils_Reserve.Reserve(TargetIndex.B)); yield return(Toils_Reserve.Reserve(TargetIndex.C)); yield return(Toils_Reserve.Release(aquacultureBasinIndex)); Toil carryToCell = Toils_Haul.CarryHauledThingToCell(TargetIndex.B); yield return(carryToCell); yield return(Toils_Haul.PlaceHauledThingInCell(TargetIndex.B, carryToCell, true)); }
protected override IEnumerable <Toil> MakeNewToils() { this.EndOnDespawnedOrNull(TargetIndex.A); Toil chooseCell = Toils_Wrestling.FindRandomInsideReachableCell(TargetIndex.A, TargetIndex.B); yield return(chooseCell); yield return(Toils_Reserve.Reserve(TargetIndex.B)); yield return(Toils_Goto.GotoCell(TargetIndex.B, PathEndMode.OnCell)); Toil toil = new Toil(); toil.initAction = delegate { job.locomotionUrgency = LocomotionUrgency.Jog; }; toil.tickAction = delegate { pawn.rotationTracker.FaceCell(base.TargetA.Thing.OccupiedRect().CenterCell); if (ticksLeftThisToil == 150) { Random random = new System.Random(); if (random.NextDouble() > 0.7) { SoundDefOf.Corpse_Drop.PlayOneShot(new TargetInfo(pawn.Position, pawn.Map)); } else { SoundDefOf.Pawn_Melee_Punch_HitPawn.PlayOneShot(new TargetInfo(pawn.Position, pawn.Map)); } } if (Find.TickManager.TicksGame > startTick + job.def.joyDuration) { EndJobWith(JobCondition.Succeeded); } else { JoyUtility.JoyTickCheckEnd(pawn, JoyTickFullJoyAction.EndJob, 1f, (Building)base.TargetThingA); } }; toil.handlingFacing = true; toil.socialMode = RandomSocialMode.SuperActive; toil.defaultCompleteMode = ToilCompleteMode.Delay; toil.defaultDuration = MoveDuration; toil.AddFinishAction(delegate { JoyUtility.TryGainRecRoomThought(pawn); }); yield return(toil); yield return(Toils_Reserve.Release(TargetIndex.B)); yield return(Toils_Jump.Jump(chooseCell)); }
protected override IEnumerable <Toil> MakeNewToils() { yield return(Toils_Reserve.Reserve(TargetIndex.A).FailOnDespawnedOrForbiddenPlacedThings()); yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell) .FailOnDespawnedOrForbiddenPlacedThings()); yield return(Manage(TargetIndex.A).FailOnDespawnedOrForbiddenPlacedThings()); yield return(Toils_Reserve.Release(TargetIndex.A)); }
protected override IEnumerable <Toil> MakeNewToils() { //yield return GetMaterial; //yield return Toils_Haul.StartCarryThing(TargetIndex.B); yield return(Toils_Reserve.Reserve(TargetIndex.A)); yield return(Goto); yield return(ToilRepair); yield return(Toils_Reserve.Release(TargetIndex.A)); }
/// <summary> /// 行为过程 /// </summary> /// <returns></returns> protected override IEnumerable <Toil> MakeNewToils() { Pawn prisoner = (Pawn)Target; //小人身上已经存在锁链 if (prisoner.HasChains()) { yield break; } this.FailOnDestroyedOrNull(TargetIndex.A); this.FailOnDestroyedOrNull(TargetIndex.B); //this.FailOnDespawnedNullOrForbidden(TargetIndex.A);//如果物品没有forbidden组件千万不要用这个条件,会直接判断失败 this.FailOnAggroMentalStateAndHostile(TargetIndex.B); //B精神不正常 yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch)); //走到道具 yield return(new Toil { initAction = () => { pawn.carryTracker.TryStartCarry(Thing, 1, true); }, defaultCompleteMode = ToilCompleteMode.Instant }); yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.Touch));//走到囚犯 //捆绑操作 if (!prisoner.Dead) { yield return(Toils_General.WaitWith(TargetIndex.B, 60, true, true)); //交互1秒 yield return(Toils_Reserve.Release(TargetIndex.A)); //释放 yield return(Toils_Reserve.Release(TargetIndex.B)); //家具的效果 yield return(new Toil { initAction = delegate() { if (Thing != null) { CompUseEffect compUseEffect = Thing.TryGetComp <CompUseEffect>(); if (compUseEffect != null) { compUseEffect.DoEffect(prisoner); MoteMaker.ThrowText(Target.PositionHeld.ToVector3(), Target.MapHeld, "SR_Bound".Translate(), 4f); } } }, defaultCompleteMode = ToilCompleteMode.Instant }); } yield break; }
protected override IEnumerable <Toil> MakeNewToils() { this.FailOnDespawnedNullOrForbidden(TargetIndex.A); yield return(Toils_Reserve.Reserve(TargetIndex.A)); //Toil 1: Go to the pruning site. yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch)); //Toil 2: Begin pruning. var toil = new Toil { defaultCompleteMode = ToilCompleteMode.Delay, defaultDuration = remainingDuration }; toil.WithProgressBarToilDelay(TargetIndex.A); toil.initAction = delegate { ticksToNextRepair = WarmupTicks; }; toil.tickAction = delegate { var actor = pawn; actor.skills.Learn(SkillDefOf.Construction, 0.5f); var statValue = actor.GetStatValue(StatDefOf.ConstructionSpeed); ticksToNextRepair -= statValue; if (!(ticksToNextRepair <= 0f)) { return; } ticksToNextRepair += TicksBetweenRepairs; TargetThingA.HitPoints++; TargetThingA.HitPoints = Mathf.Min(TargetThingA.HitPoints, TargetThingA.MaxHitPoints); //if (this.TargetThingA.HitPoints == this.TargetThingA.MaxHitPoints) //{ // actor.records.Increment(RecordDefOf.ThingsRepaired); // actor.jobs.EndCurrentJob(JobCondition.Succeeded, true); //} }; toil.WithEffect(TargetThingA.def.repairEffect, TargetIndex.A); toil.defaultCompleteMode = ToilCompleteMode.Delay; yield return(toil); //Toil 3 Unreserve yield return(Toils_Reserve.Release(TargetIndex.A)); //Toil 4: Transform the altar once again. yield return(new Toil { initAction = LightBeacon, defaultCompleteMode = ToilCompleteMode.Instant }); }
protected override IEnumerable <Toil> MakeNewToils() { this.EndOnDespawnedOrNull(TargetIndex.A, JobCondition.Incompletable); Toil chooseCell = Toils_Misc.FindRandomAdjacentReachableCell(TargetIndex.A, TargetIndex.B); yield return(chooseCell); yield return(Toils_Reserve.Reserve(TargetIndex.B, 1, -1, null)); yield return(Toils_Goto.GotoCell(TargetIndex.B, PathEndMode.OnCell)); Toil play = new Toil(); play.initAction = delegate() { this.job.locomotionUrgency = LocomotionUrgency.Walk; }; play.tickAction = delegate() { this.pawn.rotationTracker.FaceCell(base.TargetA.Thing.OccupiedRect().ClosestCellTo(this.pawn.Position)); if (this.ticksLeftThisToil == 300) { SoundDefOf.PlayBilliards.PlayOneShot(new TargetInfo(this.pawn.Position, this.pawn.Map, false)); } if (Find.TickManager.TicksGame > this.startTick + this.job.def.joyDuration) { base.EndJobWith(JobCondition.Succeeded); } else { Pawn pawn = this.pawn; Building joySource = (Building)base.TargetThingA; JoyUtility.JoyTickCheckEnd(pawn, JoyTickFullJoyAction.EndJob, 1f, joySource); } }; play.handlingFacing = true; play.socialMode = RandomSocialMode.SuperActive; play.defaultCompleteMode = ToilCompleteMode.Delay; play.defaultDuration = 600; play.AddFinishAction(delegate { JoyUtility.TryGainRecRoomThought(this.pawn); }); yield return(play); yield return(Toils_Reserve.Release(TargetIndex.B)); yield return(Toils_Jump.Jump(chooseCell)); yield break; }
protected override IEnumerable<Toil> MakeNewToils() { this.FailOnDestroyedOrNull(TargetIndex.A); this.FailOnDestroyedOrNull(TargetIndex.B); this.FailOnAggroMentalStateAndHostile(TargetIndex.A); base.AddFinishAction(delegate { Log.Message("Finished"); Building_DominationDevice.targetsAway.Remove(device); Takee.health.AddHediff(DefDatabase<HediffDef>.GetNamed("Restrained")); DominationUtil.RestrainedPawns.Add(Takee); }); yield return Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnDespawnedNullOrForbidden(TargetIndex.A).FailOnDespawnedNullOrForbidden(TargetIndex.B).FailOn(() => this.job.def == JobDefOf.Arrest && !this.Takee.CanBeArrestedBy(this.pawn)).FailOn(() => !this.pawn.CanReach(this.device, PathEndMode.OnCell, Danger.Deadly, false, TraverseMode.ByPawn)).FailOn(() => this.job.def == JobDefOf.Rescue && !this.Takee.Downed).FailOnSomeonePhysicallyInteracting(TargetIndex.A); yield return new Toil { initAction = delegate { pawn.jobs.curJob.count = 1; } }; Toil startCarrying = Toils_Haul.StartCarryThing(TargetIndex.A, false, false, false); yield return startCarrying; yield return Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.Touch); yield return new Toil { initAction = delegate { if (this.Takee.playerSettings == null) { this.Takee.playerSettings = new Pawn_PlayerSettings(this.Takee); } } }; yield return Toils_Reserve.Release(TargetIndex.B); yield return new Toil { initAction = delegate { IntVec3 position = this.device.Position; Thing thing; this.pawn.carryTracker.TryDropCarriedThing(position, ThingPlaceMode.Direct, out thing, null); }, defaultCompleteMode = ToilCompleteMode.Instant }; }
protected override IEnumerable <Toil> MakeNewToils() { this.FailOnDestroyedNullOrForbidden(PrisonerInd); this.FailOnBurningImmobile(HaulToInd); if (!pawn.CurJob.GetTarget(PrisonerInd).Thing.IsForbidden(pawn)) { this.FailOnForbidden(PrisonerInd); } this.AddEndCondition(() => { // Cancel out if the prisoner enters the target room on their own var prisonerRoom = pawn.jobs.curJob.GetTarget(PrisonerInd).Thing.Position.GetRoom(); var targetRoom = pawn.jobs.curJob.GetTarget(HaulToInd).Cell.GetRoom(); return(prisonerRoom == targetRoom ? JobCondition.Succeeded : JobCondition.Ongoing); }); yield return(Toils_Reserve.Reserve(HaulToInd, 1)); yield return(Toils_Reserve.Reserve(PrisonerInd, 1)); var toilGoto = Toils_Goto.GotoThing(PrisonerInd, PathEndMode.ClosestTouch) .FailOn(() => { Job job = pawn.jobs.curJob; if (job.haulMode == HaulMode.ToCellStorage) { Thing prisoner = job.GetTarget(PrisonerInd).Thing; if (!pawn.jobs.curJob.GetTarget(HaulToInd).Cell.IsValidStorageFor(prisoner)) { return(true); } } return(false); }); yield return(toilGoto); yield return(Toils_Haul.StartCarryThing(PrisonerInd)); var carryToCell = Toils_Haul.CarryHauledThingToCell(HaulToInd); yield return(carryToCell); yield return(Toils_Haul.PlaceHauledThingInCell(HaulToInd, carryToCell, true)); yield return(Toils_Prisoner.NoLongerNeedsHauling(PrisonerInd)); yield return(Toils_Reserve.Release(HaulToInd)); yield return(Toils_Reserve.Release(PrisonerInd)); }
protected override IEnumerable <Toil> MakeNewToils() { AddFailCondition(JobHasFailed); var table = TargetThingA as Building_DetonatorTable; if (table == null) { yield break; } yield return(Toils_Reserve.Reserve(TableInd)); yield return(Toils_Reserve.Reserve(ComponentInd)); yield return(Toils_Goto.GotoCell(ComponentInd, PathEndMode.Touch)); yield return(Toils_Haul.StartCarryThing(ComponentInd)); yield return(Toils_Goto.GotoCell(TableInd, PathEndMode.InteractionCell)); yield return(Toils_Haul.PlaceHauledThingInCell(TableInd, null, false)); var toil = new Toil { initAction = delegate { workLeft = InstallWorkAmount; }, tickAction = delegate { var statValue = GetActor().GetStatValue(StatDefOf.ConstructionSpeed); workLeft -= statValue; if (workLeft > 0) { return; } if (table.WantChannelsComponent) { table.InstallChannelsComponent(); } Map.reservationManager.Release(TargetThingB, GetActor()); TargetThingB.Destroy(); ReadyForNextToil(); } }; toil.WithEffect(EffecterDefOf.ConstructMetal, TableInd); toil.WithProgressBar(TargetIndex.A, () => 1f - workLeft / InstallWorkAmount); toil.defaultCompleteMode = ToilCompleteMode.Never; yield return(toil); yield return(Toils_Reserve.Release(TableInd)); }
protected override IEnumerable <Toil> MakeNewToils() { yield return(Toils_Reserve.Reserve(TargetIndex.A, 1, -1, null)); yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch)); Toil tFuel = new Toil(); tFuel.defaultCompleteMode = ToilCompleteMode.Instant; tFuel.AddFailCondition(() => this.Casket.GetComp <CompRefuelable>().Fuel < 50f); tFuel.AddFailCondition(() => !this.Casket.GetComp <CompPowerTrader>().PowerOn); tFuel.initAction = delegate() { this.Casket.GetComp <CompRefuelable>().ConsumeFuel(25f); }; yield return(tFuel); Toil t2 = Toils_General.Wait(6000); t2.AddFailCondition(() => !this.Casket.GetComp <CompPowerTrader>().PowerOn); t2.initAction = delegate() { this.Casket.Map.weatherManager.TransitionTo(WeatherDef.Named("RainyThunderstorm")); }; t2 = t2.WithProgressBar(TargetIndex.A, () => (6000f - (float)this.ticksLeftThisToil) / 6000f, false, -0.5f); yield return(t2); yield return(new Toil { defaultCompleteMode = ToilCompleteMode.Instant, initAction = delegate() { GenExplosion.DoExplosion(this.Casket.Position, this.Casket.Map, 50f, DamageDefOf.EMP, this.Casket, -1, -1f, SoundDefOf.EnergyShield_Broken, null, null, null, null, 0f, 1, false, null, 0f, 1); this.Casket.GetComp <CompOsiris>().HealContained(); this.Casket.Map.weatherManager.TransitionTo(WeatherDef.Named("Rain")); IncidentParms incidentParms = StorytellerUtility.DefaultParmsNow(IncidentCategoryDefOf.FactionArrival, this.Casket.Map); incidentParms.forced = true; incidentParms.target = this.Casket.Map; QueuedIncident qi = new QueuedIncident(new FiringIncident(IncidentDef.Named("ShortCircuit"), null, incidentParms), Find.TickManager.TicksGame + 1); Find.Storyteller.incidentQueue.Add(qi); } }); yield return(Toils_Reserve.Release(TargetIndex.A)); yield break; }
/// <summary> /// 行为过程 /// </summary> /// <returns></returns> protected override IEnumerable <Toil> MakeNewToils() { Pawn prisoner = (Pawn)Target; this.FailOnDestroyedOrNull(TargetIndex.A); this.FailOnDestroyedOrNull(TargetIndex.B); //this.FailOnDespawnedNullOrForbidden(TargetIndex.A);//如果物品没有forbidden组件千万不要用这个条件,会直接判断失败 this.FailOnAggroMentalStateAndHostile(TargetIndex.B); //B精神不正常 yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch)); //走到道具 yield return(new Toil { initAction = () => { pawn.carryTracker.TryStartCarry(Thing, 1, true); }, defaultCompleteMode = ToilCompleteMode.Instant }); yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.Touch));//走到囚犯 if (!prisoner.Dead) { yield return(Toils_General.WaitWith(TargetIndex.B, 60, true, true)); //交互1秒 yield return(Toils_Reserve.Release(TargetIndex.A)); //释放 yield return(Toils_Reserve.Release(TargetIndex.B)); yield return(new Toil { initAction = delegate() { if (Thing != null) { CompUseEffect compUseEffect = Thing.TryGetComp <CompUseEffect>(); if (compUseEffect != null) { compUseEffect.DoEffect(prisoner); //获得快感 pawn.needs.mood.thoughts.memories.TryGainMemory(Thought.ThoughtDefOf.SR_Thought_Maltreat); } } }, defaultCompleteMode = ToilCompleteMode.Instant }); } yield break; }
protected override IEnumerable <Toil> MakeNewToils() { this.FailOn(FailCondition); yield return(GotoGuest(pawn, Talkee)); yield return(Toils_Interpersonal.WaitToBeAbleToInteract(pawn)); yield return(Toils_Reserve.Reserve(TargetIndex.A)); //yield return GotoGuest(pawn, Talkee); yield return(Interact(Talkee, InteractionDefOf.BuildRapport, GuestUtility.InteractIntervalAbsoluteMin)); yield return(TryImproveRelationship(pawn, Talkee)); yield return(Toils_Reserve.Release(TargetIndex.A)); //yield return Toils_Interpersonal.SetLastInteractTime(TargetIndex.A); }