Advertisement
Guest User

Untitled

a guest
Jan 8th, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.75 KB | None | 0 0
  1. //GenRecipe.cs
  2. this.foodPoisonable = this.product.TryGetComp<CompFoodPoisonable>();
  3. if (this.foodPoisonable != null)
  4. {
  5.     this.poisonChance = this.worker.GetStatValue(StatDefOf.FoodPoisonChance, true);
  6.     this.room = this.worker.GetRoom();
  7.    
  8.     if (this.room != null)
  9.         this.poisonChance = this.poisonChance * this.room.GetStat(RoomStatDefOf.FoodPoisonChanceFactor);
  10.        
  11.     if ((double) Rand.Value < (double) this.poisonChance)
  12.         this.foodPoisonable.PoisonPercent = 1f;
  13. }
  14.  
  15. // RoomStatWorker_FoodPoisonChanceFactor.cs
  16. public class RoomStatWorker_FoodPoisonChanceFactor : RoomStatWorker
  17. {
  18.     public override float GetScore(Room room)
  19.     {
  20.       return Mathf.Clamp(1f / GenMath.UnboundedValueToFactor(room.GetStat(RoomStatDefOf.Cleanliness) * 0.21f), 0.7f, 1.6f);
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement