1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-11-25 09:44:02 +00:00

Add Lua functions for bonelock control. Also make quad_setRepeatTexture() update tex params properly.

+ entity_setBoneLockRotation()
+ entity_setBoneLockOffset()
This commit is contained in:
fgenesis 2023-03-19 15:26:45 +01:00
parent 04cb3bba11
commit 66b0aa710f
3 changed files with 40 additions and 2 deletions

View file

@ -137,6 +137,8 @@ bool Entity::setBoneLock(const BoneLock &boneLock)
onSetBoneLock();
updateBoneLock();
return true;
}

View file

@ -343,6 +343,7 @@ public:
bool isEntityInside() const;
void updateSoundPosition();
void updateBoneLock();
Vector getPushVec() const { return pushVec; }
float getPushDamage() const { return pushDamage; }
@ -419,8 +420,6 @@ protected:
Timer damageTimer;
void updateBoneLock();
float pushMaxSpeed;
std::string currentAnim;
LanceData *lancedata;

View file

@ -1889,7 +1889,10 @@ luaFunc(quad_setRepeatScale)
{
Quad *b = getQuad(L);
if (b)
{
b->repeatToFillScale = Vector(lua_tonumber(L, 2), lua_tonumber(L, 3));
b->refreshRepeatTextureToFill();
}
luaReturnNil();
}
@ -2954,6 +2957,38 @@ luaFunc(entity_setBoneLock)
luaReturnBool(ret);
}
luaFunc(entity_setBoneLockRotation)
{
bool ret = false;
if(Entity *e = entity(L))
{
if(BoneLock *bl = e->getBoneLock())
{
bl->origRot = lua_tonumber(L, 2);
e->updateBoneLock();
ret = true;
}
}
luaReturnBool(ret);
}
luaFunc(entity_setBoneLockOffset)
{
bool ret = false;
if(Entity *e = entity(L))
{
if(BoneLock *bl = e->getBoneLock())
{
bl->circleOffset.x = lua_tonumber(L, 2);
bl->circleOffset.y = lua_tonumber(L, 3);
e->updateBoneLock();
ret = true;
}
}
luaReturnBool(ret);
}
luaFunc(entity_setIngredient)
{
Entity *e = entity(L);
@ -9935,6 +9970,8 @@ static const struct {
luaRegister(entity_getRidingRotation),
luaRegister(entity_getRidingFlip),
luaRegister(entity_setBoneLock),
luaRegister(entity_setBoneLockRotation),
luaRegister(entity_setBoneLockOffset),
luaRegister(entity_setIngredient),
luaRegister(entity_setDeathScene),
luaRegister(entity_isDeathScene),