public static void PowderSplat(Vector3Int worldPos, Color color, ReagentMix reagents)
    {
        EnsureInit();
        var powderTileInst = Spawn.ServerPrefab(powderTile, worldPos, MatrixManager.AtPoint(worldPos, true).Objects, Quaternion.identity);

        if (powderTileInst.Successful)
        {
            var powderTileGO = powderTileInst.GameObject;
            var tileReagents = powderTileGO.GetComponent <ReagentContainer>();

            var colorDesc = TextUtils.ColorToString(reagents.MixColor);
            var stateDesc = ChemistryUtils.GetMixStateDescription(reagents);
            powderTileInst.GameObject.name = $"{colorDesc} {stateDesc}";

            if (powderTileGO)
            {
                var decal = powderTileGO.GetComponent <FloorDecal>();
                if (decal)
                {
                    decal.color = color;
                }
                if (reagents != null)
                {
                    tileReagents.Add(reagents);
                }
            }
        }
    }
    public void Paintsplat(Vector3Int worldPosInt, Vector3Int localPosInt, ReagentMix reagents)
    {
        switch (ChemistryUtils.GetMixStateDescription(reagents))
        {
        case "powder":
        {
            EffectsFactory.PowderSplat(worldPosInt, reagents.MixColor, reagents);
            break;
        }

        case "liquid":
        {
            //TODO: Work out if reagent is "slippery" according to its viscocity (not modeled yet)
            EffectsFactory.ChemSplat(worldPosInt, reagents.MixColor, reagents);
            break;
        }

        case "gas":
            //TODO: Make gas reagents release into the atmos.
            break;

        default:
        {
            EffectsFactory.ChemSplat(worldPosInt, reagents.MixColor, reagents);
            break;
        }
        }
    }
        public string Examine(Vector3 worldPos = default)
        {
            if (!UseStandardExamine)
                return null;

            var fillPercent = GetFillPercent();
            if (fillPercent <= 0f)
                return "It's empty.";

            var fillDesc = ChemistryUtils.GetFillDescription(fillPercent);
            var stateDesc = ChemistryUtils.GetMixStateDescription(CurrentReagentMix);

            var color = CurrentReagentMix.MixColor;
            var colorDesc = TextUtils.ColorToString(color);
            var units = Mathf.RoundToInt(ReagentMixTotal);
            var name = CurrentReagentMix.MixName;

            if (ExamineAmount == ExamineAmountMode.APROXIMATE_AMOUNT)
            {
                if (ExamineContent == ExamineContentMode.NONE)
                {
                    return $"It's {fillDesc}";
                }
                else if (ExamineContent == ExamineContentMode.COLOR_AND_STUCTURE)
                {
                    return $"It's {fillDesc}. There is {colorDesc} {stateDesc} inside";
                }
                else if (ExamineContent == ExamineContentMode.ACTUAL_CONTENTS)
                {
                    return $"It's {fillDesc}. It seems to mostly contain {name}.";
                }
            }
            else if (ExamineAmount == ExamineAmountMode.EXACT_AMOUNT)
            {
                if (ExamineContent == ExamineContentMode.NONE)
                {
                    return $"It's {fillDesc}. There are {units} units of something inside";
                }
                else if (ExamineContent == ExamineContentMode.COLOR_AND_STUCTURE)
                {
                    return $"It's {fillDesc}. There are {units} units of {colorDesc} {stateDesc} inside";
                }
                else if (ExamineContent == ExamineContentMode.ACTUAL_CONTENTS)
                {
                    return $"It's {fillDesc}. It contains {units} units, mostly of {name}.";
                }
            }
            else if (ExamineAmount == ExamineAmountMode.UNKNOWN_AMOUNT)
            {
                var output = $"It's a pool of {colorDesc} {stateDesc}";

                if (stateDesc == "powder")
                {
                    output = $"It's a pile of {colorDesc} {stateDesc}";
                }
                return output;
            }
            return null;
        }
