Skip to content

Commit

Permalink
Minor fix to only list visible commands on examinable object examine
Browse files Browse the repository at this point in the history
  • Loading branch information
ben_singer committed Nov 29, 2024
1 parent 94ad376 commit 385ab9c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions NetAF/Assets/ExaminableObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,19 @@ private static void EnsureAtleastABasicDescription(ExaminationRequest request, r
/// <param name="description">The current description.</param>
private static void AddCommandsToDescription(ExaminationRequest request, ref StringBuilder description)
{
if (request.Examinable.Commands == null || request.Examinable.Commands.Length == 0)
var commands = request.Examinable.Commands?.Where(x => x.IsPlayerVisible).ToArray() ?? [];

if (commands.Length == 0)
return;

if (description.Length > 0)
description.Append(' ');

description.Append($"{Environment.NewLine}{Environment.NewLine}{request.Examinable.Identifier.Name} provides the following commands: ");

for (int i = 0; i < request.Examinable.Commands.Length; i++)
for (int i = 0; i < commands.Length; i++)
{
CustomCommand customCommand = request.Examinable.Commands[i];
CustomCommand customCommand = commands[i];
description.Append($"{Environment.NewLine}\"{customCommand.Help.Command}\" - {customCommand.Help.Description.RemoveSentenceEnd()}, ");
}

Expand Down

0 comments on commit 385ab9c

Please sign in to comment.