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

Add notification.AddLegacyType & notification.GetLegacyTypes #1967

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
23 changes: 23 additions & 0 deletions garrysmod/lua/includes/modules/notification.lua
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,29 @@ function AddLegacy( text, type, length )

end

local matNotifyGeneric = NoticeMaterial[ NOTIFY_GENERIC ]

function AddLegacyType( legacyName, materialName )
if ( !isstring( legacyName ) ) then error( "bad argument #1 to 'AddLegacyType' (string expected, got " .. type( legacyName ) .. ")", 2 ) return end
if ( !isstring( materialName ) ) then error( "bad argument #2 to 'AddLegacyType' (string expected, got " .. type( materialName ) .. ")", 2 ) return end

local mat = Material( materialName )

if ( !mat || mat:IsError() ) then
NoticeMaterial[ legacyName ] = matNotifyGeneric

return false
end

NoticeMaterial[ legacyName ] = mat

return mat
end

function GetLegacyTypes()
return NoticeMaterial
end

-- This is ugly because it's ripped straight from the old notice system
local function UpdateNotice( pnl, total_h )

Expand Down