-- mcp - Main data and logic of MCP -- (component of MCP) -- Template attachment: none -- Created by: Patrick Ferland -- Created on: 08/01/2008 -- Revision History -- 08/01/2008 P.Ferland - New script -- 11/13/2008 P.Ferland - Added notification trigger (for module import of MCP-registered systems, etc) -- Constants DEFAULT_SPRITE_ID = '11832:6' -- Script properties Define Properties() mcp_commands = {} mcp_visible_on_login = 0 PersistProperty('mcp_visible_on_login') ExposeProperty('mcp_visible_on_login', 'MCP visible to superusers on login? 1=yes, 0=no') SetPropRange('mcp_visible_on_login', 0, 1) IncludeScript('13197:21') -- ui_library end Trigger mcp_notify(message, user) local notify = ui_default_window(0, 'mcp_notify', 0, 0, 250, 200) local title = UiMultiLabel(notify, 'mcp_notify_title', 0, 0, 220, 30, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0) UiText(title, 'Metaplace Control Panel') local text = UiMultiLabel(notify, 'mcp_notify_text', 10, 30, 230, 160, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0) UiText(text, '' .. message .. '') UiAttachUser(user, notify) UiAlign(notify, 0, 0, 'center', 'scale_none') UiVisible(notify, 1) end Trigger mcp_register_command(command, tooltip, sprite_id) if ( (command == '') or (command == nil) ) then return end if ( (tooltip == '') or (tooltip == nil) ) then tooltip = command end if ( (sprite_id == '') or (sprite_id == nil) ) then sprite_id = DEFAULT_SPRITE_ID end Debug('MCP: Registering command ' .. command) self.mcp_commands[command] = { ['tooltip'] = tooltip, ['sprite_id'] = sprite_id } local user = nil local w = GetWorld() for _, user in ipairs(w.users) do if (IsSuperuser(user) ~= nil) then SendTo(user, 'mcp_draw', 0) end end end Trigger mcp_unregister_command(command) self.mcp_commands[command] = nil local user = nil local w = GetWorld() for _, user in ipairs(w.users) do if (IsSuperuser(user) ~= nil) then SendTo(user, 'mcp_draw', 0) end end end