Example #1
0
        public void TransferToAnother(ISubstanceContainer otherContainer)
        {
            Debug.Log(gameObject.name + ": transfering liquids to " + otherContainer.gameObject);

            float amount = Mathf.Min(_transferAmount, _mixture.Volume);

            if (Math.Abs(amount) < 0.0001f)
            {
                Debug.Log("Nothing to transfer!");
            }
            else
            {
                Debug.Log("Amount: " + amount);
                SubstanceMixture subtractedMixture = _mixture.SubtractVolume(amount);

                otherContainer.TransferInto(subtractedMixture);

                _mixture.Concatinate(subtractedMixture);
            }
        }
Example #2
0
        public void TransferToAnother(ISubstanceContainer otherContainer)
        {
            LogManager.RuntimeLogger.Log($"{ContainingTileObject?.VisibleName} transfers substance mixture into other container. New contents: " + _mixture);

            float amount = Math.Min(_transferAmount, _mixture.Volume);

            if (Math.Abs(amount) < 0.0001f)
            {
                LogManager.RuntimeLogger.Log("Nothing to transfer!");
            }
            else
            {
                LogManager.RuntimeLogger.Log("Amount: " + amount);
                SubstanceMixture subtractedMixture = _mixture.SubtractVolume(amount);

                otherContainer.TransferInto(subtractedMixture);

                _mixture.Concatinate(subtractedMixture);
            }
        }
Example #3
0
        public override void ApplyItemServer(Item item)
        {
            ISubstanceContainer container = item as ISubstanceContainer;

            container?.TransferToAnother(this);
        }