Skip to content

Commit

Permalink
Merge pull request #820 from zymex22/issue811
Browse files Browse the repository at this point in the history
Now displaying the Renamed Name if Available and the Group name in Brackets
  • Loading branch information
Sn1p3rr3c0n authored Oct 20, 2024
2 parents 0ad86e1 + dde4c59 commit d25320f
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion Source/ProjectRimFactory/Common/ITab_ProductionSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,25 @@ public override void OnOpen()
}
}

private string GetSlotGroupName(ISlotGroupParent slotGroup)
{
string appendGroup = "";
if (slotGroup is IStorageGroupMember storageGroupMember)
{
if (storageGroupMember.Group != null && storageGroupMember.Group.RenamableLabel != "")
{
appendGroup = $" ({storageGroupMember.Group.RenamableLabel})";
}
}

if (slotGroup is IRenameable renameable)
{
return $"{renameable.RenamableLabel}{appendGroup}";
}

return $"{slotGroup.SlotYielderLabel()}{appendGroup}";
}

protected override void FillTab()
{
Listing_Standard list = new Listing_Standard();
Expand Down Expand Up @@ -273,7 +292,7 @@ protected override void FillTab()
if (Widgets.ButtonText(rect.RightHalf(), this.Machine.TargetSlotGroup?.parent?.SlotYielderLabel() ?? "PRF.AutoMachineTool.EntierMap".Translate()))
{
Find.WindowStack.Add(new FloatMenu(groups
.Select(g => new FloatMenuOption(g.parent.SlotYielderLabel(), () => this.Machine.TargetSlotGroup =g))
.Select(g => new FloatMenuOption( GetSlotGroupName(g.parent), () => this.Machine.TargetSlotGroup =g))
.ToList()
.Head(new FloatMenuOption("PRF.AutoMachineTool.EntierMap".Translate(), () => this.Machine.TargetSlotGroup = null))));
}
Expand Down

0 comments on commit d25320f

Please sign in to comment.