diff --git a/Content.Server/Atmos/Rotting/RottingSystem.cs b/Content.Server/Atmos/Rotting/RottingSystem.cs index db0815f3a6..246758532a 100644 --- a/Content.Server/Atmos/Rotting/RottingSystem.cs +++ b/Content.Server/Atmos/Rotting/RottingSystem.cs @@ -32,6 +32,7 @@ public sealed class RottingSystem : EntitySystem SubscribeLocalEvent(OnPerishableMapInit); SubscribeLocalEvent(OnPerishableUnpaused); SubscribeLocalEvent(OnMobStateChanged); + SubscribeLocalEvent(OnPerishableExamined); SubscribeLocalEvent(OnRottingUnpaused); SubscribeLocalEvent(OnShutdown); @@ -122,6 +123,31 @@ public sealed class RottingSystem : EntitySystem tileMix?.AdjustMoles(Gas.Ammonia, molsToDump); } + private void OnPerishableExamined(Entity perishable, ref ExaminedEvent args) + { + int maxStages = 3; + int stage = PerishStage(perishable, maxStages); + if (stage < 1 || stage > maxStages) + { + // We dont push an examined string if it hasen't started "perishing" or it's already rotting + return; + } + + var description = "perishable-" + stage; + args.PushMarkup(Loc.GetString(description)); + } + + /// + /// Return an integer from 0 to maxStage representing how close to rotting an entity is. Used to + /// generate examine messages for items that are starting to rot. + /// + public int PerishStage(Entity perishable, int maxStages) + { + if (perishable.Comp.RotAfter.TotalSeconds == 0 || perishable.Comp.RotAccumulator.TotalSeconds == 0) + return 0; + return (int)(1 + maxStages * perishable.Comp.RotAccumulator.TotalSeconds / perishable.Comp.RotAfter.TotalSeconds); + } + private void OnExamined(EntityUid uid, RottingComponent component, ExaminedEvent args) { var stage = RotStage(uid, component); diff --git a/Resources/Locale/en-US/disease/miasma.ftl b/Resources/Locale/en-US/disease/miasma.ftl index cc0c4117e5..06c96bc73d 100644 --- a/Resources/Locale/en-US/disease/miasma.ftl +++ b/Resources/Locale/en-US/disease/miasma.ftl @@ -1,4 +1,7 @@ ammonia-smell = Something smells pungent! +perishable-1 = [color=green]It still looks fresh.[/color] +perishable-2 = [color=orangered]It looks somewhat fresh.[/color] +perishable-3 = [color=red]It doesn't look fresh anymore.[/color] rotting-rotting = [color=orange]It's rotting![/color] rotting-bloated = [color=orangered]It's bloated![/color] rotting-extremely-bloated = [color=red]It's extremely bloated![/color]