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:
@@ -33,23 +33,27 @@ public sealed class LightReplacerSystem : EntitySystem
|
||||
|
||||
private void OnExamined(EntityUid uid, LightReplacerComponent component, ExaminedEvent args)
|
||||
{
|
||||
if (!component.InsertedBulbs.ContainedEntities.Any())
|
||||
using (args.PushGroup(nameof(LightReplacerComponent)))
|
||||
{
|
||||
args.PushMarkup(Loc.GetString("comp-light-replacer-no-lights"));
|
||||
return;
|
||||
}
|
||||
args.PushMarkup(Loc.GetString("comp-light-replacer-has-lights"));
|
||||
var groups = new Dictionary<string, int>();
|
||||
var metaQuery = GetEntityQuery<MetaDataComponent>();
|
||||
foreach (var bulb in component.InsertedBulbs.ContainedEntities)
|
||||
{
|
||||
var metaData = metaQuery.GetComponent(bulb);
|
||||
groups[metaData.EntityName] = groups.GetValueOrDefault(metaData.EntityName) + 1;
|
||||
}
|
||||
if (!component.InsertedBulbs.ContainedEntities.Any())
|
||||
{
|
||||
args.PushMarkup(Loc.GetString("comp-light-replacer-no-lights"));
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var (name, amount) in groups)
|
||||
{
|
||||
args.PushMarkup(Loc.GetString("comp-light-replacer-light-listing", ("amount", amount), ("name", name)));
|
||||
args.PushMarkup(Loc.GetString("comp-light-replacer-has-lights"));
|
||||
var groups = new Dictionary<string, int>();
|
||||
var metaQuery = GetEntityQuery<MetaDataComponent>();
|
||||
foreach (var bulb in component.InsertedBulbs.ContainedEntities)
|
||||
{
|
||||
var metaData = metaQuery.GetComponent(bulb);
|
||||
groups[metaData.EntityName] = groups.GetValueOrDefault(metaData.EntityName) + 1;
|
||||
}
|
||||
|
||||
foreach (var (name, amount) in groups)
|
||||
{
|
||||
args.PushMarkup(Loc.GetString("comp-light-replacer-light-listing", ("amount", amount), ("name", name)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user