Skip to content
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
102 changes: 102 additions & 0 deletions code/datums/verbs.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/datum/verbs
var/name
var/list/children
var/datum/verbs/parent
var/list/verblist
var/abstract = FALSE

//returns the master list for verbs of a type
/datum/verbs/proc/GetList()
CRASH("Abstract verblist for [type]")

//do things for each entry in Generate_list
//return value sets Generate_list[verbpath]
/datum/verbs/proc/HandleVerb(list/entry, procpath/verbpath, ...)
return entry

/datum/verbs/New()
var/mainlist = GetList()
var/ourentry = mainlist[type]
children = list()
verblist = list()
if (ourentry)
if (!islist(ourentry)) //some of our childern already loaded
qdel(src)
CRASH("Verb double load: [type]")
Add_children(ourentry)

mainlist[type] = src

Load_verbs(type, typesof("[type]/verb"))

var/datum/verbs/parent = mainlist[parent_type]
if (!parent)
mainlist[parent_type] = list(src)
else if (islist(parent))
parent += src
else
parent.Add_children(list(src))

/datum/verbs/proc/Set_parent(datum/verbs/_parent)
parent = _parent
if (abstract)
parent.Add_children(children)
var/list/verblistoftypes = list()
for(var/thing in verblist)
LAZYADD(verblistoftypes[verblist[thing]], thing)

for(var/verbparenttype in verblistoftypes)
parent.Load_verbs(verbparenttype, verblistoftypes[verbparenttype])

/datum/verbs/proc/Add_children(list/kids)
if (abstract && parent)
parent.Add_children(kids)
return

for(var/thing in kids)
var/datum/verbs/item = thing
item.Set_parent(src)
if (!item.abstract)
children += item

/datum/verbs/proc/Load_verbs(verb_parent_type, list/verbs)
if (abstract && parent)
parent.Load_verbs(verb_parent_type, verbs)
return

for (var/verbpath in verbs)
verblist[verbpath] = verb_parent_type

/datum/verbs/proc/Generate_list(...)
. = list()
if (length(children))
for (var/thing in children)
var/datum/verbs/child = thing
var/list/childlist = child.Generate_list(arglist(args))
if (childlist)
var/childname = "[child]"
if (childname == "[child.type]")
var/list/tree = splittext(childname, "/")
childname = tree[tree.len]
.[child.type] = "parent=[url_encode("[type]")];name=[childname]"
. += childlist

for (var/thing in verblist)
var/procpath/verbpath = thing
if (!verbpath)
stack_trace("Bad VERB in [type] verblist: [english_list(verblist)]")
var/list/entry = list()
entry["parent"] = "[type]"
entry["name"] = verbpath.desc
if (verbpath.name[1] == "@")
entry["command"] = copytext(verbpath.name, length(verbpath.name[1]) + 1)
else
entry["command"] = replacetext(verbpath.name, " ", "-")

.[verbpath] = HandleVerb(arglist(list(entry, verbpath) + args))

/world/proc/LoadVerbs(verb_type)
if(!ispath(verb_type, /datum/verbs) || verb_type == /datum/verbs)
CRASH("Invalid verb_type: [verb_type]")
for (var/typepath in subtypesof(verb_type))
new typepath()
2 changes: 2 additions & 0 deletions code/game/world.dm
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ GLOBAL_VAR(restart_counter)
// Initialize RETA system - code/modules/reta/reta_system.dm
reta_init_config()

LoadVerbs(/datum/verbs/menu)

