1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-11-15 22:19:07 +00:00

Little script interface changes:

- Add avatar_isSwimming()
- toggleInput() does now parse bools correctly
- pickupGem() returns gem ID
- Change in entity_doCollisionAvoidance():
  * Add support for ignore obs
  * One arg was shifted, this is now fixed but not sure if it adds a problem somewhere.
This commit is contained in:
fgenesis 2013-08-28 04:20:36 +02:00
parent a7447cc599
commit 01d9211a34

View file

@ -3090,6 +3090,11 @@ luaFunc(avatar_isRolling)
luaReturnBool(dsq->game->avatar->isRolling()); luaReturnBool(dsq->game->avatar->isRolling());
} }
luaFunc(avatar_isSwimming)
{
luaReturnBool(dsq->game->avatar->isSwimming());
}
luaFunc(avatar_isOnWall) luaFunc(avatar_isOnWall)
{ {
bool v = dsq->game->avatar->state.lockedToWall; bool v = dsq->game->avatar->state.lockedToWall;
@ -5672,13 +5677,14 @@ luaFunc(entity_doCollisionAvoidance)
int useVel2 = lua_tonumber(L, 6); int useVel2 = lua_tonumber(L, 6);
bool onlyVP = getBool(L, 7); bool onlyVP = getBool(L, 7);
int ignoreObs = lua_tointeger(L, 8);
if (e) if (e)
{ {
if (useVel2) if (useVel2)
ret = e->doCollisionAvoidance(lua_tonumber(L, 2), lua_tointeger(L, 3), lua_tonumber(L, 4), &e->vel2, lua_tonumber(L, 5), onlyVP); ret = e->doCollisionAvoidance(lua_tonumber(L, 2), lua_tointeger(L, 3), lua_tonumber(L, 4), &e->vel2, lua_tonumber(L, 5), ignoreObs, onlyVP);
else else
ret = e->doCollisionAvoidance(lua_tonumber(L, 2), lua_tointeger(L, 3), lua_tonumber(L, 4), 0, lua_tonumber(L, 5)); ret = e->doCollisionAvoidance(lua_tonumber(L, 2), lua_tointeger(L, 3), lua_tonumber(L, 4), 0, lua_tonumber(L, 5), ignoreObs);
} }
luaReturnBool(ret); luaReturnBool(ret);
} }
@ -5794,7 +5800,7 @@ luaFunc(entity_followEntity)
luaFunc(toggleInput) luaFunc(toggleInput)
{ {
int v = lua_tointeger(L, 1); bool v = getBool(L, 1);
if (v) if (v)
dsq->game->avatar->enableInput(); dsq->game->avatar->enableInput();
else else
@ -7716,7 +7722,7 @@ luaFunc(entity_setWeight)
luaFunc(pickupGem) luaFunc(pickupGem)
{ {
dsq->continuity.pickupGem(getString(L), !getBool(L, 2)); dsq->continuity.pickupGem(getString(L), !getBool(L, 2));
luaReturnNil(); luaReturnInt(dsq->continuity.gems.size() - 1);
} }
luaFunc(setGemPosition) luaFunc(setGemPosition)
@ -8860,6 +8866,7 @@ static const struct {
luaRegister(avatar_isBursting), luaRegister(avatar_isBursting),
luaRegister(avatar_isLockable), luaRegister(avatar_isLockable),
luaRegister(avatar_isRolling), luaRegister(avatar_isRolling),
luaRegister(avatar_isSwimming),
luaRegister(avatar_isOnWall), luaRegister(avatar_isOnWall),
luaRegister(avatar_isShieldActive), luaRegister(avatar_isShieldActive),
luaRegister(avatar_setShieldActive), luaRegister(avatar_setShieldActive),