Example #1
0
        public override void PostSplitOff(Thing piece)
        {
            base.PostSplitOff(piece);
            CompFoodPoisonable compFoodPoisonable = piece.TryGetComp <CompFoodPoisonable>();

            compFoodPoisonable.poisonPct = this.poisonPct;
        }
Example #2
0
        public override void PreAbsorbStack(Thing otherStack, int count)
        {
            base.PreAbsorbStack(otherStack, count);
            CompFoodPoisonable compFoodPoisonable = otherStack.TryGetComp <CompFoodPoisonable>();

            this.poisonPct = GenMath.WeightedAverage(this.poisonPct, (float)this.parent.stackCount, compFoodPoisonable.poisonPct, (float)count);
        }
Example #3
0
        public override void PreAbsorbStack(Thing otherStack, int count)
        {
            base.PreAbsorbStack(otherStack, count);
            CompFoodPoisonable compFoodPoisonable = otherStack.TryGetComp <CompFoodPoisonable>();

            if (this.cause == FoodPoisonCause.Unknown && compFoodPoisonable.cause != FoodPoisonCause.Unknown)
            {
                this.cause = compFoodPoisonable.cause;
            }
            else if (compFoodPoisonable.cause != FoodPoisonCause.Unknown || this.cause != FoodPoisonCause.Unknown)
            {
                float num  = this.poisonPct * (float)this.parent.stackCount;
                float num2 = compFoodPoisonable.poisonPct * (float)count;
                this.cause = ((num <= num2) ? compFoodPoisonable.cause : this.cause);
            }
            this.poisonPct = GenMath.WeightedAverage(this.poisonPct, (float)this.parent.stackCount, compFoodPoisonable.poisonPct, (float)count);
        }
Example #4
0
        public override void PreAbsorbStack(Thing otherStack, int count)
        {
            base.PreAbsorbStack(otherStack, count);
            CompFoodPoisonable compFoodPoisonable = otherStack.TryGetComp <CompFoodPoisonable>();

            if (cause == FoodPoisonCause.Unknown && compFoodPoisonable.cause != 0)
            {
                cause = compFoodPoisonable.cause;
            }
            else if (compFoodPoisonable.cause != 0 || cause != 0)
            {
                float num  = poisonPct * (float)parent.stackCount;
                float num2 = compFoodPoisonable.poisonPct * (float)count;
                cause = ((!(num > num2)) ? compFoodPoisonable.cause : cause);
            }
            poisonPct = GenMath.WeightedAverage(poisonPct, (float)parent.stackCount, compFoodPoisonable.poisonPct, (float)count);
        }