From 61826746187adba02d2d6c891abd0268ceeaebf1 Mon Sep 17 00:00:00 2001 From: fgenesis Date: Mon, 22 Apr 2013 01:15:20 +0200 Subject: [PATCH] Add createShockEffect() Lua function and rename castSong() to singSong(). castSong() existing in the global Lua namespace caused it to be removed and stored as an interface function as soon as a script was loaded. The function was apparently never used in the game or other mod scripts, thus renaming it now should be safe. --- Aquaria/ScriptInterface.cpp | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/Aquaria/ScriptInterface.cpp b/Aquaria/ScriptInterface.cpp index 2606cec..7565a66 100644 --- a/Aquaria/ScriptInterface.cpp +++ b/Aquaria/ScriptInterface.cpp @@ -34,6 +34,7 @@ extern "C" #include "Entity.h" #include "Web.h" #include "GridRender.h" +#include "AfterEffect.h" #include "../BBGE/MathFunctions.h" @@ -1701,7 +1702,11 @@ luaFunc(hasFormUpgrade) luaReturnBool(dsq->continuity.hasFormUpgrade((FormUpgradeType)lua_tointeger(L, 1))); } -luaFunc(castSong) +// this used to be castSong(), but that name is already taken by an interface function. +// For compatibility, at the end of the Lua function table this is registered as +// castSong() as well, so that scripts/mods not using the castSong() interface function +// in songs.lua will work as expected. -- FG +luaFunc(singSong) { dsq->continuity.castSong(lua_tonumber(L, 1)); luaReturnNil(); @@ -5373,6 +5378,22 @@ luaFunc(playNoEffect) luaReturnNil(); } +luaFunc(createShockEffect) +{ + if (core->afterEffectManager) + { + core->afterEffectManager->addEffect(new ShockEffect( + Vector(lua_tonumber(L, 1), lua_tonumber(L, 2)), // position + Vector(lua_tonumber(L, 3), lua_tonumber(L, 4)), // original position + lua_tonumber(L, 5), // amplitude + lua_tonumber(L, 6), // amplitude decay + lua_tonumber(L, 7), // frequency + lua_tonumber(L, 8), // wave length + lua_tonumber(L, 9))); // time multiplier + } + luaReturnNil(); +} + luaFunc(emote) { int emote = lua_tonumber(L, 1); @@ -7837,6 +7858,7 @@ static const struct { luaRegister(playVisualEffect), luaRegister(playNoEffect), + luaRegister(createShockEffect), luaRegister(setOverrideMusic), @@ -7949,7 +7971,7 @@ static const struct { luaRegister(hasFormUpgrade), - luaRegister(castSong), + luaRegister(singSong), luaRegister(isObstructed), luaRegister(isObstructedBlock), luaRegister(getObstruction), @@ -8344,6 +8366,8 @@ static const struct { {"bone_setColor", l_bone_color}, + {"castSong", l_singSong}, + }; //============================================================================================