From 36c409e1d436b31b60d55ccf5d8d9103fd7d2220 Mon Sep 17 00:00:00 2001 From: fgenesis Date: Sat, 28 Sep 2013 17:21:11 +0200 Subject: [PATCH] Little things: - Make ACTION_LOOK and ACTION_ROLL available to handle via nodes - Add entity_getPushVec() - Fix typo in beam_setFirer() - Add pull param to addInfluence() - Add entity_getPushDamage() - Add getMouseWheelChange() --- Aquaria/Entity.h | 3 +++ Aquaria/Game.cpp | 5 +++++ Aquaria/ScriptInterface.cpp | 26 +++++++++++++++++++++++++- 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/Aquaria/Entity.h b/Aquaria/Entity.h index f99cc59..190ad3b 100644 --- a/Aquaria/Entity.h +++ b/Aquaria/Entity.h @@ -495,6 +495,9 @@ public: void updateSoundPosition(); + Vector getPushVec() const { return pushVec; } + float getPushDamage() const { return pushDamage; } + protected: bool calledEntityDied; Path *waterBubble; diff --git a/Aquaria/Game.cpp b/Aquaria/Game.cpp index 301d1f6..fcd5252 100644 --- a/Aquaria/Game.cpp +++ b/Aquaria/Game.cpp @@ -6692,7 +6692,10 @@ void Game::applyState() } if(cookingScript) + { dsq->scriptInterface.closeScript(cookingScript); + cookingScript = NULL; + } if (dsq->mod.isActive()) cookingScript = dsq->scriptInterface.openScript(dsq->mod.getPath() + "scripts/cooking.lua", true); @@ -6913,6 +6916,8 @@ void Game::bindInput() dsq->user.control.actionSet.importAction(this, "Revert", ACTION_REVERT); + dsq->user.control.actionSet.importAction(this, "Look", ACTION_LOOK); + dsq->user.control.actionSet.importAction(this, "Roll", ACTION_ROLL); if (avatar) avatar->bindInput(); diff --git a/Aquaria/ScriptInterface.cpp b/Aquaria/ScriptInterface.cpp index 435f921..6b413be 100644 --- a/Aquaria/ScriptInterface.cpp +++ b/Aquaria/ScriptInterface.cpp @@ -2332,6 +2332,15 @@ luaFunc(entity_clearVel) } // end extra Entity::vel functions +luaFunc(entity_getPushVec) +{ + Entity *e = entity(L); + Vector v; + if (e) + v = e->getPushVec(); + luaReturnVec2(v.x, v.y); +} + luaFunc(entity_addIgnoreShotDamageType) { Entity *e = entity(L); @@ -4186,7 +4195,7 @@ luaFunc(beam_setFirer) { Beam *b = beam(L); if (b) - b->setFirer(entity(L)); + b->setFirer(entity(L, 2)); luaReturnNil(); } @@ -6171,6 +6180,7 @@ luaFunc(addInfluence) pinf.pos.y = lua_tonumber(L, 2); pinf.size = lua_tonumber(L, 3); pinf.spd = lua_tonumber(L, 4); + pinf.pull = getBool(L, 5); dsq->particleManager->addInfluence(pinf); luaReturnNil(); } @@ -6583,6 +6593,12 @@ luaFunc(entity_pushTarget) luaReturnNil(); } +luaFunc(entity_getPushDamage) +{ + Entity *e = entity(L); + luaReturnNum(e ? e->getPushDamage() : 0.0f); +} + luaFunc(watch) { float t = lua_tonumber(L, 1); @@ -7766,6 +7782,11 @@ luaFunc(getMouseWorldPos) luaReturnVec2(v.x, v.y); } +luaFunc(getMouseWheelChange) +{ + luaReturnNum(core->mouse.scrollWheelChange); +} + luaFunc(fade) { dsq->overlay->color.interpolateTo(Vector(lua_tonumber(L, 3), lua_tonumber(L, 4), lua_tonumber(L, 5)), lua_tonumber(L, 6)); @@ -8696,6 +8717,7 @@ static const struct { luaRegister(setMousePos), luaRegister(getMousePos), luaRegister(getMouseWorldPos), + luaRegister(getMouseWheelChange), luaRegister(resetContinuity), @@ -8756,6 +8778,7 @@ static const struct { luaRegister(entity_getHealth), luaRegister(entity_getMaxHealth), luaRegister(entity_pushTarget), + luaRegister(entity_getPushDamage), luaRegister(entity_msg), luaRegister(node_msg), luaRegister(entity_updateMovement), @@ -9330,6 +9353,7 @@ static const struct { luaRegister(entity_getVel2), luaRegister(entity_clearVel2), + luaRegister(entity_getPushVec), luaRegister(updateMusic),