diff --git a/Content.Server/Chemistry/EntitySystems/SolutionContainerSystem.cs b/Content.Server/Chemistry/EntitySystems/SolutionContainerSystem.cs index d0641a611a..bd6ea0d1ac 100644 --- a/Content.Server/Chemistry/EntitySystems/SolutionContainerSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/SolutionContainerSystem.cs @@ -1,5 +1,6 @@ using System.Diagnostics.CodeAnalysis; using System.Linq; +using System.Text; using Content.Server.Chemistry.Components.SolutionManager; using Content.Shared.Chemistry; using Content.Shared.Chemistry.Components; @@ -65,7 +66,9 @@ public sealed partial class SolutionContainerSystem : EntitySystem SolutionContainerManagerComponent? solutionsManager = null; if (!Resolve(args.Examined, ref solutionsManager) || !solutionsManager.Solutions.TryGetValue(examinableComponent.Solution, out var solutionHolder)) + { return; + } var primaryReagent = solutionHolder.GetPrimaryReagentId(); @@ -75,7 +78,7 @@ public sealed partial class SolutionContainerSystem : EntitySystem return; } - if (!_prototypeManager.TryIndex(primaryReagent, out ReagentPrototype? proto)) + if (!_prototypeManager.TryIndex(primaryReagent, out ReagentPrototype? primary)) { Logger.Error( $"{nameof(Solution)} could not find the prototype associated with {primaryReagent}."); @@ -91,7 +94,53 @@ public sealed partial class SolutionContainerSystem : EntitySystem ("wordedAmount", Loc.GetString(solutionHolder.Contents.Count == 1 ? "shared-solution-container-component-on-examine-worded-amount-one-reagent" : "shared-solution-container-component-on-examine-worded-amount-multiple-reagents")), - ("desc", proto.LocalizedPhysicalDescription))); + ("desc", primary.LocalizedPhysicalDescription))); + + // Add descriptions of immediately recognizable reagents, like water or beer + var recognized = new List(); + foreach (var (id, _) in solutionHolder) + { + if (!_prototypeManager.TryIndex(id, out var proto)) + { + continue; + } + + if (!proto.Recognizable) + { + continue; + } + + recognized.Add(proto); + } + + // Skip if there's nothing recognizable + if (recognized.Count == 0) + return; + + var msg = new StringBuilder(); + foreach (var reagent in recognized) + { + string part; + if (reagent == recognized[0]) + { + part = "examinable-solution-recognized-first"; + } + else if (reagent == recognized[^1]) + { + // this loc specifically requires space to be appended, fluent doesnt support whitespace + msg.Append(' '); + part = "examinable-solution-recognized-last"; + } + else + { + part = "examinable-solution-recognized-next"; + } + + msg.Append(Loc.GetString(part, ("color", reagent.SubstanceColor.ToHexNoAlpha()), + ("chemical", reagent.LocalizedName))); + } + + args.PushMarkup(Loc.GetString("examinable-solution-has-recognizable-chemicals", ("recognizedString", msg.ToString()))); } public void UpdateAppearance(EntityUid uid, Solution solution, diff --git a/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs b/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs index 25e56608c2..001bfd6e00 100644 --- a/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs +++ b/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs @@ -52,6 +52,12 @@ namespace Content.Shared.Chemistry.Reagent [ViewVariables(VVAccess.ReadOnly)] public string LocalizedPhysicalDescription => Loc.GetString(PhysicalDescription); + /// + /// Is this reagent recognizable to the average spaceman (water, welding fuel, ketchup, etc)? + /// + [DataField("recognizable")] + public bool Recognizable = false; + [DataField("flavor")] public string Flavor { get; } = default!; @@ -81,7 +87,7 @@ namespace Content.Shared.Chemistry.Reagent public bool Slippery = false; /// - /// How much reagent slows entities down if it's part of a puddle. + /// How much reagent slows entities down if it's part of a puddle. /// 0 - no slowdown; 1 - can't move. /// [DataField("viscosity")] diff --git a/Resources/Locale/en-US/chemistry/solution/components/shared-solution-container-component.ftl b/Resources/Locale/en-US/chemistry/solution/components/shared-solution-container-component.ftl index 4581dcc762..6f1ba911f7 100644 --- a/Resources/Locale/en-US/chemistry/solution/components/shared-solution-container-component.ftl +++ b/Resources/Locale/en-US/chemistry/solution/components/shared-solution-container-component.ftl @@ -1,4 +1,9 @@ shared-solution-container-component-on-examine-empty-container = Contains no chemicals. -shared-solution-container-component-on-examine-main-text = It contains a [color={$color}]{$desc}[/color] {$wordedAmount} +shared-solution-container-component-on-examine-main-text = It contains {INDEFINITE($desc)} [color={$color}]{$desc}[/color] {$wordedAmount} shared-solution-container-component-on-examine-worded-amount-one-reagent = chemical. shared-solution-container-component-on-examine-worded-amount-multiple-reagents = mixture of chemicals. + +examinable-solution-has-recognizable-chemicals = You can recognize {$recognizedString} in the solution. +examinable-solution-recognized-first = [color={$color}]{$chemical}[/color] +examinable-solution-recognized-next = , [color={$color}]{$chemical}[/color] +examinable-solution-recognized-last = and [color={$color}]{$chemical}[/color] diff --git a/Resources/Prototypes/Entities/Effects/puddle.yml b/Resources/Prototypes/Entities/Effects/puddle.yml index fa8c52162f..611a482299 100644 --- a/Resources/Prototypes/Entities/Effects/puddle.yml +++ b/Resources/Prototypes/Entities/Effects/puddle.yml @@ -158,3 +158,5 @@ transferAmount: 1 solution: puddle examinable: false + - type: ExaminableSolution + solution: puddle diff --git a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks.yml b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks.yml index acc00844a6..a3e0892796 100644 --- a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks.yml +++ b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks.yml @@ -75,6 +75,8 @@ - type: PhysicalComposition materialComposition: Glass: 25 + - type: ExaminableSolution + solution: drink # Transformable container - normal glass - type: entity diff --git a/Resources/Prototypes/Reagents/Consumable/Drink/alcohol.yml b/Resources/Prototypes/Reagents/Consumable/Drink/alcohol.yml index 29ed87460c..0ab8db6d36 100644 --- a/Resources/Prototypes/Reagents/Consumable/Drink/alcohol.yml +++ b/Resources/Prototypes/Reagents/Consumable/Drink/alcohol.yml @@ -29,6 +29,7 @@ physicalDesc: reagent-physical-desc-bubbly flavor: ale color: "#663100" + recognizable: true metamorphicSprite: sprite: Objects/Consumable/Drinks/aleglass.rsi state: icon @@ -41,6 +42,7 @@ physicalDesc: reagent-physical-desc-bubbly flavor: beer color: "#cfa85f" + recognizable: true metamorphicSprite: sprite: Objects/Consumable/Drinks/beerglass.rsi state: icon @@ -73,6 +75,7 @@ physicalDesc: reagent-physical-desc-strong-smelling flavor: alcohol color: "#AB3C05" + recognizable: true metamorphicSprite: sprite: Objects/Consumable/Drinks/cognacglass.rsi state: icon @@ -171,6 +174,7 @@ physicalDesc: reagent-physical-desc-strong-smelling flavor: alcohol color: "#664300" + recognizable: true metamorphicSprite: sprite: Objects/Consumable/Drinks/ginvodkaglass.rsi state: icon @@ -253,6 +257,7 @@ physicalDesc: reagent-physical-desc-strong-smelling flavor: rum color: "#664300" + recognizable: true metamorphicSprite: sprite: Objects/Consumable/Drinks/rumglass.rsi state: icon @@ -311,6 +316,7 @@ physicalDesc: reagent-physical-desc-strong-smelling flavor: vodka color: "#d1d1d155" + recognizable: true metamorphicSprite: sprite: Objects/Consumable/Drinks/ginvodkaglass.rsi state: icon @@ -331,6 +337,7 @@ physicalDesc: reagent-physical-desc-strong-smelling flavor: whiskey color: "#664300" + recognizable: true metamorphicSprite: sprite: Objects/Consumable/Drinks/whiskeyglass.rsi state: icon @@ -351,6 +358,7 @@ physicalDesc: reagent-physical-desc-translucent flavor: shittywine color: "#7E4043" + recognizable: true metamorphicSprite: sprite: Objects/Consumable/Drinks/wineglass.rsi state: icon diff --git a/Resources/Prototypes/Reagents/Consumable/Drink/drinks.yml b/Resources/Prototypes/Reagents/Consumable/Drink/drinks.yml index f54099e019..924a80c73c 100644 --- a/Resources/Prototypes/Reagents/Consumable/Drink/drinks.yml +++ b/Resources/Prototypes/Reagents/Consumable/Drink/drinks.yml @@ -6,6 +6,7 @@ physicalDesc: reagent-physical-desc-aromatic flavor: coffee color: "#664300" + recognizable: true metabolisms: Drink: effects: @@ -134,6 +135,7 @@ physicalDesc: reagent-physical-desc-opaque flavor: milk color: "#DFDFDF" + recognizable: true plantMetabolism: - !type:PlantAdjustNutrition amount: 0.1 @@ -159,6 +161,7 @@ physicalDesc: reagent-physical-desc-refreshing flavor: oats color: "#DEDACD" + recognizable: true metabolisms: Drink: effects: @@ -256,6 +259,7 @@ physicalDesc: reagent-physical-desc-aromatic flavor: tea color: "#8a5a3a" + recognizable: true metabolisms: Drink: effects: @@ -283,6 +287,7 @@ physicalDesc: reagent-physical-desc-translucent flavor: water color: "#75b1f0" + recognizable: true boilingPoint: 100.0 meltingPoint: 0.0 metabolisms: @@ -298,6 +303,7 @@ physicalDesc: reagent-physical-desc-frosty flavor: cold color: "#bed8e6" + recognizable: true meltingPoint: 0.0 boilingPoint: 100.0 plantMetabolism: diff --git a/Resources/Prototypes/Reagents/Consumable/Drink/juice.yml b/Resources/Prototypes/Reagents/Consumable/Drink/juice.yml index 6758927ad5..b9d8463b7f 100644 --- a/Resources/Prototypes/Reagents/Consumable/Drink/juice.yml +++ b/Resources/Prototypes/Reagents/Consumable/Drink/juice.yml @@ -6,6 +6,7 @@ physicalDesc: reagent-physical-desc-crisp flavor: apple color: "#FDAD01" + recognizable: true - type: reagent id: JuiceBanana @@ -43,17 +44,6 @@ types: Poison: 1 -#TODO: restore eyesight -#if(..()) -#return 1 -# M.eye_blurry = max(M.eye_blurry - 1 , 0) -# M.eye_blind = max(M.eye_blind - 1 , 0) -# switch(data) -# if(21 to INFINITY) -# if(prob(data - 10)) -# M.disabilities &= ~NEARSIGHTED -# data++ - - type: reagent id: JuiceCarrot name: reagent-name-juice-carrot diff --git a/Resources/Prototypes/Reagents/Consumable/Drink/soda.yml b/Resources/Prototypes/Reagents/Consumable/Drink/soda.yml index 0e1c701360..27fe44e578 100644 --- a/Resources/Prototypes/Reagents/Consumable/Drink/soda.yml +++ b/Resources/Prototypes/Reagents/Consumable/Drink/soda.yml @@ -6,6 +6,7 @@ physicalDesc: reagent-physical-desc-fizzy flavor: soda color: "#422912" + recognizable: true - type: reagent id: ChangelingSting @@ -59,6 +60,7 @@ physicalDesc: reagent-physical-desc-creamy flavor: icecream color: "#fffbd6" + recognizable: true metamorphicSprite: sprite: Objects/Consumable/Drinks/icecreamglass.rsi state: icon @@ -101,7 +103,7 @@ name: reagent-name-root-beer-float parent: BaseSoda desc: reagent-desc-root-beer-float - physicalDesc: reagent-physical-desc-fizzy and creamy + physicalDesc: reagent-physical-desc-fizzy-and-creamy flavor: soda color: "#4f361f" metamorphicSprite: diff --git a/Resources/Prototypes/Reagents/Consumable/Food/condiments.yml b/Resources/Prototypes/Reagents/Consumable/Food/condiments.yml index ac349c9d05..4373dcf78c 100644 --- a/Resources/Prototypes/Reagents/Consumable/Food/condiments.yml +++ b/Resources/Prototypes/Reagents/Consumable/Food/condiments.yml @@ -6,6 +6,7 @@ physicalDesc: reagent-physical-desc-sugary flavor: sweet color: aquamarine + recognizable: true - type: reagent id: BbqSauce @@ -15,6 +16,7 @@ physicalDesc: reagent-physical-desc-gloopy flavor: sweet color: darkred + recognizable: true - type: reagent id: Cornoil @@ -24,6 +26,7 @@ physicalDesc: reagent-physical-desc-oily flavor: oily color: yellow + recognizable: true - type: reagent id: Frostoil @@ -42,6 +45,7 @@ physicalDesc: reagent-physical-desc-overpowering flavor: spicy color: gray + recognizable: true - type: reagent id: Hotsauce @@ -51,6 +55,7 @@ physicalDesc: reagent-physical-desc-spicy flavor: spicy color: red + recognizable: true - type: reagent id: Ketchup @@ -60,6 +65,7 @@ physicalDesc: reagent-physical-desc-tangy flavor: tomato color: red + recognizable: true - type: reagent id: Ketchunaise @@ -69,6 +75,7 @@ physicalDesc: reagent-physical-desc-saucey flavor: piquant color: "#fba399" + recognizable: true - type: reagent id: Mayo @@ -78,6 +85,7 @@ physicalDesc: reagent-physical-desc-thick flavor: sour color: "#f9f5e5" + recognizable: true - type: reagent id: Vinaigrette @@ -87,6 +95,7 @@ physicalDesc: reagent-physical-desc-sour flavor: sour color: "#efdaae" + recognizable: true - type: reagent id: Soysauce @@ -96,6 +105,7 @@ physicalDesc: reagent-physical-desc-salty flavor: salty color: saddlebrown + recognizable: true metabolisms: Food: effects: @@ -112,6 +122,7 @@ physicalDesc: reagent-physical-desc-grainy flavor: salty color: "#a1000b" + recognizable: true boilingPoint: 1465.0 meltingPoint: 800.7 plantMetabolism: diff --git a/Resources/Prototypes/Reagents/Consumable/Food/ingredients.yml b/Resources/Prototypes/Reagents/Consumable/Food/ingredients.yml index b525a3b248..2e42a5258c 100644 --- a/Resources/Prototypes/Reagents/Consumable/Food/ingredients.yml +++ b/Resources/Prototypes/Reagents/Consumable/Food/ingredients.yml @@ -6,6 +6,7 @@ physicalDesc: reagent-physical-desc-powdery flavor: chalky color: white + recognizable: true metabolisms: Food: effects: @@ -70,6 +71,7 @@ physicalDesc: reagent-physical-desc-mucus-like flavor: egg color: white + recognizable: true metabolisms: Food: effects: @@ -85,6 +87,7 @@ physicalDesc: reagent-physical-desc-grainy flavor: peppery color: black + recognizable: true - type: reagent id: Vinegar @@ -94,6 +97,7 @@ physicalDesc: reagent-physical-desc-sour flavor: bitter color: tan + recognizable: true metabolisms: Food: effects: @@ -117,6 +121,7 @@ physicalDesc: reagent-physical-desc-chewy flavor: rice color: white + recognizable: true metabolisms: Food: effects: @@ -135,6 +140,7 @@ physicalDesc: reagent-physical-desc-oily flavor: oily color: olive + recognizable: true metabolisms: Food: effects: @@ -149,6 +155,7 @@ desc: reagent-desc-oil physicalDesc: reagent-physical-desc-oily flavor: oily + recognizable: true color: "#b67823" boilingPoint: 300.0 meltingPoint: -16.0 @@ -162,6 +169,7 @@ physicalDesc: reagent-physical-desc-oily flavor: spicy color: "#FF0000" + recognizable: true meltingPoint: 146 boilingPoint: 410 # Really high boiling point compared to its melting metabolisms: diff --git a/Resources/Prototypes/Reagents/biological.yml b/Resources/Prototypes/Reagents/biological.yml index d3e07d887b..501c67ca54 100644 --- a/Resources/Prototypes/Reagents/biological.yml +++ b/Resources/Prototypes/Reagents/biological.yml @@ -5,6 +5,7 @@ desc: reagent-desc-blood flavor: metallic color: "#800000" + recognizable: true physicalDesc: reagent-physical-desc-ferrous slippery: false metabolisms: @@ -24,6 +25,7 @@ desc: reagent-desc-slime flavor: slimy color: "#2cf274" + recognizable: true physicalDesc: reagent-physical-desc-viscous slippery: false viscosity: 0.25 @@ -43,6 +45,7 @@ desc: reagent-desc-spider-blood flavor: metallic color: "#162581" + recognizable: true physicalDesc: reagent-physical-desc-ferrous slippery: false metabolisms: @@ -63,6 +66,7 @@ physicalDesc: reagent-physical-desc-roaring flavor: metallic color: "#f4692e" + recognizable: true metabolisms: Drink: effects: diff --git a/Resources/Prototypes/Reagents/cleaning.yml b/Resources/Prototypes/Reagents/cleaning.yml index 19e1346da3..3d94aaa5a4 100644 --- a/Resources/Prototypes/Reagents/cleaning.yml +++ b/Resources/Prototypes/Reagents/cleaning.yml @@ -27,6 +27,7 @@ physicalDesc: reagent-physical-desc-lemony-fresh flavor: bitter color: "#c8ff69" + recognizable: true boilingPoint: 147.0 # Made this up, loosely based on bleach meltingPoint: -11.0 tileReactions: @@ -41,6 +42,7 @@ physicalDesc: reagent-physical-desc-shiny flavor: funny color: "#77b58e" + recognizable: true boilingPoint: 290.0 # Glycerin meltingPoint: 18.2 tileReactions: diff --git a/Resources/Prototypes/Reagents/gases.yml b/Resources/Prototypes/Reagents/gases.yml index 5603e7b3b9..c8f4711852 100644 --- a/Resources/Prototypes/Reagents/gases.yml +++ b/Resources/Prototypes/Reagents/gases.yml @@ -43,6 +43,7 @@ physicalDesc: reagent-physical-desc-gaseous flavor: bitter color: "#7e009e" + recognizable: true boilingPoint: -127.3 # Random values picked between the actual values for CO2 and O2 meltingPoint: -186.4 tileReactions: diff --git a/Resources/Prototypes/Reagents/pyrotechnic.yml b/Resources/Prototypes/Reagents/pyrotechnic.yml index bc77f44837..475a85bda4 100644 --- a/Resources/Prototypes/Reagents/pyrotechnic.yml +++ b/Resources/Prototypes/Reagents/pyrotechnic.yml @@ -145,6 +145,7 @@ slippery: true flavor: bitter color: "#a76b1c" + recognizable: true boilingPoint: -84.7 # Acetylene. Close enough. meltingPoint: -80.7 tileReactions: diff --git a/Resources/Prototypes/Reagents/toxins.yml b/Resources/Prototypes/Reagents/toxins.yml index c42e0d4167..43bb275c09 100644 --- a/Resources/Prototypes/Reagents/toxins.yml +++ b/Resources/Prototypes/Reagents/toxins.yml @@ -84,6 +84,7 @@ desc: reagent-desc-mold flavor: bitter color: "#8a9a5b" + recognizable: true physicalDesc: reagent-physical-desc-fuzzy metabolisms: Poison: @@ -180,6 +181,7 @@ physicalDesc: reagent-physical-desc-oily flavor: acidic color: "#BF8C00" + recognizable: true boilingPoint: 337.0 meltingPoint: 10.31 plantMetabolism: