diff --git a/lua/starfall/libs_cl/gwater2module.lua b/lua/starfall/libs_cl/gwater2module.lua index 3003a39..383b5a4 100644 --- a/lua/starfall/libs_cl/gwater2module.lua +++ b/lua/starfall/libs_cl/gwater2module.lua @@ -47,7 +47,7 @@ local function main(instance) -- @param number value function gwater_library.setParameter(parameter, value) if LocalPlayer() == instance.player then - SetGwaterParameter(parameter, value) + gwater2.solver:SetParameter(parameter, value) end end @@ -60,6 +60,26 @@ local function main(instance) return gwater2.solver:GetParameter(parameter) end end + + --- Applies a force field to GWater particles + -- @client + -- @param Vector pos The position of the force field + -- @param number radius The radius of the force field + -- @param number strength The strength of the force field + -- @param number mode The mode of the force field. 0 = Attraction, 1 = Repulsion, 2 = Vortex + -- @param boolean linear Whether the force field should be the same strength regardless of distance + function gwater_library.applyForceField(pos, radius, strength, mode, linear) + if LocalPlayer() == instance.player then + gwater2.solver:AddForceField(vunwrap(pos), radius, strength, mode, linear) + end + end + + --- Called before the GWater solver ticks + -- You should use this hook to apply forces to the particles + -- @name gwater2_pretick + -- @class hook + -- @client + SF.hookAdd("gwater2_pretick") end return main