Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Options to Display ItemComponents' Msg in Inventories #14586

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Barotrauma/BarotraumaClient/ClientSource/Items/Inventory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,17 @@ private static RichString GetTooltip(Item item, IEnumerable<Item> itemsInSlot, C
toolTip += $"‖color:{conditionColorStr}‖ ({(int)item.ConditionPercentage} %)‖color:end‖";
}
if (!description.IsNullOrEmpty()) { toolTip += '\n' + description; }

bool isOwnInventory = item.ParentInventory.Owner == Character.Controlled;
foreach (ItemComponent component in item.Components)
{
if (isOwnInventory && component.ShowMsgInOwnInventory || component.ShowMsgInOtherInventory)
{
Color color = component.HasRequiredItems(character, false) ? Color.Cyan : Color.Gray;
toolTip += $"\n‖color:{color.ToStringHex()}‖{component.DisplayMsg}‖color:end‖";
}
}

if (item.Prefab.ContentPackage != GameMain.VanillaContent && item.Prefab.ContentPackage != null)
{
colorStr = XMLExtensions.ToStringHex(Color.MediumPurple);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,20 @@ public string Msg
set;
}

[Serialize(false, IsPropertySaveable.Yes, description: "If set to true, the component's message will also be displayed while in the controlled character's inventory.")]
public bool ShowMsgInOwnInventory
{
get;
set;
}

[Serialize(false, IsPropertySaveable.Yes, description: "If set to true, the component's message will also be displayed while in an inventory not owned by the controlled character.")]
public bool ShowMsgInOtherInventory
{
get;
set;
}

public LocalizedString DisplayMsg
{
get;
Expand Down