-
-
Save v1ld/a79e2b85290074aa4e95b87104ee7a5f to your computer and use it in GitHub Desktop.
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
-- simple extension to Smurth's shoot_effects code to bring back a feature | |
-- from Rulix's original mod: allow setting up weapon equivalences in wpn_fx | |
-- modify shoot_effect actor_effects.script to include: | |
function shoot_effect(wpn) | |
-- only showing the code that matters | |
local sect = wpn:section() | |
if not wpn_fx[sect] then | |
return | |
elseif type(wpn_fx[sect]) ~= "table" then | |
local seen = {} | |
local lookup = sect | |
while type(wpn_fx[lookup]) == "string" and not seen[lookup] do | |
seen[lookup] = true | |
lookup = wpn_fx[lookup] | |
end | |
-- cache results, this is called on every shot | |
-- non-table value means looping definition or bad/missing entry | |
if type(wpn_fx[lookup]) ~= "table" then | |
wpn_fx[sect] = nil | |
return | |
else | |
wpn_fx[sect] = wpn_fx[lookup] | |
end | |
end | |
-- etc. | |
end | |
-- now instead of this in actor_effects_data.script | |
-- where these 3 guns have the same anims | |
wpn_fx = { | |
-- | |
-- 9x18mm | |
-- | |
wpn_aek919k = { | |
s = {1, 2}, | |
r = 1, | |
e = { {1.7}, {0.6}, {0.8, 1}, {4, 0}, {2.1, 0}, {0} }, | |
p = {}, | |
}, | |
wpn_pm = { | |
s = {1, 2}, | |
r = 1, | |
e = { {1.7}, {0.6}, {0.8, 1}, {4, 0}, {2.1, 0}, {0} }, | |
p = {}, | |
}, | |
wpn_pm_actor = { | |
s = {1, 2}, | |
r = 1, | |
e = { {1.7}, {0.6}, {0.8, 1}, {4, 0}, {2.1, 0}, {0} }, | |
p = {}, | |
}, | |
} | |
-- you can instead do this | |
wpn_fx = { | |
-- | |
-- 9x18mm | |
-- | |
wpn_aek919k = "wpn_pm", | |
wpn_pm = { | |
s = {1, 2}, | |
r = 1, | |
e = { {1.7}, {0.6}, {0.8, 1}, {4, 0}, {2.1, 0}, {0} }, | |
p = {}, | |
}, | |
wpn_pm_actor = "wpn_pm", | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment