コード例 #1
0
    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);
                }
            }
        }
    }
コード例 #2
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(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;
        }
コード例 #3
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);
    }
コード例 #4
0
    public static void BloodSplat(Vector3 worldPos, ReagentMix bloodReagents = default, BloodSplatSize splatSize = default, BloodSplatType bloodColorType = default)
    {
        EnsureInit();

        GameObject chosenTile;
        string     sizeDesc;


        if (bloodReagents.Total < SmallBleedThreshold)
        {
            chosenTile = smallBloodTile;
            sizeDesc   = "drop";
        }
        else if (bloodReagents.Total > SmallBleedThreshold && bloodReagents.Total < MedBleedThreshold)
        {
            chosenTile = mediumBloodTile;
            sizeDesc   = "splat";
        }
        else
        {
            chosenTile = largeBloodTile;
            sizeDesc   = "pool";
        }

        var bloodTileInst = Spawn.ServerPrefab(chosenTile, worldPos, MatrixManager.AtPoint(worldPos.CutToInt(), true).Objects, Quaternion.identity);

        if (bloodTileInst.Successful)
        {
            var colorDesc = TextUtils.ColorToString(bloodReagents.MixColor);
            bloodTileInst.GameObject.name = $"{colorDesc} blood {sizeDesc}";

            var bloodTileGO  = bloodTileInst.GameObject;
            var tileReagents = bloodTileGO.GetComponent <ReagentContainer>();
            if (bloodTileGO)
            {
                var decal = bloodTileGO.GetComponent <FloorDecal>();
                if (decal)
                {
                    decal.color = bloodReagents.MixColor;
                    tileReagents.Add(bloodReagents);
                }
            }
        }
    }
コード例 #5
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>");
        }