job duration reset during actor shift

This commit is contained in:
c0ffeeeeeeee 2020-10-28 20:47:16 -07:00
parent 20cecf3190
commit ac5721df82
3 changed files with 33 additions and 2 deletions

View file

@ -49,8 +49,7 @@ namespace Rimworld_Animations {
AnimationSettings.rotation.Add(def.defName + curPawn.def.defName + ActorIndex, 0);
}
listingStandard.Label("Offset for race " + curPawn.def.defName + " in actor position " + curPawn.TryGetComp<CompBodyAnimator>().ActorIndex + " for animation " + def.label + (curPawn.TryGetComp<CompBodyAnimator>().Mirror ? " mirrored" : ""));
listingStandard.Label("Name: " + curPawn.Name + " Race: " + curPawn.def.defName + " Actor Index: " + curPawn.TryGetComp<CompBodyAnimator>().ActorIndex + " Animation: " + def.label + (curPawn.TryGetComp<CompBodyAnimator>().Mirror ? " mirrored" : ""));
if(curPawn.def.defName == "Human") {
listingStandard.Label("Warning--You generally don't want to change human offsets, only alien offsets");
@ -82,6 +81,15 @@ namespace Rimworld_Animations {
for(int i = 0; i < curPawn.TryGetComp<CompBodyAnimator>().actorsInCurrentAnimation.Count; i++) {
curPawn.TryGetComp<CompBodyAnimator>().actorsInCurrentAnimation[i].TryGetComp<CompBodyAnimator>()?.shiftActorPositionAndRestartAnimation();
//reset the clock time of every pawn in animation
if(curPawn.TryGetComp<CompBodyAnimator>().actorsInCurrentAnimation[i].jobs.curDriver is rjw.JobDriver_Sex) {
(curPawn.TryGetComp<CompBodyAnimator>().actorsInCurrentAnimation[i].jobs.curDriver as rjw.JobDriver_Sex).ticks_left = def.animationTimeTicks;
(curPawn.TryGetComp<CompBodyAnimator>().actorsInCurrentAnimation[i].jobs.curDriver as rjw.JobDriver_Sex).ticksLeftThisToil = def.animationTimeTicks;
(curPawn.TryGetComp<CompBodyAnimator>().actorsInCurrentAnimation[i].jobs.curDriver as rjw.JobDriver_Sex).duration = def.animationTimeTicks;
(curPawn.TryGetComp<CompBodyAnimator>().actorsInCurrentAnimation[i].jobs.curDriver as rjw.JobDriver_Sex).ticks_remaining = def.animationTimeTicks;
}
}
}