mirror of
				https://gitgud.io/c0ffeeeeeeee/rimworld-animations.git
				synced 2024-08-15 00:43:45 +00:00 
			
		
		
		
	better location finding + mirroring
This commit is contained in:
		
							parent
							
								
									015a64928a
								
							
						
					
					
						commit
						ac5d37bdaf
					
				
					 4 changed files with 78 additions and 14 deletions
				
			
		
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -20,33 +20,42 @@ namespace Patch_SexToysMasturbation
 | 
			
		|||
 | 
			
		||||
            if(__instance is JobDriver_MasturbateWithToy masturbateJobDriver)
 | 
			
		||||
            {
 | 
			
		||||
 | 
			
		||||
                Log.Message("Rerolling animations...");
 | 
			
		||||
                Pawn pawn = masturbateJobDriver.pawn;
 | 
			
		||||
                Thing sexToy = masturbateJobDriver.dildo;
 | 
			
		||||
 | 
			
		||||
                RerollAnimationsForSexToy(pawn, sexToy);
 | 
			
		||||
                RerollAnimationsForSexToy(pawn, sexToy, masturbateJobDriver.Bed);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static void RerollAnimationsForSexToy(Pawn pawn, Thing thing)
 | 
			
		||||
        public static void RerollAnimationsForSexToy(Pawn pawn, Thing thing, Thing bed)
 | 
			
		||||
        {
 | 
			
		||||
            CompSexToy sextoy = thing.TryGetComp<CompSexToy>();
 | 
			
		||||
 | 
			
		||||
            SexToyAnimationDef anim = AnimSexToyUtility.tryFindAnimation(sextoy, pawn);
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            if (anim != null)
 | 
			
		||||
            {
 | 
			
		||||
                Log.Message("Playing anim " + anim.defName);
 | 
			
		||||
 | 
			
		||||
                pawn.TryGetComp<CompBodyAnimator>().setAnchor(pawn.Position);
 | 
			
		||||
                thing.TryGetComp<CompThingAnimator>().setAnchor(pawn.Position);
 | 
			
		||||
                if(bed != null)
 | 
			
		||||
                {
 | 
			
		||||
                    pawn.TryGetComp<CompBodyAnimator>().setAnchor(bed);
 | 
			
		||||
                    thing.TryGetComp<CompThingAnimator>().setAnchor(bed);
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    pawn.TryGetComp<CompBodyAnimator>().setAnchor(pawn.Position);
 | 
			
		||||
                    thing.TryGetComp<CompThingAnimator>().setAnchor(pawn.Position);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                pawn.TryGetComp<CompBodyAnimator>().StartAnimation(anim, new List<Pawn> { pawn }, 0);
 | 
			
		||||
                thing.TryGetComp<CompThingAnimator>().StartAnimation(anim, pawn);
 | 
			
		||||
                bool mirror = GenTicks.TicksGame % 2 == 0;
 | 
			
		||||
 | 
			
		||||
                pawn.TryGetComp<CompBodyAnimator>().StartAnimation(anim, new List<Pawn> { pawn }, 0, mirror);
 | 
			
		||||
                thing.TryGetComp<CompThingAnimator>().StartAnimation(anim, pawn, mirror);
 | 
			
		||||
 | 
			
		||||
                (pawn.jobs.curDriver as JobDriver_Sex).ticks_left = anim.animationTimeTicks;
 | 
			
		||||
                (pawn.jobs.curDriver as JobDriver_Sex).sex_ticks = anim.animationTimeTicks;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue