Skip to content

Commit

Permalink
implement popup_menu (OpenDreamProject#1756)
Browse files Browse the repository at this point in the history
Co-authored-by: amylizzle <[email protected]>
  • Loading branch information
amylizzle and amylizzle authored Apr 21, 2024
1 parent 44f69ef commit 1fe1013
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
2 changes: 0 additions & 2 deletions DMCompiler/DM/Builders/DMProcBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,6 @@ public void ProcessStatementSet(DMASTProcStatementSet statementSet) {
proc.Attributes &= ~ProcAttributes.HidePopupMenu;
else
proc.Attributes |= ProcAttributes.HidePopupMenu;

DMCompiler.UnimplementedWarning(statementSet.Location, "set popup_menu is not implemented");
break;
case "instant":
if (constant.IsTruthy())
Expand Down
2 changes: 2 additions & 0 deletions OpenDreamClient/Input/ContextMenu/VerbMenuPopup.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public VerbMenuPopup(ClientVerbSystem? verbSystem, sbyte seeInvisible, ClientObj
foreach (var (verbId, verbSrc, verbInfo) in sorted) {
if (verbInfo.IsHidden(false, seeInvisible))
continue;
if(!verbInfo.ShowInPopupAttribute)
continue;

AddVerb(verbId, verbSrc, verbInfo);
}
Expand Down
1 change: 1 addition & 0 deletions OpenDreamRuntime/ServerVerbSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public void RegisterVerb(DreamProc verb) {

Invisibility = verb.Invisibility,
HiddenAttribute = (verb.Attributes & ProcAttributes.Hidden) == ProcAttributes.Hidden,
ShowInPopupAttribute = (verb.Attributes & ProcAttributes.HidePopupMenu) == 0,
Accessibility = verbAccessibility.Value,
Arguments = verbArguments
};
Expand Down
6 changes: 6 additions & 0 deletions OpenDreamShared/Dream/VerbSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ public struct VerbInfo {
/// </summary>
public bool HiddenAttribute;

/// <summary>
/// If this verb should be shown in the popup menu. Defaults to true.
/// <code>set popup_menu = TRUE</code>
/// </summary>
public bool ShowInPopupAttribute;

/// <summary>
/// Where the verb's src must be for the client to be able to execute it.
/// <code>set src = usr</code>
Expand Down

0 comments on commit 1fe1013

Please sign in to comment.