diff --git a/Aquaria/Avatar.cpp b/Aquaria/Avatar.cpp index dd2cb05..e4b8bad 100644 --- a/Aquaria/Avatar.cpp +++ b/Aquaria/Avatar.cpp @@ -2158,7 +2158,8 @@ void Avatar::loseTargets() void Avatar::updateTargetQuads(float dt) { - particleManager->setSuckPosition(1, dsq->getGameCursorPosition()); + const Vector cursorpos = dsq->getGameCursorPosition(); + particleManager->setSuckPosition(1, cursorpos); /* for (int i = 0; i < targetQuads.size(); i++) @@ -2189,7 +2190,8 @@ void Avatar::updateTargetQuads(float dt) targets[i].pos = e->getTargetPoint(targets[i].targetPt); if (i == 0) { - particleManager->setSuckPosition(1, targets[i].pos); + particleManager->setSuckPosition(1, targets[i].pos); // suckpos 1 is overridden elsewhere later + particleManager->setSuckPosition(2, targets[i].pos); } /* @@ -2202,7 +2204,7 @@ void Avatar::updateTargetQuads(float dt) } else { - targetQuads[i]->position = dsq->getGameCursorPosition(); + targetQuads[i]->position = cursorpos; //targetQuads[i]->alpha.interpolateTo(0, 0.1); } } @@ -2222,7 +2224,7 @@ void Avatar::updateTargetQuads(float dt) debugLog(os.str()); */ - targetQuads[i]->position = dsq->getGameCursorPosition(); + targetQuads[i]->position = cursorpos; if (dsq->continuity.form == FORM_ENERGY && isInputEnabled()) { if (dsq->inputMode == INPUT_JOYSTICK && targetQuads[i]->isRunning()) diff --git a/Aquaria/ScriptInterface.cpp b/Aquaria/ScriptInterface.cpp index 5f53ff2..12ada91 100644 --- a/Aquaria/ScriptInterface.cpp +++ b/Aquaria/ScriptInterface.cpp @@ -3021,6 +3021,27 @@ luaFunc(spawnParticleEffect) luaReturnPtr(pe); } +luaFunc(setNumSuckPositions) +{ + particleManager->setNumSuckPositions(lua_tointeger(L, 0)); + luaReturnNil(); +} + +luaFunc(setSuckPosition) +{ + particleManager->setSuckPosition(lua_tointeger(L, 0), Vector(lua_tonumber(L, 1), lua_tonumber(L, 2))); + luaReturnNil(); +} + +luaFunc(getSuckPosition) +{ + Vector *v = particleManager->getSuckPosition(lua_tointeger(L, 0)); + if(v) + luaReturnVec2(v->x, v->y); + luaReturnVec2(0.0f, 0.0f); +} + + luaFunc(bone_showFrame) { Bone *b = bone(L); @@ -6958,7 +6979,7 @@ luaFunc(entity_getHair) luaFunc(entity_clearHair) { Entity *e = entity(L); - if (e) + if (e && e->hair) { e->hair->safeKill(); e->hair = 0; @@ -8157,6 +8178,9 @@ static const struct { luaRegister(resetTimer), luaRegister(addInfluence), + luaRegister(setSuckPosition), + luaRegister(setSuckPosition); + luaRegister(setNumSuckPositions), luaRegister(setupBasicEntity), luaRegister(playMusic), luaRegister(playMusicStraight),