public static bool Laying(this PawnPosture posture) { if (posture != PawnPosture.LayingOnGroundFaceUp && posture != PawnPosture.LayingOnGroundNormal) { return(posture == PawnPosture.LayingInBed); } return(true); }
protected Toil SetPosture(PawnPosture posture) { return(new Toil() { initAction = () => { pawn.jobs.posture = posture; }, defaultCompleteMode = ToilCompleteMode.Instant }); }
// Token: 0x0600000A RID: 10 RVA: 0x000022B0 File Offset: 0x000004B0 public bool JobIsLyingDown(Pawn pawn) { if (pawn != null && pawn.CurJob != null) { PawnPosture posture = PawnUtility.GetPosture(pawn); if (posture == PawnPosture.LayingOnGroundNormal || posture == PawnPosture.LayingOnGroundFaceUp || posture == PawnPosture.LayingInBed) { return(true); } } return(false); }
//Posture public static void PostureTweak_Postfix(Pawn pawn, ref PawnPosture __result) { List <string> antBeds = new List <string>() { "AntSleepingSpot", "AntSleepingAlcove", "AntFluffFortress" }; if (pawn.kindDef?.race?.defName == "Ant_AntiniumRace") { if (antBeds.Contains(pawn.CurrentBed()?.def.defName)) { __result = PawnPosture.Standing; } } }
// public static float horHeadOffset; protected override void DoBasicSettingsMenu(Listing_Standard listing) { base.DoBasicSettingsMenu(listing); GetBodyAnimDef(); // listing_Standard.CheckboxLabeled("Equipment", ref Equipment); // listing_Standard.Label(horHeadOffset.ToString("N2") + " - " + verHeadOffset.ToString("N2")); // horHeadOffset = listing_Standard.Slider(horHeadOffset, -1f, 1f); // verHeadOffset = listing_Standard.Slider(verHeadOffset, -1f, 1f); listing.Label(CompAnim.BodyAnim.offCenterX.ToString("N2")); CompAnim.BodyAnim.offCenterX = listing.Slider(CompAnim.BodyAnim.offCenterX, -0.2f, 0.2f); if (listing.ButtonText(EditorPoseCycle?.LabelCap)) { List <string> exists = new List <string>(); List <FloatMenuOption> list = new List <FloatMenuOption>(); CompAnim.BodyAnim.poseCycles.Clear(); foreach (PoseCycleDef posecycle in (from bsm in DefDatabase <PoseCycleDef> .AllDefs orderby bsm.LabelCap select bsm) .TakeWhile(current => CompAnim.BodyAnim.PoseCycleType != "None") .Where(current => current.PoseCycleType == CompAnim.BodyAnim.PoseCycleType)) { list.Add(new FloatMenuOption(posecycle.LabelCap, delegate { EditorPoseCycle = posecycle; })); exists.Add(posecycle.pawnPosture.ToString()); CompAnim.BodyAnim.poseCycles.Add(posecycle); } string[] names = Enum.GetNames(typeof(PawnPosture)); for (int index = 0; index < names.Length; index++) { string name = names[index]; PawnPosture myenum = (PawnPosture)Enum.ToObject(typeof(PawnPosture), index); if (exists.Contains(myenum.ToString())) { continue; } list.Add( new FloatMenuOption( "Add new " + CompAnim.BodyAnim.PoseCycleType + "_" + myenum, delegate { PoseCycleDef newCycle = new PoseCycleDef(); newCycle.defName = newCycle.label = CompAnim.BodyAnim.PoseCycleType + "_" + name; newCycle.pawnPosture = myenum; newCycle.PoseCycleType = CompAnim.BodyAnim.PoseCycleType; GameComponent_FacialStuff.BuildPoseCycles(newCycle); EditorPoseCycle = newCycle; CompAnim.BodyAnim.poseCycles.Add(newCycle); })); } Find.WindowStack.Add(new FloatMenu(list)); } listing.Gap(); string configFolder = DefPath; if (listing.ButtonText("Export BodyDef")) { string filePath = configFolder + "/BodyAnimDefs/" + CompAnim.BodyAnim.defName + ".xml"; Find.WindowStack.Add( Dialog_MessageBox.CreateConfirmation( "Confirm overwriting " + filePath, delegate { ExportAnimDefs.Defs animDef = new ExportAnimDefs.Defs(CompAnim.BodyAnim); DirectXmlSaver.SaveDataObject( animDef, filePath); }, true)); // BodyAnimDef animDef = this.bodyAnimDef; } if (listing.ButtonText("Export PoseCycle")) { string path = configFolder + "/PoseCycleDefs/" + EditorPoseCycle?.defName + ".xml"; Find.WindowStack.Add( Dialog_MessageBox.CreateConfirmation( "Confirm overwriting " + path, delegate { ExportPoseCycleDefs.Defs cycle = new ExportPoseCycleDefs.Defs(EditorPoseCycle); DirectXmlSaver.SaveDataObject( cycle, path); }, true)); } }
public static bool Laying(this PawnPosture posture) { return(posture == PawnPosture.LayingOnGroundFaceUp || posture == PawnPosture.LayingOnGroundNormal || posture == PawnPosture.LayingInBed); }
public override void Notify_LastPosture(PawnPosture posture, LayingDownState layingDown) { this.lastPosture = posture; base.layingDown = layingDown; }
public virtual void Notify_LastPosture(PawnPosture posture, LayingDownState layingDown) { }
public void StartJob(Job newJob, JobCondition lastJobEndCondition = JobCondition.None, ThinkNode jobGiver = null, bool resumeCurJobAfterwards = false, bool cancelBusyStances = true, ThinkTreeDef thinkTree = null, JobTag?tag = null, bool fromQueue = false) { this.startingNewJob = true; try { if (!fromQueue && (!Find.TickManager.Paused || this.lastJobGivenAtFrame == RealTime.frameCount)) { this.jobsGivenThisTick++; this.jobsGivenThisTickTextual = this.jobsGivenThisTickTextual + "(" + newJob.ToString() + ") "; } this.lastJobGivenAtFrame = RealTime.frameCount; if (this.jobsGivenThisTick > 10) { string text = this.jobsGivenThisTickTextual; this.jobsGivenThisTick = 0; this.jobsGivenThisTickTextual = string.Empty; this.startingNewJob = false; this.pawn.ClearReservationsForJob(newJob); this.StartErrorRecoverJob(string.Concat(new object[] { this.pawn, " started 10 jobs in one tick. newJob=", newJob, " jobGiver=", jobGiver, " jobList=", text })); } else { PawnPosture posture = this.pawn.GetPosture(); LayingDownState layingDown = (this.pawn.jobs == null || this.pawn.jobs.curDriver == null) ? LayingDownState.NotLaying : this.pawn.jobs.curDriver.layingDown; if (this.debugLog) { this.DebugLogEvent(string.Concat(new object[] { "StartJob [", newJob, "] lastJobEndCondition=", lastJobEndCondition, ", jobGiver=", jobGiver, ", cancelBusyStances=", cancelBusyStances })); } if (cancelBusyStances && this.pawn.stances.FullBodyBusy) { this.pawn.stances.CancelBusyStanceHard(); } if (this.curJob != null) { if (lastJobEndCondition == JobCondition.None) { Log.Warning(string.Concat(new object[] { this.pawn, " starting job ", newJob, " from JobGiver ", this.pawn.mindState.lastJobGiver, " while already having job ", this.curJob, " without a specific job end condition." })); lastJobEndCondition = JobCondition.InterruptForced; } if (resumeCurJobAfterwards && this.curJob.def.suspendable) { this.jobQueue.EnqueueFirst(this.curJob, null); if (this.debugLog) { this.DebugLogEvent(" JobQueue EnqueueFirst curJob: " + this.curJob); } this.CleanupCurrentJob(lastJobEndCondition, false, cancelBusyStances); } else { this.CleanupCurrentJob(lastJobEndCondition, true, cancelBusyStances); } } if (newJob == null) { Log.Warning(this.pawn + " tried to start doing a null job."); } else { newJob.startTick = Find.TickManager.TicksGame; if (this.pawn.Drafted || newJob.playerForced) { newJob.ignoreForbidden = true; newJob.ignoreDesignations = true; } this.curJob = newJob; this.pawn.mindState.lastJobGiver = jobGiver; this.pawn.mindState.lastJobGiverThinkTree = thinkTree; this.curDriver = this.curJob.MakeDriver(this.pawn); if (this.curDriver.TryMakePreToilReservations()) { if (tag.HasValue) { this.pawn.mindState.lastJobTag = tag.Value; } this.curDriver.Notify_Starting(); this.curDriver.Notify_LastPosture(posture, layingDown); this.curDriver.SetupToils(); this.curDriver.ReadyForNextToil(); } else if (fromQueue) { this.EndCurrentJob(JobCondition.QueuedNoLongerValid, true); } else { Log.Warning("TryMakePreToilReservations() returned false for a non-queued job right after StartJob(). This should have been checked before. curJob=" + this.curJob.ToStringSafe <Job>()); this.EndCurrentJob(JobCondition.Errored, true); } } } } finally { this.startingNewJob = false; } }