From 4743d8e6063aa35116d6ccb6d0864f1101d07b7b Mon Sep 17 00:00:00 2001 From: Bitl Date: Mon, 11 Jul 2022 17:35:21 -0700 Subject: [PATCH] addon api changes/fixes --- AddonLoader.lua | 16 +++++++--------- Addon_Template.lua | 7 ++++++- ClientNamePrinter.lua | 1 + ShadersCompatibility.lua | 18 +++++++++++------- changelog.txt | 4 ++-- scripts/launcher/info.ini | 2 +- scripts/launcher/splashes.txt | 3 ++- 7 files changed, 30 insertions(+), 21 deletions(-) diff --git a/AddonLoader.lua b/AddonLoader.lua index 671a566..aa09ee2 100644 --- a/AddonLoader.lua +++ b/AddonLoader.lua @@ -18,56 +18,54 @@ end Modules = {} for i,v in pairs(Scripts) do - pcall(function() dofile(v) end) - pcall(function() _G.CSScript_AddModule(Modules) end) + local success, response = pcall(function() dofile(v) end) + + if (not success) then + print("AddonLoader: Failed to load script: " .. response) + else + _G.CSScript_AddModule(Modules) + end end function PreInit(Script, Client) for i,v in pairs(Modules) do pcall(function() v:PreInit(Script, Client) end) - pcall(function() print(v:Name() .. " called PreInit") end) end end function PostInit() for i,v in pairs(Modules) do pcall(function() v:PostInit() end) - pcall(function() print(v:Name() .. " called PostInit") end) end end function OnLoadCharacter(Player, Appearance) for i,v in pairs(Modules) do pcall(function() v:OnLoadCharacter(Player, Appearance) end) - pcall(function() print(v:Name() .. " called OnLoadCharacter") end) end end function OnPlayerAdded(Player) for i,v in pairs(Modules) do pcall(function() v:OnPlayerAdded(Player) end) - pcall(function() print(v:Name() .. " called OnPlayerAdded") end) end end function OnPlayerRemoved(Player) for i,v in pairs(Modules) do pcall(function() v:OnPlayerRemoved(Player) end) - pcall(function() print(v:Name() .. " called OnPlayerRemoved") end) end end function OnPlayerKicked(Player, Reason) for i,v in pairs(Modules) do pcall(function() v:OnPlayerKicked(Player, Reason) end) - pcall(function() print(v:Name() .. " called OnPlayerKicked") end) end end function OnPrePlayerKicked(Player, Reason) for i,v in pairs(Modules) do pcall(function() v:OnPrePlayerKicked(Player, Reason) end) - pcall(function() print(v:Name() .. " called OnPrePlayerKicked") end) end end diff --git a/Addon_Template.lua b/Addon_Template.lua index 7273c7b..13a7a08 100644 --- a/Addon_Template.lua +++ b/Addon_Template.lua @@ -1,5 +1,9 @@ local this = {} +function this:Name() + return "Template" +end + -- executes before the game starts (server, solo, studio) -- arguments: Script - returns the script type name (Server, Solo, Studio), Client - returns the Client name. function this:PreInit(Script, Client) @@ -36,9 +40,10 @@ end function this:OnPrePlayerKicked(Player, Reason) end --- DO NOT MODIFY THIS. this is required to load this addon into the game. +-- DO NOT REMOVE THIS. this is required to load this addon into the game. function AddModule(t) + print("AddonLoader: Adding " .. v:Name()) table.insert(t, this) end diff --git a/ClientNamePrinter.lua b/ClientNamePrinter.lua index da7dd60..5959b6d 100644 --- a/ClientNamePrinter.lua +++ b/ClientNamePrinter.lua @@ -13,6 +13,7 @@ function this:PreInit(Script, Client) end function AddModule(t) + print("AddonLoader: Adding " .. this:Name()) table.insert(t, this) end diff --git a/ShadersCompatibility.lua b/ShadersCompatibility.lua index f7344d0..859448b 100644 --- a/ShadersCompatibility.lua +++ b/ShadersCompatibility.lua @@ -23,14 +23,14 @@ end -- executes before a player gets kicked (server) -- arguments: Player - the Player getting kicked, Reason - the reason the player got kicked function this:OnPrePlayerKicked(Player, Reason) - if (game.Lighting:FindFirstChild("SkipSecurity") ~= nil) then + if (game.Lighting:findFirstChild("SkipSecurity") ~= nil) then do return end end if (IsShaderSupportingClient()) then validLauncher = false - for _,newVal in pairs(Player.Security:GetChildren()) do + for _,newVal in pairs(Player.Security:children()) do if (newVal.Name == "LauncherMD5") then if (newVal.Value == game.Lighting.Security.LauncherMD5.Value or newVal.Value == "") then validLauncher = true @@ -42,7 +42,8 @@ function this:OnPrePlayerKicked(Player, Reason) print(Player.Name .. " is using a valid modified client!") local ver = Instance.new("StringValue",game.Lighting) ver.Name = "SkipSecurity" - ver.Value = "temp" + local tempTag = Instance.new("StringValue",ver) + tempTag.Name = "Temp" end end end @@ -51,14 +52,17 @@ end -- arguments: Player - Player getting a character loaded, Appearance - The object containing the appearance values -- notes: in play solo, you may have to respawn once to see any print outputs. function this:OnLoadCharacter(Player, Appearance) - if (game.Lighting:FindFirstChild("SkipSecurity") ~= nil and game.Lighting.SkipSecurity.Value == "temp") then - game.Lighting.SkipSecurity:remove() + if (IsShaderSupportingClient()) then + if (game.Lighting:findFirstChild("SkipSecurity") ~= nil) then + if (game.Lighting.SkipSecurity:findFirstChild("Temp") ~= nil) then + game.Lighting.SkipSecurity:remove() + end + end end end --- DO NOT MODIFY THIS. this is required to load this addon into the game. - function AddModule(t) + print("AddonLoader: Adding " .. this:Name()) table.insert(t, this) end diff --git a/changelog.txt b/changelog.txt index e78ac63..d186f0e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,9 +1,9 @@ -1.3 Snapshot v22.8222.20490.1 +1.3 Snapshot v22.8222.20490.3 Enhancements: - Added support for multiple addon scripts! - Thanks to BRAVONATCHO for the idea! - Added OnPrePlayerKicked to the scripting API. -- You can now join games with Shaders clients! +- You can now join normal 2007 servers with Shaders clients (and vice versa)! ---------------------------------------------------------------------------- 1.3 Snapshot v22.8222.20490.2 Enhancements: diff --git a/scripts/launcher/info.ini b/scripts/launcher/info.ini index 7f795da..c30c428 100644 --- a/scripts/launcher/info.ini +++ b/scripts/launcher/info.ini @@ -8,6 +8,6 @@ ExtendedVersionNumber=True ExtendedVersionEditChangelog=True //ExtendedVersionTemplate=%version% v?.2022.%extended-revision%%lite% ExtendedVersionTemplate=%version% Snapshot v22.%build%.%revision%.%extended-revision% -ExtendedVersionRevision=1 +ExtendedVersionRevision=3 IsLite=False InitialBootup=False diff --git a/scripts/launcher/splashes.txt b/scripts/launcher/splashes.txt index e441855..45a272c 100644 --- a/scripts/launcher/splashes.txt +++ b/scripts/launcher/splashes.txt @@ -205,4 +205,5 @@ Látom. [stylish]Tell me how it felt when you walked on water. Did you get your wish? [normal]GET TO THE SHIPS! IT'S OUR ONLY CHANCE!|From the 1986 Transformers movie. Standing here, I realize... -good grief! \ No newline at end of file +good grief! +This machine kills fascists \ No newline at end of file