Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //GenRecipe.cs
- this.foodPoisonable = this.product.TryGetComp<CompFoodPoisonable>();
- if (this.foodPoisonable != null)
- {
- this.poisonChance = this.worker.GetStatValue(StatDefOf.FoodPoisonChance, true);
- this.room = this.worker.GetRoom();
- if (this.room != null)
- this.poisonChance = this.poisonChance * this.room.GetStat(RoomStatDefOf.FoodPoisonChanceFactor);
- if ((double) Rand.Value < (double) this.poisonChance)
- this.foodPoisonable.PoisonPercent = 1f;
- }
- // RoomStatWorker_FoodPoisonChanceFactor.cs
- public class RoomStatWorker_FoodPoisonChanceFactor : RoomStatWorker
- {
- public override float GetScore(Room room)
- {
- return Mathf.Clamp(1f / GenMath.UnboundedValueToFactor(room.GetStat(RoomStatDefOf.Cleanliness) * 0.21f), 0.7f, 1.6f);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement