mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-12-29 00:05:50 +00:00
Minor Lua changes:
+ node_setEmitter(name) + node_getEmitter() * obj_setTexture() returns bool now
This commit is contained in:
parent
b71c21a0b3
commit
1af3a580ed
3 changed files with 43 additions and 11 deletions
|
@ -450,14 +450,23 @@ void Path::refreshScript()
|
|||
//core->removeRenderObject(&emitter, Core::DO_NOT_DESTROY_RENDER_OBJECT);
|
||||
//core->getTopStateData()->addRenderObject(&emitter, LR_PARTICLES);
|
||||
|
||||
if (emitter)
|
||||
{
|
||||
emitter->safeKill();
|
||||
emitter = 0;
|
||||
}
|
||||
setEmitter(particleEffect);
|
||||
}
|
||||
}
|
||||
|
||||
void Path::setEmitter(const std::string& name)
|
||||
{
|
||||
if (emitter)
|
||||
{
|
||||
emitter->safeKill();
|
||||
emitter = 0;
|
||||
}
|
||||
if(!name.empty())
|
||||
{
|
||||
emitter = new ParticleEffect;
|
||||
emitter->load(particleEffect);
|
||||
emitter->start();
|
||||
emitter->load(name);
|
||||
if(active)
|
||||
emitter->start();
|
||||
if (!nodes.empty())
|
||||
{
|
||||
emitter->position = nodes[0].position;
|
||||
|
|
|
@ -89,6 +89,7 @@ public:
|
|||
void update(float dt);
|
||||
void setActive(bool v);
|
||||
bool action(int id, int state);
|
||||
void setEmitter(const std::string& name);
|
||||
|
||||
PathNode *getPathNode(int idx);
|
||||
bool isCoordinateInside(const Vector &pos, int rad=0);
|
||||
|
|
|
@ -1113,9 +1113,7 @@ luaFunc(obj_setBlendType)
|
|||
luaFunc(obj_setTexture)
|
||||
{
|
||||
RenderObject *r = robj(L);
|
||||
if (r)
|
||||
r->setTexture(getString(L, 2));
|
||||
luaReturnNil();
|
||||
luaReturnBool(r ? r->setTexture(getString(L, 2)) : false);
|
||||
}
|
||||
|
||||
luaFunc(obj_getTexture)
|
||||
|
@ -4916,6 +4914,21 @@ luaFunc(getStringFlag)
|
|||
luaReturnStr(dsq->continuity.getStringFlag(getString(L, 1)).c_str());
|
||||
}
|
||||
|
||||
luaFunc(node_setEmitter)
|
||||
{
|
||||
Path *p = path(L);
|
||||
if(p)
|
||||
p->setEmitter(getString(L, 2));
|
||||
luaReturnPtr(p->emitter);
|
||||
}
|
||||
|
||||
luaFunc(node_getEmitter)
|
||||
{
|
||||
Path *p = path(L);
|
||||
luaReturnPtr(p ? p->emitter : NULL);
|
||||
}
|
||||
|
||||
|
||||
luaFunc(node_setActive)
|
||||
{
|
||||
Path *p = path(L);
|
||||
|
@ -4923,6 +4936,13 @@ luaFunc(node_setActive)
|
|||
if (p)
|
||||
{
|
||||
p->active = v;
|
||||
if(p->emitter)
|
||||
{
|
||||
if(v)
|
||||
p->emitter->start();
|
||||
else
|
||||
p->emitter->stop();
|
||||
}
|
||||
}
|
||||
luaReturnNil();
|
||||
}
|
||||
|
@ -6489,7 +6509,7 @@ luaFunc(playSfx)
|
|||
if (sfx.vol <= 0)
|
||||
sfx.vol = 1;
|
||||
sfx.loops = lua_tointeger(L, 4);
|
||||
if(lua_isnumber(L, 6) && lua_isnumber(L, 7))
|
||||
if(lua_isnumber(L, 5) && lua_isnumber(L, 6))
|
||||
{
|
||||
sfx.x = lua_tonumber(L, 5);
|
||||
sfx.y = lua_tonumber(L, 6);
|
||||
|
@ -9999,6 +10019,8 @@ static const struct {
|
|||
|
||||
luaRegister(node_setActive),
|
||||
luaRegister(node_isActive),
|
||||
luaRegister(node_setEmitter),
|
||||
luaRegister(node_getEmitter),
|
||||
|
||||
|
||||
luaRegister(setSceneColor),
|
||||
|
|
Loading…
Reference in a new issue