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 a warning for when bad addons are mounted #321

Merged
merged 1 commit into from
Oct 29, 2024
Merged
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
38 changes: 38 additions & 0 deletions gamemode/sh_compatibility.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
AddCSLuaFile()

local badAddonIds = {
-- "Episode animation fixes"
["3022183926"] = true,
["1879556056"] = true,
["2576796480"] = true,
["3263204957"] = true,
["1881393042"] = true,
["1095903501"] = true,
["1890049841"] = true,
-- Reserved.
}

local function IsBadAddon(id)
return badAddonIds[id] ~= nil
end

local function CheckAddonCompatibility()
local addons = engine.GetAddons()
local badAddons = {}
for _, addon in pairs(addons) do
if addon.mounted and IsBadAddon(addon.wsid) then
table.insert(badAddons, addon)
end
end
if #badAddons == 0 then
return
end
local errorInfo = "WARNING: Following addons are obsolete or cause issues:\n"
for _, addon in pairs(badAddons) do
errorInfo = errorInfo .. " - " .. addon.title .. " (" .. addon.wsid .. ")\n"
end
errorInfo = errorInfo .. "Disable them and restart the game for the best experience.\n"
ErrorNoHalt(errorInfo)
end

CheckAddonCompatibility()
1 change: 1 addition & 0 deletions gamemode/shared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ if SERVER then
end

DEFINE_BASECLASS("gamemode_base")
include("sh_compatibility.lua")
include("sh_lambda_build.lua")
include("sh_debug.lua")
include("sh_convars.lua")
Expand Down