Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge hook-docs branch #430

Merged
merged 41 commits into from
Jan 15, 2025
Merged

Merge hook-docs branch #430

merged 41 commits into from
Jan 15, 2025

Conversation

TwistedTail
Copy link
Member

Besides testing any possible issues we might have overlooked, this pull request is meant to be used as an announcement for this upcoming change.

  • If you happen to have an extension that relies on ACF hooks, you will be affected by these changes.
  • If you happen to have an extension that adds ACF hooks, you should consider using the same naming convention as us.

TLDR: Most, if not all, hooks were renamed to follow a strict naming convention: ACF_[Pre/On/Post][ACTION][ACTOR].

To go a little bit more in-depth, we want to make sure hooks remain consistent in both the way they're written and the way they're employed. All our hooks will use PascalCase for the capitalization and begin with the ACF_ prefix.

After that, you have to choose between Pre, On and Post for the moment in which this hook is being called. Pre implies the action hasn't happened yet, as such you should be able to stop it from happening with this hook. On means the action is about to happen, you shouldn't be able to stop it by now. Post means the action has already happened.

Following that, you need to add your ACTION, this needs to be a verb in present tense.

You end up with the ACTOR of the hook, this will be the thing affected by the action.

TwistedTail and others added 30 commits October 23, 2022 23:11
- Using the Hook library, all ACF hooks have been loaded onto the gamemode table.
- Replaced use of hook.Call with hook.Run
- Added serverside ACF_PlayerChangedZone and ACF_ProtectionModeChanged hooks to the gamemode table.
- Removed ACF_OnReceivedModelData and ACF_OnRequestedModelData hooks as they had pretty much no use outside of their niche.
- Renamed ModelData.QueueRefresh to ModelData.CallOnReceive for better understanding of what the function does.
- Added ModelData.RunCallbacks function.
- The hook has been renamed to ACF_OnRepositoryFetch
- Renamed ACF_AllowMenuOption to ACF_OnMenuOptionEnable.
- Renamed ACF_AllowMenuItem to ACF_OnMenuItemEnable.
- Both hooks will no longer receive the order index as the first argument as it served no use.
- All hooks used by ACF will have to follow the pattern: ACF_[Pre/On/Post][Action in present tense][Affected].
- Added clientside ACF_PreLoadClientSettings hook.
- Added clientside ACF_PreLoadServerSettings hook.
- Added clientside ACF_PostLoadClientSettings.
- Added ACF_PostLoadServerSettings hook.
- Renamed ACF_OnRepositoryFetch to ACF_OnFetchRepository.
- Renamed ACF_OnMenuOptionEnable to ACF_OnEnableMenuOption.
- Renamed ACF_OnMenuItemEnable to ACF_OnEnableMenuItem.
- Renamed ACF_OnClientSettingsLoaded to ACF_OnLoadClientSettings.
- Renamed ACF_OnServerSettingsLoaded to ACF_OnLoadServerSettings.
- Updated all existing menu creation hooks to the current naming convention standard.
- ACF.CreateAmmoMenu and ACF.UpdateAmmoMenu functions will no longer have a second argument for Settings, as the functionality of these has been replaced with hooks.
- Added clientside “ACF_OnCreateAmmoMenu” hook.
- Added clientside “ACF_PreCreateAmmoPreview” hook.
- Added clientside “ACF_PreCreateTracerControls” hook.
- Added clientside “ACF_OnCreateTracerControls” hook.
- Added clientside “ACF_PreCreateAmmoInformation” hook.
- Added clientside “ACF_PreCreateCrateInformation” hook.
- Renamed clientside “ACF_SetupAmmoMenuSettings” hook to “ACF_PreCreateAmmoMenu”.
- Renamed clientside “ACF_AddAmmoPreview” hook to “ACF_OnCreateAmmoPreview”.
- Renamed clientside “ACF_OnAmmoControlsCreate” hook to “ACF_OnCreateAmmoControls”.
- Renamed clientside “ACF_AddCrateDataTrackers” hook to “ACF_OnCreateCrateInformation”.
- Renamed clientside “ACF_AddAmmoInformation” hook to “ACF_OnCreateAmmoInformation”.
- Renamed ACF_BulletEffect hook to ACF_OnCreateBulletEffect.
- The hook will no longer receive the ammo type as the only argument, instead it'll receive the effect itself and the bullet data used by it.
- The hook will no longer have to return a function to override EFFECT.ApplyMovement, since it can now do it within itself.
- Renamed ACF_DrawBoxes hook to ACF_OnDrawBoxes.
- Renamed ACF_OnAddonLoaded hook to ACF_OnLoadAddon
- Renamed ACF_OnRequestedModelData to ACF_OnRequestModelData
- Renamed ACF_OnReceivedModelData to ACF_OnReceiveModelData
- 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
- ACF_OnPlayerLoaded => ACF_OnLoadPlayer
- ACF_IsLegal => ACF_OnCheckLegal
- ACF_KEShove => ACF_OnPushEntity
Also added documentation for a few hooks that have been added in the meantime
- Changed some hooks explicitly comparing to boolean values despite they now have an explicit default value if unused/none given.
@thecraftianman
Copy link
Member

Closes #159

lua/acf/hooks/hooks_sv.lua Outdated Show resolved Hide resolved
lua/acf/hooks/hooks_sv.lua Outdated Show resolved Hide resolved
lua/acf/hooks/hooks_sv.lua Outdated Show resolved Hide resolved
thecraftianman and others added 10 commits December 5, 2024 13:09
- Removed GM:ACF_CanUpdateEntity as GM:ACF_PreUpdateEntity does the exact same except with more arguments.
- Removed GM:ACF_CanCreateEntity as it serves a similar purpose than GM:PlayerSpawnSENT.
Also added docs for ACF_OnLoadPersistedData
ACF_OnGetDisplayData -> ACF_OnRequestDisplayData
ACF_[Pre/On]Entity[Spawn/Update] -> ACF_[Pre/On][Spawn/Update]Entity
@thecraftianman
Copy link
Member

Everything finally appears to be relatively in order with both this branch and the corresponding one on the Missiles repo, so I'm pushing this to dev so that we can verify this doesn't contain any (internally) breaking changes before the final release.

@thecraftianman thecraftianman merged commit 4041771 into dev Jan 15, 2025
3 checks passed
thecraftianman added a commit that referenced this pull request Jan 22, 2025
Fixes the weapons menus being broken after merging #430
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants