public static Toil MakeSolidThingFromBlueprintIfNecessary(TargetIndex blueTarget, TargetIndex targetToUpdate = TargetIndex.None) { Toil toil = new Toil(); toil.initAction = delegate { Pawn actor = toil.actor; Job curJob = actor.jobs.curJob; Blueprint blueprint = curJob.GetTarget(blueTarget).Thing as Blueprint; if (blueprint != null) { bool flag = targetToUpdate != TargetIndex.None && curJob.GetTarget(targetToUpdate).Thing == blueprint; Thing thing; bool flag2; if (blueprint.TryReplaceWithSolidThing(actor, out thing, out flag2)) { curJob.SetTarget(blueTarget, thing); if (flag) { curJob.SetTarget(targetToUpdate, thing); } if (thing is Frame) { actor.Reserve(thing, curJob, 1, -1, null, true); } } if (flag2) { return; } } }; return(toil); }
public static Toil MakeSolidThingFromBlueprintIfNecessary(TargetIndex blueTarget, TargetIndex targetToUpdate = TargetIndex.None) { Toil toil = new Toil(); toil.initAction = delegate { Pawn actor = toil.actor; Job curJob = actor.jobs.curJob; Blueprint blueprint = curJob.GetTarget(blueTarget).Thing as Blueprint; if (blueprint != null) { bool flag = targetToUpdate != 0 && curJob.GetTarget(targetToUpdate).Thing == blueprint; if (blueprint.TryReplaceWithSolidThing(actor, out Thing createdThing, out bool jobEnded)) { curJob.SetTarget(blueTarget, createdThing); if (flag) { curJob.SetTarget(targetToUpdate, createdThing); } if (createdThing is Frame) { actor.Reserve(createdThing, curJob); } } if (!jobEnded) { } } }; return(toil); }
internal void <> m__0() { Pawn actor = this.toil.actor; Job curJob = actor.jobs.curJob; Blueprint blueprint = curJob.GetTarget(this.blueTarget).Thing as Blueprint; if (blueprint != null) { bool flag = this.targetToUpdate != TargetIndex.None && curJob.GetTarget(this.targetToUpdate).Thing == blueprint; Thing thing; bool flag2; if (blueprint.TryReplaceWithSolidThing(actor, out thing, out flag2)) { curJob.SetTarget(this.blueTarget, thing); if (flag) { curJob.SetTarget(this.targetToUpdate, thing); } if (thing is Frame) { actor.Reserve(thing, curJob, 1, -1, null); } } if (flag2) { } } }