mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-11-15 05:59:16 +00:00
Add world map gem Lua functions:
setGemName() to change texture setGemBlink() to allow blinking other gems than only the first added one
This commit is contained in:
parent
af1b831c85
commit
e285c26e05
3 changed files with 44 additions and 3 deletions
|
@ -620,12 +620,13 @@ class Path;
|
||||||
|
|
||||||
struct GemData
|
struct GemData
|
||||||
{
|
{
|
||||||
GemData() { canMove=false; }
|
GemData() { canMove=false; blink = false; }
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string userString;
|
std::string userString;
|
||||||
std::string mapName;
|
std::string mapName;
|
||||||
bool canMove;
|
|
||||||
Vector pos;
|
Vector pos;
|
||||||
|
bool canMove;
|
||||||
|
bool blink; // not saved
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BeaconData
|
struct BeaconData
|
||||||
|
|
|
@ -8466,6 +8466,44 @@ luaFunc(setGemPosition)
|
||||||
luaReturnBool(result);
|
luaReturnBool(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
luaFunc(setGemName)
|
||||||
|
{
|
||||||
|
int gemId = lua_tointeger(L, 1);
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
if(gemId >= 0 && gemId < dsq->continuity.gems.size())
|
||||||
|
{
|
||||||
|
Continuity::Gems::iterator it = dsq->continuity.gems.begin();
|
||||||
|
std::advance(it, gemId);
|
||||||
|
GemData& gem = *it;
|
||||||
|
gem.name = getString(L, 2);
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
debugLog("setGemName: invalid index");
|
||||||
|
|
||||||
|
luaReturnBool(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
luaFunc(setGemBlink)
|
||||||
|
{
|
||||||
|
int gemId = lua_tointeger(L, 1);
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
if(gemId >= 0 && gemId < dsq->continuity.gems.size())
|
||||||
|
{
|
||||||
|
Continuity::Gems::iterator it = dsq->continuity.gems.begin();
|
||||||
|
std::advance(it, gemId);
|
||||||
|
GemData& gem = *it;
|
||||||
|
gem.blink = getBool(L, 2);
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
debugLog("setGemBlink: invalid index");
|
||||||
|
|
||||||
|
luaReturnBool(result);
|
||||||
|
}
|
||||||
|
|
||||||
luaFunc(removeGem)
|
luaFunc(removeGem)
|
||||||
{
|
{
|
||||||
int gemId = lua_tointeger(L, 1);
|
int gemId = lua_tointeger(L, 1);
|
||||||
|
@ -9762,6 +9800,8 @@ static const struct {
|
||||||
|
|
||||||
luaRegister(pickupGem),
|
luaRegister(pickupGem),
|
||||||
luaRegister(setGemPosition),
|
luaRegister(setGemPosition),
|
||||||
|
luaRegister(setGemName),
|
||||||
|
luaRegister(setGemBlink),
|
||||||
luaRegister(removeGem),
|
luaRegister(removeGem),
|
||||||
luaRegister(setBeacon),
|
luaRegister(setBeacon),
|
||||||
luaRegister(getBeacon),
|
luaRegister(getBeacon),
|
||||||
|
|
|
@ -1344,7 +1344,7 @@ void WorldMapRender::addAllGems()
|
||||||
for (Continuity::Gems::reverse_iterator i = dsq->continuity.gems.rbegin(); i != dsq->continuity.gems.rend(); i++)
|
for (Continuity::Gems::reverse_iterator i = dsq->continuity.gems.rbegin(); i != dsq->continuity.gems.rend(); i++)
|
||||||
{
|
{
|
||||||
GemMover *g = addGem(&(*i));
|
GemMover *g = addGem(&(*i));
|
||||||
if (c == dsq->continuity.gems.size()-1)
|
if (c == dsq->continuity.gems.size()-1 || i->blink)
|
||||||
g->setBlink(true);
|
g->setBlink(true);
|
||||||
else
|
else
|
||||||
g->setBlink(false);
|
g->setBlink(false);
|
||||||
|
|
Loading…
Reference in a new issue