Skip to content

Commit

Permalink
Renamed a few shared hooks
Browse files Browse the repository at this point in the history
- ACF_OnNewGroup => ACF_OnCreateGroup
- ACF_OnNewGroupItem => ACF_OnCreateGroupItem
- ACF_OnNewItem => ACF_OnCreateItem
- ACF_OnClassLoaded => ACF_OnLoadClass
- ACF_OnServerDataUpdate => ACF_OnUpdateServerData
- ACF_OnClientDataUpdate => ACF_OnUpdateClientData
- ACF_OnClock => ACF_OnTick
- ACF_GetDisplayData => ACF_OnGetDisplayData
- ACF_UpdateRoundData => ACF_OnUpdateRound
- ACF_OnEntityResized => ACF_OnResizeEntity
  • Loading branch information
TwistedTail committed Feb 18, 2024
1 parent 4a5129f commit 272299a
Show file tree
Hide file tree
Showing 27 changed files with 51 additions and 51 deletions.
2 changes: 1 addition & 1 deletion lua/acf/ballistics/ballistics_cl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ local function BulletFlight(Bullet, DeltaTime)
debugoverlay.Line(Bullet.SimPosLast, Bullet.SimPos, 15, Yellow)
end

hook.Add("ACF_OnClock", "ACF_ManageBulletEffects", function(_, DeltaTime)
hook.Add("ACF_OnTick", "ACF_ManageBulletEffects", function(_, DeltaTime)
for _, Bullet in pairs(ACF.BulletEffect) do
BulletFlight(Bullet, DeltaTime)
end
Expand Down
4 changes: 2 additions & 2 deletions lua/acf/ballistics/ballistics_sv.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function Ballistics.RemoveBullet(Bullet)
Bullet.Removed = true

if not next(Bullets) then
hook.Remove("ACF_OnClock", "ACF Iterate Bullets")
hook.Remove("ACF_OnTick", "ACF Iterate Bullets")
end
end

Expand Down Expand Up @@ -144,7 +144,7 @@ function Ballistics.CreateBullet(BulletData)
end

if not next(Bullets) then
hook.Add("ACF_OnClock", "ACF Iterate Bullets", Ballistics.IterateBullets)
hook.Add("ACF_OnTick", "ACF Iterate Bullets", Ballistics.IterateBullets)
end

Bullets[Index] = Bullet
Expand Down
8 changes: 4 additions & 4 deletions lua/acf/core/classes/grouped.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function Classes.AddGroup(ID, Destiny, Data)
Group[K] = V
end

hook.Run("ACF_OnNewGroup", ID, Group)
hook.Run("ACF_OnCreateGroup", ID, Group)

return Group
end
Expand Down Expand Up @@ -58,7 +58,7 @@ function Classes.AddGroupItem(ID, GroupID, Destiny, Data)
Class[K] = V
end

hook.Run("ACF_OnNewGroupItem", ID, Group, Class)
hook.Run("ACF_OnCreateGroupItem", ID, Group, Class)

return Class
end
Expand Down Expand Up @@ -147,13 +147,13 @@ function Classes.AddGroupedFunctions(Namespace, Entries)
end
end

hook.Add("ACF_OnNewGroup", "ACF Precache Model", function(_, Group)
hook.Add("ACF_OnCreateGroup", "ACF Precache Model", function(_, Group)
if not isstring(Group.Model) then return end

util.PrecacheModel(Group.Model)
end)

hook.Add("ACF_OnNewGroupItem", "ACF Precache Model", function(_, _, Class)
hook.Add("ACF_OnCreateGroupItem", "ACF Precache Model", function(_, _, Class)
if not isstring(Class.Model) then return end

util.PrecacheModel(Class.Model)
Expand Down
4 changes: 2 additions & 2 deletions lua/acf/core/classes/object.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ local function AttachMetaTable(Class, Base)
Class:OnLoaded()
end

hook.Run("ACF_OnClassLoaded", Class.ID, Class)
hook.Run("ACF_OnLoadClass", Class.ID, Class)

Class.Loaded = true
end)
Expand Down Expand Up @@ -84,7 +84,7 @@ function Classes.AddObject(ID, Base, Destiny)
return Class
end

hook.Add("ACF_OnClassLoaded", "ACF Model Precache", function(_, Class)
hook.Add("ACF_OnLoadClass", "ACF Model Precache", function(_, Class)
if not isstring(Class.Model) then return end

util.PrecacheModel(Class.Model)
Expand Down
4 changes: 2 additions & 2 deletions lua/acf/core/classes/simple.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function Classes.AddSimple(ID, Destiny, Data)
Class[K] = V
end

hook.Run("ACF_OnNewItem", ID, Class)
hook.Run("ACF_OnCreateItem", ID, Class)

return Class
end
Expand Down Expand Up @@ -76,7 +76,7 @@ function Classes.AddSimpleFunctions(Namespace, Entries)
end
end

hook.Add("ACF_OnNewItem", "ACF Precache Model", function(_, Class)
hook.Add("ACF_OnCreateItem", "ACF Precache Model", function(_, Class)
if not isstring(Class.Model) then return end

util.PrecacheModel(Class.Model)
Expand Down
6 changes: 3 additions & 3 deletions lua/acf/core/networking/data_vars/data_vars_cl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -130,7 +130,7 @@ do -- Client data setter function
if Forced or Client[Key] ~= Value then
Client[Key] = Value

hook.Run("ACF_OnClientDataUpdate", LocalPlayer(), Key, Value)
hook.Run("ACF_OnUpdateClientData", LocalPlayer(), Key, Value)

NetworkData(Key)
end
Expand All @@ -150,7 +150,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
Expand Down
2 changes: 1 addition & 1 deletion lua/acf/core/networking/data_vars/data_vars_sv.lua
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,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
Expand Down
2 changes: 1 addition & 1 deletion lua/acf/core/utilities/clock/clock.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ hook.Add("Think", "ACF Clock Update", function()
Clock.DeltaTime = Delta
Clock.CurTime = Now

hook.Run("ACF_OnClock", New, Delta)
hook.Run("ACF_OnTick", New, Delta)
end)
2 changes: 1 addition & 1 deletion lua/acf/core/validation_sv.lua
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,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))
Expand Down
4 changes: 2 additions & 2 deletions lua/acf/entities/ammo_types/ap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function Ammo:GetDisplayData(Data)
MaxPen = self:GetPenetration(Data, Data.MuzzleVel)
}

hook.Run("ACF_GetDisplayData", self, Data, Display)
hook.Run("ACF_OnGetDisplayData", self, Data, Display)

return Display
end
Expand All @@ -42,7 +42,7 @@ function Ammo:UpdateRoundData(ToolData, Data, GUIData)
Data.DragCoef = Data.ProjArea * 0.0001 / Data.ProjMass
Data.CartMass = Data.PropMass + Data.ProjMass

hook.Run("ACF_UpdateRoundData", self, ToolData, Data, GUIData)
hook.Run("ACF_OnUpdateRound", self, ToolData, Data, GUIData)

for K, V in pairs(self:GetDisplayData(Data)) do
GUIData[K] = V
Expand Down
2 changes: 1 addition & 1 deletion lua/acf/entities/ammo_types/apcr.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function Ammo:UpdateRoundData(ToolData, Data, GUIData)
Data.DragCoef = Data.ProjArea * 0.0001 / Data.ProjMass
Data.CartMass = Data.PropMass + Data.ProjMass

hook.Run("ACF_UpdateRoundData", self, ToolData, Data, GUIData)
hook.Run("ACF_OnUpdateRound", self, ToolData, Data, GUIData)

for K, V in pairs(self:GetDisplayData(Data)) do
GUIData[K] = V
Expand Down
2 changes: 1 addition & 1 deletion lua/acf/entities/ammo_types/apds.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function Ammo:UpdateRoundData(ToolData, Data, GUIData)
Data.DragCoef = Data.ProjArea * 0.000125 / Data.ProjMass -- Worse drag (Manually fudged to make a meaningful difference)
Data.CartMass = Data.PropMass + Data.ProjMass + SabotMass

hook.Run("ACF_UpdateRoundData", self, ToolData, Data, GUIData)
hook.Run("ACF_OnUpdateRound", self, ToolData, Data, GUIData)

for K, V in pairs(self:GetDisplayData(Data)) do
GUIData[K] = V
Expand Down
2 changes: 1 addition & 1 deletion lua/acf/entities/ammo_types/apfsds.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function Ammo:UpdateRoundData(ToolData, Data, GUIData)
Data.DragCoef = Data.ProjArea * 0.0001 / Data.ProjMass
Data.CartMass = Data.PropMass + Data.ProjMass + SabotMass

hook.Run("ACF_UpdateRoundData", self, ToolData, Data, GUIData)
hook.Run("ACF_OnUpdateRound", self, ToolData, Data, GUIData)

for K, V in pairs(self:GetDisplayData(Data)) do
GUIData[K] = V
Expand Down
4 changes: 2 additions & 2 deletions lua/acf/entities/ammo_types/aphe.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function Ammo:GetDisplayData(Data)
Display.FragMass = FragMass / Display.Fragments
Display.FragVel = (Data.FillerMass * ACF.HEPower * 1000 / Display.FragMass / Display.Fragments) ^ 0.5

hook.Run("ACF_GetDisplayData", self, Data, Display)
hook.Run("ACF_OnGetDisplayData", self, Data, Display)

return Display
end
Expand All @@ -55,7 +55,7 @@ function Ammo:UpdateRoundData(ToolData, Data, GUIData)
Data.CartMass = Data.PropMass + Data.ProjMass
Data.FillerRatio = math.Clamp(ToolData.FillerRatio, 0, 1)

hook.Run("ACF_UpdateRoundData", self, ToolData, Data, GUIData)
hook.Run("ACF_OnUpdateRound", self, ToolData, Data, GUIData)

for K, V in pairs(self:GetDisplayData(Data)) do
GUIData[K] = V
Expand Down
4 changes: 2 additions & 2 deletions lua/acf/entities/ammo_types/fl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function Ammo:GetDisplayData(Data)
MaxPen = self:GetPenetration(Data, Data.MuzzleVel)
}

hook.Run("ACF_GetDisplayData", self, Data, Display)
hook.Run("ACF_OnGetDisplayData", self, Data, Display)

return Display
end
Expand All @@ -64,7 +64,7 @@ function Ammo:UpdateRoundData(ToolData, Data, GUIData)
Data.MuzzleVel = ACF.MuzzleVelocity(Data.PropMass, Data.ProjMass, Data.Efficiency)
Data.CartMass = Data.PropMass + Data.ProjMass

hook.Run("ACF_UpdateRoundData", self, ToolData, Data, GUIData)
hook.Run("ACF_OnUpdateRound", self, ToolData, Data, GUIData)

for K, V in pairs(self:GetDisplayData(Data)) do
GUIData[K] = V
Expand Down
4 changes: 2 additions & 2 deletions lua/acf/entities/ammo_types/he.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function Ammo:GetDisplayData(Data)
FragVel = (Data.FillerMass * ACF.HEPower * 1000 / (FragMass / Fragments) / Fragments) ^ 0.5,
}

hook.Run("ACF_GetDisplayData", self, Data, Display)
hook.Run("ACF_OnGetDisplayData", self, Data, Display)

return Display
end
Expand All @@ -47,7 +47,7 @@ function Ammo:UpdateRoundData(ToolData, Data, GUIData)
Data.DragCoef = Data.ProjArea * 0.0001 / Data.ProjMass
Data.CartMass = Data.PropMass + Data.ProjMass

hook.Run("ACF_UpdateRoundData", self, ToolData, Data, GUIData)
hook.Run("ACF_OnUpdateRound", self, ToolData, Data, GUIData)

for K, V in pairs(self:GetDisplayData(Data)) do
GUIData[K] = V
Expand Down
4 changes: 2 additions & 2 deletions lua/acf/entities/ammo_types/heat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function Ammo:GetDisplayData(Data)
FragVel = (Data.BoomFillerMass * ACF.HEPower * 1000 / Data.CasingMass) ^ 0.5,
}

hook.Run("ACF_GetDisplayData", self, Data, Display)
hook.Run("ACF_OnGetDisplayData", self, Data, Display)

return Display
end
Expand Down Expand Up @@ -137,7 +137,7 @@ function Ammo:UpdateRoundData(ToolData, Data, GUIData)
Data.DragCoef = Data.ProjArea * 0.0001 / Data.ProjMass
Data.CartMass = Data.PropMass + Data.ProjMass

hook.Run("ACF_UpdateRoundData", self, ToolData, Data, GUIData)
hook.Run("ACF_OnUpdateRound", self, ToolData, Data, GUIData)

-- Recalculate the standoff for missiles
if Data.MissileStandoff then
Expand Down
2 changes: 1 addition & 1 deletion lua/acf/entities/ammo_types/heatfs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function Ammo:UpdateRoundData(ToolData, Data, GUIData)
Data.DragCoef = Data.ProjArea * 0.0001 / Data.ProjMass
Data.CartMass = Data.PropMass + Data.ProjMass

hook.Run("ACF_UpdateRoundData", self, ToolData, Data, GUIData)
hook.Run("ACF_OnUpdateRound", self, ToolData, Data, GUIData)

-- Recalculate the standoff for missiles
if Data.MissileStandoff then
Expand Down
4 changes: 2 additions & 2 deletions lua/acf/entities/ammo_types/hp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function Ammo:GetDisplayData(Data)

Display.MaxKETransfert = Energy.Kinetic * Data.ShovePower

hook.Run("ACF_GetDisplayData", self, Data, Display)
hook.Run("ACF_OnGetDisplayData", self, Data, Display)

return Display
end
Expand All @@ -42,7 +42,7 @@ function Ammo:UpdateRoundData(ToolData, Data, GUIData)
Data.DragCoef = Data.ProjArea * 0.0001 / Data.ProjMass
Data.CartMass = Data.PropMass + Data.ProjMass

hook.Run("ACF_UpdateRoundData", self, ToolData, Data, GUIData)
hook.Run("ACF_OnUpdateRound", self, ToolData, Data, GUIData)

for K, V in pairs(self:GetDisplayData(Data)) do
GUIData[K] = V
Expand Down
4 changes: 2 additions & 2 deletions lua/acf/entities/ammo_types/smoke.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function Ammo:GetDisplayData(Data)
WPRadiusMax = math.Round(WPFiller * 1.25 * 2 * 0.0254, 2),
}

hook.Run("ACF_GetDisplayData", self, Data, Display)
hook.Run("ACF_OnGetDisplayData", self, Data, Display)

return Display
end
Expand All @@ -62,7 +62,7 @@ function Ammo:UpdateRoundData(ToolData, Data, GUIData)
Data.DragCoef = Data.ProjArea * 0.0001 / Data.ProjMass
Data.CartMass = Data.PropMass + Data.ProjMass

hook.Run("ACF_UpdateRoundData", self, ToolData, Data, GUIData)
hook.Run("ACF_OnUpdateRound", self, ToolData, Data, GUIData)

for K, V in pairs(self:GetDisplayData(Data)) do
GUIData[K] = V
Expand Down
20 changes: 10 additions & 10 deletions lua/acf/hooks/hooks_sh.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,28 @@ Hooks.Add("ACF_Base_Shared", function(Gamemode)
--- Called when a class group object is created, not necessarily for the first time.
-- @param ID The ID of the group that was registered.
-- @param Group The group object that was registered.
function Gamemode:ACF_OnNewGroup()
function Gamemode:ACF_OnCreateGroup()
end

--- Called when a grouped item object is created, not necessarily for the first time.
-- Important to not the GroupID has to reference an actually existing class group object.
-- @param ID The ID of the group item that was registered.
-- @param GroupID The ID of the group where the item was registered.
-- @param Item The item object that was registered.
function Gamemode:ACF_OnNewGroupItem()
function Gamemode:ACF_OnCreateGroupItem()
end

--- Called when a standalone item object is created, not necessarily for the first time.
-- @param ID The ID of the standalone item that was registered.
-- @param Group The item object that was registered.
function Gamemode:ACF_OnNewItem()
function Gamemode:ACF_OnCreateItem()
end

--- Called when a class object is fully created and loaded.
-- This will not be instant on startup since the object has to wait for the base objects to load.
-- @param ID The ID of the object class that has been loaded.
-- @param Class The object class that has been loaded.
function Gamemode:ACF_OnClassLoaded()
function Gamemode:ACF_OnLoadClass()
end

--- Called when a server data variable value gets updated.
Expand All @@ -40,7 +40,7 @@ Hooks.Add("ACF_Base_Shared", function(Gamemode)
-- On the serverside, if the change was done by the server then this will always be nil.
-- @param Key The name of the affected server data variable.
-- @param Value The new value assigned to the server data variable.
function Gamemode:ACF_OnServerDataUpdate()
function Gamemode:ACF_OnUpdateServerData()
end

--- Called when a client data variable value gets updated.
Expand All @@ -50,23 +50,23 @@ Hooks.Add("ACF_Base_Shared", function(Gamemode)
-- @param Player The player that triggered the client data variable change.
-- @param Key The name of the affected client data variable.
-- @param Value The new value assigned to the client data variable.
function Gamemode:ACF_OnClientDataUpdate()
function Gamemode:ACF_OnUpdateClientData()
end

--- Called after the Think hook is called.
-- The only difference with the Think hook are the convenience arguments provided by this one.
-- @param CurTime Returns the uptime of the server.
-- @param DeltaTime Returns the delay between this hook's call and the previous.
-- This value will usually be similar if not the same as the server tickrate.
function Gamemode:ACF_OnClock()
function Gamemode:ACF_OnTick()
end

--- Called when an ammo type has to provide its display information.
-- The information is only used by the spawn menu and hint bubble on entities.
-- @param AmmoType The ammo type object requesting its display information.
-- @param Bullet The bullet object being used to get display information.
-- @param GUIData The display information table itself.
function Gamemode:ACF_GetDisplayData()
function Gamemode:ACF_OnGetDisplayData()
end

--- Called when a bullet object is created or updated.
Expand All @@ -75,7 +75,7 @@ Hooks.Add("ACF_Base_Shared", function(Gamemode)
-- @param Bullet The bullet object itself.
-- @param GUIData The table of information that's only required for the clientside, such as the menu.
-- On the serverside, this will be the same as the Bullet object.
function Gamemode:ACF_UpdateRoundData()
function Gamemode:ACF_OnUpdateRound()
end

--- Called every time a scalable entity is resized.
Expand All @@ -84,6 +84,6 @@ Hooks.Add("ACF_Base_Shared", function(Gamemode)
-- @param Size The new size of the entity.
-- @param Scale The new scale of the entity.
-- This is based off the size of the model the entity it's using and the scale that was given.
function Gamemode:ACF_OnEntityResized()
function Gamemode:ACF_OnResizeEntity()
end
end)
Loading

0 comments on commit 272299a

Please sign in to comment.