Skip to content

Commit

Permalink
Merge pull request #321 from GMLambda/bad-bad-addons
Browse files Browse the repository at this point in the history
Add a warning for when bad addons are mounted
  • Loading branch information
ZehMatt authored Oct 29, 2024
2 parents 0c7a237 + 7b3a0e3 commit e2c30e8
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
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

0 comments on commit e2c30e8

Please sign in to comment.