Examine prediction (#23565)

* Initial prediction

* new group handling

* groups for all examines that use multiple rn

* compile

* why was it doing this??

* handle newlines with sorting properly
This commit is contained in:
Kara
2024-01-05 23:53:13 -07:00
committed by GitHub
parent 731cfc278a
commit 0ae3858b69
41 changed files with 693 additions and 431 deletions

View File

@@ -216,7 +216,7 @@ public sealed class DrainSystem : SharedDrainSystem
var text = drainSolution.AvailableVolume != 0
? Loc.GetString("drain-component-examine-volume", ("volume", drainSolution.AvailableVolume))
: Loc.GetString("drain-component-examine-hint-full");
args.Message.AddMarkup($"\n\n{text}");
args.PushMarkup(text);
}
private void OnInteract(Entity<DrainComponent> entity, ref AfterInteractUsingEvent args)

View File

@@ -43,10 +43,13 @@ public sealed partial class PuddleSystem
private void OnExamined(Entity<SpillableComponent> entity, ref ExaminedEvent args)
{
args.PushMarkup(Loc.GetString("spill-examine-is-spillable"));
using (args.PushGroup(nameof(SpillableComponent)))
{
args.PushMarkup(Loc.GetString("spill-examine-is-spillable"));
if (HasComp<MeleeWeaponComponent>(entity))
args.PushMarkup(Loc.GetString("spill-examine-spillable-weapon"));
if (HasComp<MeleeWeaponComponent>(entity))
args.PushMarkup(Loc.GetString("spill-examine-spillable-weapon"));
}
}
private void OnOverflow(Entity<SpillableComponent> entity, ref SolutionContainerOverflowEvent args)

View File

@@ -361,23 +361,27 @@ public sealed partial class PuddleSystem : SharedPuddleSystem
private void HandlePuddleExamined(Entity<PuddleComponent> entity, ref ExaminedEvent args)
{
if (TryComp<StepTriggerComponent>(entity, out var slippery) && slippery.Active)
using (args.PushGroup(nameof(PuddleComponent)))
{
args.PushMarkup(Loc.GetString("puddle-component-examine-is-slipper-text"));
}
if (TryComp<StepTriggerComponent>(entity, out var slippery) && slippery.Active)
{
args.PushMarkup(Loc.GetString("puddle-component-examine-is-slipper-text"));
}
if (HasComp<EvaporationComponent>(entity) &&
_solutionContainerSystem.ResolveSolution(entity.Owner, entity.Comp.SolutionName, ref entity.Comp.Solution, out var solution))
{
if (CanFullyEvaporate(solution))
args.PushMarkup(Loc.GetString("puddle-component-examine-evaporating"));
else if (solution.GetTotalPrototypeQuantity(EvaporationReagents) > FixedPoint2.Zero)
args.PushMarkup(Loc.GetString("puddle-component-examine-evaporating-partial"));
if (HasComp<EvaporationComponent>(entity) &&
_solutionContainerSystem.ResolveSolution(entity.Owner, entity.Comp.SolutionName,
ref entity.Comp.Solution, out var solution))
{
if (CanFullyEvaporate(solution))
args.PushMarkup(Loc.GetString("puddle-component-examine-evaporating"));
else if (solution.GetTotalPrototypeQuantity(EvaporationReagents) > FixedPoint2.Zero)
args.PushMarkup(Loc.GetString("puddle-component-examine-evaporating-partial"));
else
args.PushMarkup(Loc.GetString("puddle-component-examine-evaporating-no"));
}
else
args.PushMarkup(Loc.GetString("puddle-component-examine-evaporating-no"));
}
else
args.PushMarkup(Loc.GetString("puddle-component-examine-evaporating-no"));
}
private void OnAnchorChanged(Entity<PuddleComponent> entity, ref AnchorStateChangedEvent args)