mirror of
				https://gitgud.io/lutepickle/rjw_menstruation.git
				synced 2024-08-14 22:46:52 +00:00 
			
		
		
		
	Add a function to damage pants based on fluid leakage. Not yet called by anything
This commit is contained in:
		
							parent
							
								
									60343e8b3f
								
							
						
					
					
						commit
						a917a940ee
					
				
					 1 changed files with 29 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -362,5 +362,34 @@ namespace RJW_Menstruation
 | 
			
		|||
            if (ModsConfig.BiotechActive && pawn.health.hediffSet.HasHediff(HediffDefOf.ImplantedIUD)) return true;
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static float DamagePants(this Pawn pawn, float fluidAmount)
 | 
			
		||||
        {
 | 
			
		||||
            if (pawn.apparel == null) return 0;
 | 
			
		||||
            Apparel pants = null;
 | 
			
		||||
            foreach(Apparel apparel in pawn.apparel.WornApparel.Where(app => app.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Legs)))
 | 
			
		||||
            {
 | 
			
		||||
                if (apparel.def.apparel.LastLayer == ApparelLayerDefOf.OnSkin)
 | 
			
		||||
                {
 | 
			
		||||
                    pants = apparel;
 | 
			
		||||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
                else if (pants == null || apparel.def.apparel.LastLayer == ApparelLayerDefOf.Middle)
 | 
			
		||||
                    // Either grab whatever's available or reassign the pants from shell to a middle
 | 
			
		||||
                    pants = apparel;
 | 
			
		||||
                // Pants are middle and this is a shell
 | 
			
		||||
                else continue;
 | 
			
		||||
            }
 | 
			
		||||
            if (pants == null) return 0;
 | 
			
		||||
 | 
			
		||||
            const float HPPerMl = 0.5f;
 | 
			
		||||
 | 
			
		||||
            DamageWorker.DamageResult damage = pants.TakeDamage(new DamageInfo(DamageDefOf.Deterioration, fluidAmount * HPPerMl, spawnFilth: false));
 | 
			
		||||
 | 
			
		||||
            if (pants.Destroyed && PawnUtility.ShouldSendNotificationAbout(pawn) && !pawn.Dead)
 | 
			
		||||
                Messages.Message("MessageWornApparelDeterioratedAway".Translate(GenLabel.ThingLabel(pants.def, pants.Stuff), pawn).CapitalizeFirst(), pawn, MessageTypeDefOf.NegativeEvent);
 | 
			
		||||
 | 
			
		||||
            return damage.totalDamageDealt;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue