Apply cvar fix to other files too

This commit is contained in:
Redox 2023-12-20 00:57:54 +01:00 committed by techbot
parent 116adbcdff
commit c1c8e0b6d0
2 changed files with 3 additions and 1 deletions

View File

@ -61,6 +61,8 @@ function PART:PreInitialize()
self.hide_disturbing = false
self.active_events = {}
self.active_events_ref_count = 0
local cvarName = "pac_enable_" .. string.Replace(self.ClassName, " ", "_"):lower()
if not GetConVar(cvarName):GetBool() then self:SetWarning("This part class is disabled! Enable it with " .. cvarName .. " 1") end
end
function PART:Initialize() end

View File

@ -89,7 +89,7 @@ function pac.RegisterPart(META)
local cvarName = "pac_enable_" .. string.Replace(META.ClassName, " ", "_"):lower()
local cvar = CreateClientConVar(cvarName, "1", true)
cvars.AddChangeCallback("pac_enable_" .. META.ClassName, function(name, old, new)
cvars.AddChangeCallback(cvarName, function(name, old, new)
local enable = tobool(new)
META.GloballyEnabled = enable
if enable then