mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-12-25 14:15:46 +00:00
Make avatar respect maxspeed lerp, allow changing speed multiplier via script. Some extra functions.
Add one additional not-timed speed multiplier that also ignores influence by currents. Lua functions added: - avatar_setSpeedMult(num, time) - avatar_setSpeedMult2(num) - avatar_getSpeedMult() - avatar_getSpeedMult2() - entity_isInCurrent(entity) - entity_getNumTargetPoints(entity)
This commit is contained in:
parent
25727244ad
commit
54d609a8b5
4 changed files with 46 additions and 7 deletions
|
@ -4911,13 +4911,9 @@ void Avatar::clampVelocity()
|
|||
}
|
||||
|
||||
|
||||
setMaxSpeed(currentMaxSpeed * useSpeedMult);
|
||||
//float cheatLen = vel.getSquaredLength2D();
|
||||
vel.capLength2D(getMaxSpeed());
|
||||
/*
|
||||
if (cheatLen > sqr(getMaxSpeed()))
|
||||
vel.setLength2D(getMaxSpeed());
|
||||
*/
|
||||
setMaxSpeed(currentMaxSpeed * useSpeedMult * dsq->continuity.speedMult2);
|
||||
|
||||
vel.capLength2D(getMaxSpeed() * maxSpeedLerp.x);
|
||||
}
|
||||
|
||||
void Avatar::activateAura(AuraType aura)
|
||||
|
|
|
@ -3209,6 +3209,7 @@ void Continuity::reset()
|
|||
//worldMapTiles.clear();
|
||||
|
||||
speedMult = biteMult = fishPoison = defenseMult = 1;
|
||||
speedMult2 = 1;
|
||||
poison = 0;
|
||||
energyMult = 0;
|
||||
light = petPower = 0;
|
||||
|
|
|
@ -1102,6 +1102,8 @@ public:
|
|||
Timer energyTimer, poisonTimer, poisonBitTimer;
|
||||
Timer webTimer, webBitTimer, lightTimer, petPowerTimer;
|
||||
|
||||
float speedMult2;
|
||||
|
||||
void eatBeast(const EatData &eatData);
|
||||
void removeNaijaEat(int idx);
|
||||
void removeLastNaijaEat();
|
||||
|
|
|
@ -2898,6 +2898,28 @@ luaFunc(avatar_getSpellCharge)
|
|||
luaReturnNum(dsq->game->avatar->state.spellCharge);
|
||||
}
|
||||
|
||||
luaFunc(avatar_setSpeedMult)
|
||||
{
|
||||
dsq->continuity.setSpeedMultiplier(lua_tonumber(L, 1), lua_tonumber(L, 2));
|
||||
luaReturnNil();
|
||||
}
|
||||
|
||||
luaFunc(avatar_setSpeedMult2)
|
||||
{
|
||||
dsq->continuity.speedMult2 = lua_tonumber(L, 1);
|
||||
luaReturnNil();
|
||||
}
|
||||
|
||||
luaFunc(avatar_getSpeedMult)
|
||||
{
|
||||
luaReturnNum(dsq->continuity.speedMult);
|
||||
}
|
||||
|
||||
luaFunc(avatar_getSpeedMult2)
|
||||
{
|
||||
luaReturnNum(dsq->continuity.speedMult2);
|
||||
}
|
||||
|
||||
luaFunc(jumpState)
|
||||
{
|
||||
dsq->enqueueJumpState(getString(L, 1), getBool(L, 2));
|
||||
|
@ -3208,6 +3230,11 @@ luaFunc(entity_checkSplash)
|
|||
luaReturnBool(ret);
|
||||
}
|
||||
|
||||
luaFunc(entity_isInCurrent)
|
||||
{
|
||||
Entity *e = entity(L);
|
||||
luaReturnBool(e ? e->isInCurrent() : false);
|
||||
}
|
||||
|
||||
luaFunc(entity_isUnderWater)
|
||||
{
|
||||
|
@ -5609,6 +5636,12 @@ luaFunc(entity_getRandomTargetPoint)
|
|||
luaReturnNum(idx);
|
||||
}
|
||||
|
||||
luaFunc(entity_getNumTargetPoints)
|
||||
{
|
||||
Entity *e = entity(L);
|
||||
luaReturnInt(e ? e->getNumTargetPoints() : 0);
|
||||
}
|
||||
|
||||
luaFunc(playVisualEffect)
|
||||
{
|
||||
Entity *target = NULL;
|
||||
|
@ -8066,9 +8099,11 @@ static const struct {
|
|||
|
||||
luaRegister(entity_isUnderWater),
|
||||
luaRegister(entity_checkSplash),
|
||||
luaRegister(entity_isInCurrent),
|
||||
|
||||
luaRegister(entity_getRandomTargetPoint),
|
||||
luaRegister(entity_getTargetPoint),
|
||||
luaRegister(entity_getNumTargetPoints),
|
||||
|
||||
luaRegister(entity_setTargetRange),
|
||||
|
||||
|
@ -8453,6 +8488,11 @@ static const struct {
|
|||
luaRegister(avatar_setBlockSinging),
|
||||
luaRegister(avatar_isBlockSinging),
|
||||
|
||||
luaRegister(avatar_setSpeedMult),
|
||||
luaRegister(avatar_setSpeedMult2),
|
||||
luaRegister(avatar_getSpeedMult),
|
||||
luaRegister(avatar_getSpeedMult2),
|
||||
|
||||
|
||||
luaRegister(avatar_toggleMovement),
|
||||
|
||||
|
|
Loading…
Reference in a new issue