1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-12-28 15:55:51 +00:00

Add node_setActivationRange()

This commit is contained in:
fgenesis 2015-06-28 18:55:35 +02:00
parent f6fc75a165
commit eb56a93200
4 changed files with 12 additions and 3 deletions

View file

@ -42,8 +42,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
std::vector<std::string> 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))
{

View file

@ -54,6 +54,7 @@ Path::Path()
warpType = 0;
spiritFreeze = true;
pauseFreeze = true;
activationRange = 800;
}
void Path::clampPosition(Vector *pos, float radius)

View file

@ -145,6 +145,7 @@ public:
bool pauseFreeze;
PathShape pathShape;
float activationRange;
void parseWarpNodeData(const std::string &dataString);

View file

@ -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),