diff --git a/Aquaria/Game.cpp b/Aquaria/Game.cpp index 1b35de4..159bb4c 100644 --- a/Aquaria/Game.cpp +++ b/Aquaria/Game.cpp @@ -42,8 +42,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. std::vector allowedMaps; -const int PATH_ACTIVATION_RANGE = 800; - Vector worldLeftCenter(217,250), worldRightCenter(575, 250); Vector opt_save_original = Vector(350, 350), opt_cancel_original = Vector(450, 350); @@ -10369,7 +10367,7 @@ void Game::update(float dt) { Vector diff = p->nodes[0].position - dsq->game->avatar->position; - if (p->isCoordinateInside(dsq->game->avatar->position) || diff.getSquaredLength2D() < sqr(PATH_ACTIVATION_RANGE)) + if (p->isCoordinateInside(dsq->game->avatar->position) || diff.getSquaredLength2D() < sqr(p->activationRange)) { //if (trace(avatar->position, p->nodes[0].position)) { diff --git a/Aquaria/Path.cpp b/Aquaria/Path.cpp index 1e4852e..5763e91 100644 --- a/Aquaria/Path.cpp +++ b/Aquaria/Path.cpp @@ -54,6 +54,7 @@ Path::Path() warpType = 0; spiritFreeze = true; pauseFreeze = true; + activationRange = 800; } void Path::clampPosition(Vector *pos, float radius) diff --git a/Aquaria/Path.h b/Aquaria/Path.h index a5e53c7..170ff65 100644 --- a/Aquaria/Path.h +++ b/Aquaria/Path.h @@ -145,6 +145,7 @@ public: bool pauseFreeze; PathShape pathShape; + float activationRange; void parseWarpNodeData(const std::string &dataString); diff --git a/Aquaria/ScriptInterface.cpp b/Aquaria/ScriptInterface.cpp index bb40610..424e630 100644 --- a/Aquaria/ScriptInterface.cpp +++ b/Aquaria/ScriptInterface.cpp @@ -5006,6 +5006,14 @@ luaFunc(node_setCursorActivation) luaReturnNil(); } +luaFunc(node_setActivationRange) +{ + Path *p = path(L); + if(p) + p->activationRange = lua_tonumber(L, 2); + luaReturnNil(); +} + luaFunc(node_setCatchActions) { Path *p = path(L); @@ -10053,6 +10061,7 @@ static const struct { luaRegister(entity_isName), + luaRegister(node_setActivationRange), luaRegister(node_setCursorActivation), luaRegister(node_setCatchActions),