コード例 #1
0
            protected override void OnTick()
            {
                --Acidity;

                if (!Invalidate())
                {
                    Stop();

                    if (ConsumedBy != null)
                    {
                        _ToothAches.Remove(ConsumedBy);
                    }

                    return;
                }

                if (Acidity == 60)
                {
                    ConsumedBy.SendLocalizedMessage(1077393); // The extreme pain in your teeth subsides.
                    return;
                }

                if (Acidity <= 60)
                {
                    return;
                }

                /*
                 * ARRGH! My tooth hurts sooo much!
                 * You just can't find a good Britannian dentist these days...
                 * My teeth!
                 * MAKE IT STOP!
                 * AAAH! It feels like someone kicked me in the teeth!
                 */
                ConsumedBy.Say(1077388 + Utility.Random(5));

                if (Utility.RandomBool() && ConsumedBy.Body.IsHuman && !ConsumedBy.Mounted)
                {
                    ConsumedBy.Animate(32, 5, 1, true, false, 0);
                }
            }
コード例 #2
0
        public IBuildComponent Split(BuildComponentFactory factory, int quantity)
        {
            if (quantity >= Quantity)
            {
                throw new ArgumentException(string.Format("Value exceeds component quantity of {0}.", Quantity), nameof(quantity));
            }
            if (ProducedBy != null)
            {
                throw new InvalidOperationException("Component is already produced by a build step.");
            }

            Quantity -= quantity;

            var component = Clone(factory);

            component.Quantity = quantity;

            if (ConsumedBy != null)
            {
                ConsumedBy.AddInput(component);
            }

            return(component);
        }