Esempio n. 4
0
    public string Examine(Vector3 worldPos = default)
    {
        if (!UseStandardExamine)
        {
            return(null);
        }

        var fillPercent = GetFillPercent();

        if (fillPercent <= 0f)
        {
            return("It's empty.");
        }

        var fillDesc  = ChemistryUtils.GetFillDescription(fillPercent);
        var stateDesc = ChemistryUtils.GetMixStateDescription(ReagentMix);

        var color     = ReagentMix.MixColor;
        var colorDesc = TextUtils.ColorToString(color);
        var units     = Mathf.RoundToInt(maxCapacity * fillPercent);

        if (ExamineAmount == ExamineAmountMode.APROXIMATE_AMOUNT)
        {
            if (ExamineContent == ExamineContentMode.NONE)
            {
                return($"It's {fillDesc}");
            }
            else if (ExamineContent == ExamineContentMode.COLOR_AND_STUCTURE)
            {
                return($"It's {fillDesc}. There is {colorDesc} {stateDesc} inside");
            }
        }
        else if (ExamineAmount == ExamineAmountMode.EXACT_AMOUNT)
        {
            if (ExamineContent == ExamineContentMode.NONE)
            {
                return($"It's {fillDesc}. There are {units} units of something inside");
            }
            else if (ExamineContent == ExamineContentMode.COLOR_AND_STUCTURE)
            {
                return($"It's {fillDesc}. There are {units} units of {colorDesc} {stateDesc} inside");
            }
        }

        return(null);
    }
Esempio n. 5
0
        /// <summary>
        /// Initializes an instance of the <see cref="ShellConfiguration"/> class.
        /// </summary>
        /// <param name="element">The parent element.</param>
        /// <param name="values">An ordered collection of shells.</param>
        public ShellConfiguration(Element element, int[] values)
        {
            Shells  = new Collection <Shell>();
            Element = element;

            for (var i = 0; i < values.Length; i++)
            {
                int value = values[i];

                if (value > ChemistryUtils.GetShellCapacity(i) || value < 0)
                {
                    throw new IndexOutOfRangeException(nameof(value));
                }

                Shells.Add(new Shell(ChemistryUtils.ShellLabels[i], value));
            }

            Populate();
        }
Esempio n. 6
0
        /// <summary>
        /// Initializes an instance of the <see cref="ShellConfiguration"/> class.
        /// </summary>
        /// <param name="element">The parent element.</param>
        /// <param name="values">An ordered dictionary of shells.</param>
        public ShellConfiguration(Element element, Dictionary <char, int> values)
        {
            Shells  = new Collection <Shell>();
            Element = element;

            for (var i = 0; i < values.Count; i++)
            {
                int capacity = ChemistryUtils.GetShellCapacity(i);
                KeyValuePair <char, int> current = values.ToList()[i];

                if (current.Value > capacity || current.Value < 0)
                {
                    throw new IndexOutOfRangeException(nameof(current.Value));
                }

                Shells.Add(new Shell(current.Key, current.Value));
            }

            Populate();
        }
Esempio n. 7
0
 /// <summary>Returns a string that represents the current object.</summary>
 /// <returns>A string that represents the current object.</returns>
 public override string ToString()
 {
     return($"{ChemistryUtils.GetShellIndex(Parent) + 1}{Label}");
 }
Esempio n. 8
0
        public void DoScan(GameObject Performer, GameObject TargetObject)
        {
            var performerName = Performer.ExpensiveName();
            var targetName    = TargetObject.ExpensiveName();

            Chat.AddActionMsgToChat(Performer,
                                    $"You scan the {targetName}.",
                                    $"{performerName} scans the {targetName}.");

            var           reagents = TargetObject.GetComponent <ReagentContainer>().CurrentReagentMix;
            StringBuilder scanMessage;

            if (reagents.Total > 0f)
            {
                scanMessage = new StringBuilder(
                    "----------------------------------------\n" +
                    $"{targetName} contains {reagents.Total} units of {TextUtils.ColorToString(reagents.MixColor)} {ChemistryUtils.GetMixStateDescription(reagents)}\n" +
                    $"<b>Its Chemical make up is: \n");

                foreach (var reagent in reagents.reagents)
                {
                    scanMessage.Append("<mspace=0.6em>");
                    scanMessage.AppendLine(
                        $"<color=#{ColorUtility.ToHtmlStringRGB(reagent.Key.color)}><b>{reagent.Key}</b> - {reagent.Value.ToString("F3")}u</color>"
                        );
                    scanMessage.Append("</mspace>");
                }
                scanMessage.Append("----------------------------------------");
            }
            else
            {
                scanMessage = new StringBuilder("No reagents found");
            }


            Chat.AddExamineMsgFromServer(Performer, $"</i>{scanMessage}<i>");
        }