if(fexists(RESTART_COUNTER_PATH))
GLOB.restart_counter = text2num(trim(file2text(RESTART_COUNTER_PATH)))
fdel(RESTART_COUNTER_PATH)
Expand Down
27 changes: 27 additions & 0 deletions code/modules/client/client_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,10 @@ GLOBAL_LIST_INIT(unrecommended_builds, list(
if(!tooltips)
tooltips = new /datum/tooltip(src)


if (!interviewee)
initialize_menus()

loot_panel = new(src)

view_size = new(src)
Expand Down Expand Up @@ -1141,6 +1145,29 @@ GLOBAL_LIST_INIT(unrecommended_builds, list(
return
to_chat(src, span_userdanger("Statpanel failed to load, click <a href='byond://?src=[REF(src)];reload_statbrowser=1'>here</a> to reload the panel "))

/**
* Initializes dropdown menus on client
*/
/client/proc/initialize_menus()
var/list/topmenus = GLOB.menulist[/datum/verbs/menu]
for (var/thing in topmenus)
var/datum/verbs/menu/topmenu = thing
var/topmenuname = "[topmenu]"
if (topmenuname == "[topmenu.type]")
var/list/tree = splittext(topmenuname, "/")
topmenuname = tree[tree.len]
winset(src, "[topmenu.type]", "parent=menu;name=[url_encode(topmenuname)]")
var/list/entries = topmenu.Generate_list(src)
for (var/child in entries)
winset(src, "[child]", "[entries[child]]")
if (!ispath(child, /datum/verbs/menu))
var/procpath/verbpath = child
if (verbpath.name[1] != "@")
new child(src)

// Place Help back at the end.
winset(src, "help-menu", "index=1000")

/client/proc/open_filter_editor(atom/in_atom)
if(holder)
holder.filterrific = new /datum/filter_editor(in_atom)
Expand Down
23 changes: 12 additions & 11 deletions code/modules/client/preferences_menu.dm
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
/client/verb/open_character_preferences()
/datum/verbs/menu/Preferences/verb/open_character_preferences()
set category = "OOC"
set name = "Open Character Preferences"
set desc = "Open Character Preferences"

if(!prefs)
var/datum/preferences/preferences = usr?.client?.prefs
if(!preferences)
return
prefs.current_window = PREFERENCE_TAB_CHARACTER_PREFERENCES
prefs.update_static_data(usr)
prefs.ui_interact(usr)
preferences.current_window = PREFERENCE_TAB_CHARACTER_PREFERENCES
preferences.update_static_data(usr)
preferences.ui_interact(usr)

/client/verb/open_game_preferences()
/datum/verbs/menu/Preferences/verb/open_game_preferences()
set category = "OOC"
set name = "Open Game Preferences"
set desc = "Open Game Preferences"

if(!prefs)
var/datum/preferences/preferences = usr?.client?.prefs
if(!preferences)
return
prefs.current_window = PREFERENCE_TAB_GAME_PREFERENCES
prefs.update_static_data(usr)
prefs.ui_interact(usr)

preferences.current_window = PREFERENCE_TAB_GAME_PREFERENCES
preferences.update_static_data(usr)
preferences.ui_interact(usr)
10 changes: 0 additions & 10 deletions config/nova/config_nova.txt
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,5 @@ SAVEFILE_UPLOAD_LIMIT 2000
## Uncomment to override gas prices with their modified values, leave commented to use the TG defaults
#OVERRIDE_GAS_PRICES

## Uncomment to allow players to connect to relays
#ENABLE_RELAYS

## If using relays, you will also need to specify at least one relay address here. The first entry is what shows in the relay selection ui, and the second is the actual url.
#RELAY_OPTION Connect to US-West (Los Angeles),byond://us-west.placeholder.com:1337
#RELAY_OPTION Connect to EU-Central (Germany),byond://eu.placeholder.com:1337
#RELAY_OPTION Connect to Asia (Singapore),byond://asia.placeholder.com:1337
#RELAY_OPTION Connect to South America (Brazil),byond://south-america.placeholder.com:1337
#RELAY_OPTION Connect Directly (No Relay),byond://placeholder.com:1337

## Uncomment to disable the Star rank restrictions
#ENABLE_NOVA_STAR_RESTRICTIONS 0
1 change: 1 addition & 0 deletions interface/interface.dm
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@

/client/verb/hotkeys_help()
set name = "Hotkeys Help"
set category = "OOC"
set hidden = TRUE

if(!GLOB.hotkeys_tgui)
Expand Down
19 changes: 19 additions & 0 deletions interface/menu.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
/datum/verbs/menu/Example/verb/Example()
set name = "" //if this starts with @ the verb is not created and name becomes the command to invoke.
set desc = "" //desc is the text given to this entry in the menu
//You can not use src in these verbs. It will be the menu at compile time, but the client at runtime.
*/

GLOBAL_LIST_EMPTY(menulist)

/datum/verbs/menu
var/default //default checked type.
//Set to true to append our children to our parent,
//Rather then add us as a node (used for having more then one checkgroups in the same menu)

/datum/verbs/menu/GetList()
return GLOB.menulist

/datum/verbs/menu/HandleVerb(list/entry, verbpath, client/C)
return list2params(entry)
65 changes: 65 additions & 0 deletions interface/skin.dmf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,70 @@ macro "default"
name = "SHIFT+UP"
command = ".winset :map.right-click=true"

menu "menu"
elem
name = "&File"
command = ""
saved-params = "is-checked"
elem
name = "&Quick screenshot\tF2"
command = ".screenshot auto"
category = "&File"
saved-params = "is-checked"
elem
name = "&Save screenshot as...\tShift+F2"
command = ".screenshot"
category = "&File"
saved-params = "is-checked"
elem
name = ""
command = ""
category = "&File"
saved-params = "is-checked"
elem "reconnectbutton"
name = "&Reconnect"
command = ".reconnect"
category = "&File"
saved-params = "is-checked"
elem
name = "&Quit\tAlt-F4"
command = ".quit"
category = "&File"
saved-params = "is-checked"
elem "help-menu"
name = "&Help"
command = ""
saved-params = "is-checked"
elem
name = "&Admin Help\tF1"
command = "adminhelp"
category = "&Help"
saved-params = "is-checked"
elem
name = "&Hotkeys"
command = "Hotkeys-Help"
category = "&Help"
saved-params = "is-checked"
elem
name = "Refresh TGUI"
command = "refresh-tgui"
category = "&Help"
saved-params = "is-checked"
elem
name = "Fix Chat"
command = "fix-chat"
category = "&Help"
saved-params = "is-checked"
elem "Use Internet Routing Relay"
name = "Internet Routing Relays"
command = "internet-routing-relays"
saved-params = "is-checked"
elem
name = "Stop All Sounds"
command = "stop-sounds"
category = "&Help"
saved-params = "is-checked"

window "mainwindow"
elem "mainwindow"
type = MAIN
Expand All @@ -20,6 +84,7 @@ window "mainwindow"
statusbar = false
icon = 'modular_iris\\master_files\\icons\\ui_icons\\common\\oculis_logo_32.png'
macro = "default"
menu = "menu"
elem "split"
type = CHILD
pos = 0,0
Expand Down
2 changes: 2 additions & 0 deletions modular_nova/modules/mentor/code/client_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
return ..()

/client/proc/client_procs(href_list)
/* OCULIS REMOVAL START - we already have relays
if(href_list["connect_to_relay"])
connect_to_relay()
return TRUE
*/ // OCULIS REMOVAL END

if(href_list["mentor_msg"])
if(CONFIG_GET(flag/mentors_mobname_only))
Expand Down
34 changes: 0 additions & 34 deletions modular_nova/modules/verbs/code/relays.dm

This file was deleted.

31 changes: 31 additions & 0 deletions modular_oculis/modules/menubar/code/preferences.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Makes the menubar a preference
/datum/preference/toggle/menubar_enabled
savefile_key = "menubar_enabled"
savefile_identifier = PREFERENCE_PLAYER
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
default_value = TRUE

/datum/preference/toggle/menubar_enabled/apply_to_client_updated(client/client, value)
if(value)
winset(client, SKIN_MAINWINDOW, "menu=menu")
else
winset(client, SKIN_MAINWINDOW, "menu=")

// New preference options - Core ones can be found at code/modules/client/preferences_menu.dm

/datum/verbs/menu/Preferences/verb/open_keybindings()
set category = "OOC"
set name = "Open Keybindings"
set desc = "Open Keybindings"

var/datum/preferences/preferences = usr?.client?.prefs
if(!preferences)
return
preferences.current_window = PREFERENCE_TAB_KEYBINDINGS
preferences.update_static_data(usr)
preferences.ui_interact(usr)

/client/New()
. = ..()
if(!prefs.read_preference(/datum/preference/toggle/menubar_enabled))
winset(src, SKIN_MAINWINDOW, "menu=")
Loading
Loading