From d15865071ab7387ff870cc573f3ca6fcdaff720c Mon Sep 17 00:00:00 2001 From: thecraftianman <64441307+thecraftianman@users.noreply.github.com> Date: Wed, 22 Jan 2025 17:35:18 -0500 Subject: [PATCH] Fix broken ACF_OnUpdate[Realm]Data hooks Fixes the weapons menus being broken after merging #430 --- lua/acf/core/networking/data_vars/data_vars_cl.lua | 10 +++++----- lua/acf/core/networking/data_vars/data_vars_sh.lua | 4 ++-- lua/acf/core/networking/data_vars/data_vars_sv.lua | 6 +++--- .../core/networking/data_vars/panel_functions_cl.lua | 2 +- lua/acf/core/validation_sv.lua | 2 +- lua/acf/menu/tool_functions.lua | 2 +- lua/weapons/gmod_tool/stools/acfarmorprop.lua | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lua/acf/core/networking/data_vars/data_vars_cl.lua b/lua/acf/core/networking/data_vars/data_vars_cl.lua index e7dccd431..3c4831e32 100644 --- a/lua/acf/core/networking/data_vars/data_vars_cl.lua +++ b/lua/acf/core/networking/data_vars/data_vars_cl.lua @@ -62,7 +62,7 @@ do -- Server data var syncronization if Values[K] ~= V then Values[K] = V - hook.Run("ACF_OnServerDataUpdate", nil, K, V) + hook.Run("ACF_OnUpdateServerData", nil, K, V) end Received[K] = nil @@ -123,7 +123,7 @@ end do -- Client data setter function --- Sets a client data var and networks it to the server. - --- Internally calls the ACF_OnClientDataUpdate hook + --- Internally calls the ACF_OnUpdateClientData hook --- @param Key string The key of the datavar --- @param Value any The value the datavar --- @param Forced boolean Whether to send regardless of if the value has changed @@ -135,7 +135,7 @@ do -- Client data setter function if Forced or Client[Key] ~= Value then Client[Key] = Value - hook.Run("ACF_OnClientUpdateData", LocalPlayer(), Key, Value) + hook.Run("ACF_OnUpdateClientData", LocalPlayer(), Key, Value) NetworkData(Key) end @@ -144,7 +144,7 @@ end do -- Server data setter function --- Proposes changes to server datavars and networks them to server. - --- Internally calls the ACF_OnServerDataUpdate hook. + --- Internally calls the ACF_OnUpdateServerData hook. --- @param Key string The key of the datavar --- @param Value any The value of the datavar --- @param Forced boolean Whether to send regardless of if the value has changed @@ -162,7 +162,7 @@ do -- Server data setter function if Forced or Server[Key] ~= Value then Server[Key] = Value - hook.Run("ACF_OnServerDataUpdate", Player, Key, Value) + hook.Run("ACF_OnUpdateServerData", Player, Key, Value) NetworkData(Key, true) end diff --git a/lua/acf/core/networking/data_vars/data_vars_sh.lua b/lua/acf/core/networking/data_vars/data_vars_sh.lua index d8cd94914..6a0d47c22 100644 --- a/lua/acf/core/networking/data_vars/data_vars_sh.lua +++ b/lua/acf/core/networking/data_vars/data_vars_sh.lua @@ -114,7 +114,7 @@ do -- Data persisting Keys[Key] = Default end - hook.Add("ACF_On" .. Realm .. "DataUpdate", "ACF Persisted Data", function(_, Key) + hook.Add("ACF_OnUpdate" .. Realm .. "Data", "ACF Persisted Data", function(_, Key) UpdateData(Key) end) @@ -202,7 +202,7 @@ do -- Data callbacks Store[Name] = nil end - hook.Add("ACF_On" .. Realm .. "DataUpdate", "ACF Data Callbacks", function(Player, Key, Value) + hook.Add("ACF_OnUpdate" .. Realm .. "Data", "ACF Data Callbacks", function(Player, Key, Value) if not Callback[Key] then return end local Data = Queue[Key] diff --git a/lua/acf/core/networking/data_vars/data_vars_sv.lua b/lua/acf/core/networking/data_vars/data_vars_sv.lua index 0e067cdd9..5616a31bf 100644 --- a/lua/acf/core/networking/data_vars/data_vars_sv.lua +++ b/lua/acf/core/networking/data_vars/data_vars_sv.lua @@ -68,7 +68,7 @@ do -- Data syncronization if not Data then return end - local Hook = "ACF_On" .. Type .. "DataUpdate" + local Hook = "ACF_OnUpdate" .. Type .. "Data" for K, V in pairs(Data) do if Values[K] ~= V then @@ -186,7 +186,7 @@ end do -- Server data setter function --- Sets a server datavar and networks it to the client --- The server cannot modify the client because we don't want ACF to natively support servers modifying the client - --- Internally calls the ACF_OnServerDataUpdate hook + --- Internally calls the ACF_OnUpdateServerData hook --- @param Key string The key of the datavar --- @param Value any The value the datavar --- @param Forced boolean Whether to send regardless of difference checks @@ -198,7 +198,7 @@ do -- Server data setter function if Forced or Server[Key] ~= Value then Server[Key] = Value - hook.Run("ACF_OnServerDataUpdate", nil, Key, Value) + hook.Run("ACF_OnUpdateServerData", nil, Key, Value) NetworkData(Key) end diff --git a/lua/acf/core/networking/data_vars/panel_functions_cl.lua b/lua/acf/core/networking/data_vars/panel_functions_cl.lua index fb72bf2f4..2f5954b61 100644 --- a/lua/acf/core/networking/data_vars/panel_functions_cl.lua +++ b/lua/acf/core/networking/data_vars/panel_functions_cl.lua @@ -219,7 +219,7 @@ do -- Tracker and Setter panel functions HijackFunctions(Panel, Setter or "SetValue") end - hook.Add("ACF_On" .. Realm .. "DataUpdate", "ACF Update Panel Values", function(_, Key, Value) + hook.Add("ACF_OnUpdate" .. Realm .. "Data", "ACF Update Panel Values", function(_, Key, Value) local Data = DataPanels[Realm][Key] if not Data then return end -- This variable is not being set or tracked by panels diff --git a/lua/acf/core/validation_sv.lua b/lua/acf/core/validation_sv.lua index 0a0ba4230..29dfc4269 100644 --- a/lua/acf/core/validation_sv.lua +++ b/lua/acf/core/validation_sv.lua @@ -178,7 +178,7 @@ function ACF.UpdateThickness(Entity, PhysObj, Area, Ductility) return math.Clamp(Armor, MinimumArmor, MaximumArmor) end -hook.Add("ACF_OnServerDataUpdate", "ACF_MaxThickness", function(_, Key, Value) +hook.Add("ACF_OnUpdateServerData", "ACF_MaxThickness", function(_, Key, Value) if Key ~= "MaxThickness" then return end MaximumArmor = math.floor(ACF.CheckNumber(Value, ACF.MaximumArmor)) diff --git a/lua/acf/menu/tool_functions.lua b/lua/acf/menu/tool_functions.lua index 29e590f4b..46715709d 100644 --- a/lua/acf/menu/tool_functions.lua +++ b/lua/acf/menu/tool_functions.lua @@ -485,7 +485,7 @@ end do -- Clientside Tool interaction if SERVER then -- When the client specifies a new tool mode, switch to the new stage and operation. - hook.Add("ACF_OnClientUpdateData", "ACF ToolMode", function(Player, Key, Value) + hook.Add("ACF_OnUpdateClientData", "ACF ToolMode", function(Player, Key, Value) --- Check if the key is of the form (e.g. "ToolMode:acf_menu"/"ToolMode:acf_copy") local Header, Name = unpack(string.Explode(":", Key), 1, 2) if Header ~= "ToolMode" then return end diff --git a/lua/weapons/gmod_tool/stools/acfarmorprop.lua b/lua/weapons/gmod_tool/stools/acfarmorprop.lua index 3316fcb13..95f6f51e1 100644 --- a/lua/weapons/gmod_tool/stools/acfarmorprop.lua +++ b/lua/weapons/gmod_tool/stools/acfarmorprop.lua @@ -65,7 +65,7 @@ local function UpdateArmor(_, Entity, Data) duplicator.StoreEntityModifier(Entity, "ACF_Armor", { Thickness = Data.Thickness, Ductility = Ductility }) end -hook.Add("ACF_OnServerDataUpdate", "ACF_ArmorTool_MaxThickness", function(_, Key, Value) +hook.Add("ACF_OnUpdateServerData", "ACF_ArmorTool_MaxThickness", function(_, Key, Value) if Key ~= "MaxThickness" then return end MaximumArmor = math.floor(ACF.CheckNumber(Value, ACF.MaximumArmor))