mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-08-06 14:20:18 +00:00
More Lua functions; allow specifying ingredient type by ID
- avatar_setBlockBackflip() - avatar_isBlockBackflip() - inv_getNumItems() - inv_getItemName() - getIngredientDataSize() - getIngredientDataName()
This commit is contained in:
parent
08821f5156
commit
c6ae568ed8
5 changed files with 62 additions and 0 deletions
|
@ -4129,6 +4129,8 @@ Avatar::Avatar() : Entity(), ActionMapper()
|
||||||
_collisionAvoidRange = COLLIDE_RANGE_NORMAL;
|
_collisionAvoidRange = COLLIDE_RANGE_NORMAL;
|
||||||
|
|
||||||
_seeMapMode = SEE_MAP_DEFAULT;
|
_seeMapMode = SEE_MAP_DEFAULT;
|
||||||
|
|
||||||
|
blockBackFlip = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Avatar::revert()
|
void Avatar::revert()
|
||||||
|
@ -4282,6 +4284,7 @@ void Avatar::startBackFlip()
|
||||||
{
|
{
|
||||||
if (boneLock.on) return;
|
if (boneLock.on) return;
|
||||||
if (riding) return;
|
if (riding) return;
|
||||||
|
if (blockBackFlip) return;
|
||||||
|
|
||||||
skeletalSprite.getAnimationLayer(ANIMLAYER_OVERRIDE)->transitionAnimate("backflip", 0.2, 0);
|
skeletalSprite.getAnimationLayer(ANIMLAYER_OVERRIDE)->transitionAnimate("backflip", 0.2, 0);
|
||||||
vel.x = -vel.x*0.25f;
|
vel.x = -vel.x*0.25f;
|
||||||
|
|
|
@ -346,6 +346,8 @@ public:
|
||||||
|
|
||||||
int leaches;
|
int leaches;
|
||||||
float shieldPoints;
|
float shieldPoints;
|
||||||
|
|
||||||
|
bool blockBackFlip;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setSongIconPositions();
|
void setSongIconPositions();
|
||||||
|
|
|
@ -165,6 +165,8 @@ IngredientType Continuity::getIngredientTypeFromName(const std::string &name) co
|
||||||
return IT_MUSHROOM;
|
return IT_MUSHROOM;
|
||||||
else if (name == "Anything")
|
else if (name == "Anything")
|
||||||
return IT_ANYTHING;
|
return IT_ANYTHING;
|
||||||
|
else if (name.length() && isdigit(name[0]))
|
||||||
|
return (IngredientType)atoi(name.c_str());
|
||||||
|
|
||||||
return IT_NONE;
|
return IT_NONE;
|
||||||
}
|
}
|
||||||
|
@ -190,6 +192,16 @@ IngredientData *Continuity::getIngredientDataByIndex(int idx)
|
||||||
return ingredientData[idx];
|
return ingredientData[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Continuity::getIngredientDataSize() const
|
||||||
|
{
|
||||||
|
return (int)ingredientData.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
int Continuity::getIngredientHeldSize() const
|
||||||
|
{
|
||||||
|
return (int)ingredients.size();
|
||||||
|
}
|
||||||
|
|
||||||
Recipe::Recipe()
|
Recipe::Recipe()
|
||||||
{
|
{
|
||||||
known = false;
|
known = false;
|
||||||
|
|
|
@ -1067,6 +1067,9 @@ public:
|
||||||
IngredientData *getIngredientHeldByIndex(int idx) const;
|
IngredientData *getIngredientHeldByIndex(int idx) const;
|
||||||
IngredientData *getIngredientDataByIndex(int idx);
|
IngredientData *getIngredientDataByIndex(int idx);
|
||||||
|
|
||||||
|
int getIngredientDataSize() const;
|
||||||
|
int getIngredientHeldSize() const;
|
||||||
|
|
||||||
bool applyIngredientEffects(IngredientData *data);
|
bool applyIngredientEffects(IngredientData *data);
|
||||||
|
|
||||||
void loadIngredientData();
|
void loadIngredientData();
|
||||||
|
@ -1152,6 +1155,7 @@ public:
|
||||||
std::vector<FoodSortOrder> sortByType, sortByHeal, sortByIngredients, sortByUnsort;
|
std::vector<FoodSortOrder> sortByType, sortByHeal, sortByIngredients, sortByUnsort;
|
||||||
|
|
||||||
StatsAndAchievements *statsAndAchievements;
|
StatsAndAchievements *statsAndAchievements;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<EatData> eats;
|
std::vector<EatData> eats;
|
||||||
std::vector<int> speedTypes;
|
std::vector<int> speedTypes;
|
||||||
|
|
|
@ -2998,6 +2998,18 @@ luaFunc(avatar_isBlockSinging)
|
||||||
luaReturnBool(dsq->game->avatar->isBlockSinging());
|
luaReturnBool(dsq->game->avatar->isBlockSinging());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
luaFunc(avatar_setBlockBackflip)
|
||||||
|
{
|
||||||
|
dsq->game->avatar->blockBackFlip = getBool(L);
|
||||||
|
luaReturnNil();
|
||||||
|
}
|
||||||
|
|
||||||
|
luaFunc(avatar_isBlockBackflip)
|
||||||
|
{
|
||||||
|
dsq->game->avatar->blockBackFlip = getBool(L);
|
||||||
|
luaReturnNil();
|
||||||
|
}
|
||||||
|
|
||||||
luaFunc(avatar_fallOffWall)
|
luaFunc(avatar_fallOffWall)
|
||||||
{
|
{
|
||||||
dsq->game->avatar->fallOffWall();
|
dsq->game->avatar->fallOffWall();
|
||||||
|
@ -8083,6 +8095,29 @@ luaFunc(inv_pickupEffect)
|
||||||
luaReturnNil();
|
luaReturnNil();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
luaFunc(inv_getNumItems)
|
||||||
|
{
|
||||||
|
luaReturnInt(dsq->continuity.getIngredientHeldSize());
|
||||||
|
}
|
||||||
|
|
||||||
|
luaFunc(inv_getItemName)
|
||||||
|
{
|
||||||
|
IngredientData *data = dsq->continuity.getIngredientHeldByIndex(lua_tointeger(L, 1));
|
||||||
|
luaReturnStr(data ? data->name.c_str() : "");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
luaFunc(getIngredientDataSize)
|
||||||
|
{
|
||||||
|
luaReturnInt(dsq->continuity.getIngredientDataSize());
|
||||||
|
}
|
||||||
|
|
||||||
|
luaFunc(getIngredientDataName)
|
||||||
|
{
|
||||||
|
IngredientData *data = dsq->continuity.getIngredientDataByIndex(lua_tointeger(L, 1));
|
||||||
|
luaReturnStr(data ? data->name.c_str() : "");
|
||||||
|
}
|
||||||
|
|
||||||
luaFunc(learnRecipe)
|
luaFunc(learnRecipe)
|
||||||
{
|
{
|
||||||
std::string name = getString(L, 1);
|
std::string name = getString(L, 1);
|
||||||
|
@ -8774,6 +8809,8 @@ static const struct {
|
||||||
luaRegister(avatar_fallOffWall),
|
luaRegister(avatar_fallOffWall),
|
||||||
luaRegister(avatar_setBlockSinging),
|
luaRegister(avatar_setBlockSinging),
|
||||||
luaRegister(avatar_isBlockSinging),
|
luaRegister(avatar_isBlockSinging),
|
||||||
|
luaRegister(avatar_setBlockBackflip),
|
||||||
|
luaRegister(avatar_isBlockBackflip),
|
||||||
|
|
||||||
luaRegister(avatar_setSpeedMult),
|
luaRegister(avatar_setSpeedMult),
|
||||||
luaRegister(avatar_setSpeedMult2),
|
luaRegister(avatar_setSpeedMult2),
|
||||||
|
@ -9112,7 +9149,11 @@ static const struct {
|
||||||
luaRegister(inv_getType),
|
luaRegister(inv_getType),
|
||||||
luaRegister(inv_getDisplayName),
|
luaRegister(inv_getDisplayName),
|
||||||
luaRegister(inv_pickupEffect),
|
luaRegister(inv_pickupEffect),
|
||||||
|
luaRegister(inv_getNumItems),
|
||||||
|
luaRegister(inv_getItemName),
|
||||||
luaRegister(learnRecipe),
|
luaRegister(learnRecipe),
|
||||||
|
luaRegister(getIngredientDataSize),
|
||||||
|
luaRegister(getIngredientDataName),
|
||||||
|
|
||||||
luaRegister(createDebugText),
|
luaRegister(createDebugText),
|
||||||
luaRegister(createBitmapText),
|
luaRegister(createBitmapText),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue