-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
For the moment, this only serves as a wrapper for util.Effect, but it should be possible to expand upon this in the future for more advanced effects. Also includes the hook ACF_PreCreateEffect in order to allow for effect overrides as requested in #321
- Loading branch information
1 parent
977a944
commit 28916bc
Showing
14 changed files
with
212 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
local ACF = ACF | ||
local Effects = ACF.Utilities.Effects | ||
|
||
do | ||
--- Creates effects based on util.Effect with ACF-specific functionality. | ||
--- @param EffectName string The name of the effect to create | ||
--- @param EffectTable table The table containing all of the parameters for the effect (case-sensitive) | ||
--- @param AllowOverride? boolean Whether Lua-defined effects should override engine-defined effects | ||
--- @param Filter? any Can be either a boolean to ignore the prediction filter or a CRecipientFilter | ||
function Effects.CreateEffect(EffectName, EffectTable, AllowOverride, Filter) | ||
if not EffectName or not EffectTable then return end | ||
|
||
local Effect = EffectData() | ||
|
||
local NewName, NewTable = hook.Run("ACF_PreCreateEffect", EffectName, EffectTable) | ||
EffectName = NewName or EffectName | ||
EffectTable = NewTable or EffectTable | ||
|
||
-- Set values for all possible valid CEffectData attributes present in EffectTable | ||
for Name, Value in pairs(EffectTable) do | ||
local EffectFunc = Effect["Set" .. Name] | ||
if not EffectFunc then continue end | ||
|
||
EffectFunc(Effect, Value) | ||
end | ||
|
||
util.Effect(EffectName, Effect, AllowOverride, Filter) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.