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; }
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); }
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>"); }