mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-12-27 07:06:00 +00:00
Make particle suck positions accessible to Lua, use suckpos 2, fix possible crash in entity_clearHair()
This commit is contained in:
parent
1ea1408ac4
commit
f5f890aade
2 changed files with 31 additions and 5 deletions
|
@ -2158,7 +2158,8 @@ void Avatar::loseTargets()
|
||||||
void Avatar::updateTargetQuads(float dt)
|
void Avatar::updateTargetQuads(float dt)
|
||||||
{
|
{
|
||||||
|
|
||||||
particleManager->setSuckPosition(1, dsq->getGameCursorPosition());
|
const Vector cursorpos = dsq->getGameCursorPosition();
|
||||||
|
particleManager->setSuckPosition(1, cursorpos);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
for (int i = 0; i < targetQuads.size(); i++)
|
for (int i = 0; i < targetQuads.size(); i++)
|
||||||
|
@ -2189,7 +2190,8 @@ void Avatar::updateTargetQuads(float dt)
|
||||||
targets[i].pos = e->getTargetPoint(targets[i].targetPt);
|
targets[i].pos = e->getTargetPoint(targets[i].targetPt);
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
particleManager->setSuckPosition(1, targets[i].pos);
|
particleManager->setSuckPosition(1, targets[i].pos); // suckpos 1 is overridden elsewhere later
|
||||||
|
particleManager->setSuckPosition(2, targets[i].pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2202,7 +2204,7 @@ void Avatar::updateTargetQuads(float dt)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
targetQuads[i]->position = dsq->getGameCursorPosition();
|
targetQuads[i]->position = cursorpos;
|
||||||
//targetQuads[i]->alpha.interpolateTo(0, 0.1);
|
//targetQuads[i]->alpha.interpolateTo(0, 0.1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2222,7 +2224,7 @@ void Avatar::updateTargetQuads(float dt)
|
||||||
debugLog(os.str());
|
debugLog(os.str());
|
||||||
*/
|
*/
|
||||||
|
|
||||||
targetQuads[i]->position = dsq->getGameCursorPosition();
|
targetQuads[i]->position = cursorpos;
|
||||||
if (dsq->continuity.form == FORM_ENERGY && isInputEnabled())
|
if (dsq->continuity.form == FORM_ENERGY && isInputEnabled())
|
||||||
{
|
{
|
||||||
if (dsq->inputMode == INPUT_JOYSTICK && targetQuads[i]->isRunning())
|
if (dsq->inputMode == INPUT_JOYSTICK && targetQuads[i]->isRunning())
|
||||||
|
|
|
@ -3021,6 +3021,27 @@ luaFunc(spawnParticleEffect)
|
||||||
luaReturnPtr(pe);
|
luaReturnPtr(pe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
luaFunc(setNumSuckPositions)
|
||||||
|
{
|
||||||
|
particleManager->setNumSuckPositions(lua_tointeger(L, 0));
|
||||||
|
luaReturnNil();
|
||||||
|
}
|
||||||
|
|
||||||
|
luaFunc(setSuckPosition)
|
||||||
|
{
|
||||||
|
particleManager->setSuckPosition(lua_tointeger(L, 0), Vector(lua_tonumber(L, 1), lua_tonumber(L, 2)));
|
||||||
|
luaReturnNil();
|
||||||
|
}
|
||||||
|
|
||||||
|
luaFunc(getSuckPosition)
|
||||||
|
{
|
||||||
|
Vector *v = particleManager->getSuckPosition(lua_tointeger(L, 0));
|
||||||
|
if(v)
|
||||||
|
luaReturnVec2(v->x, v->y);
|
||||||
|
luaReturnVec2(0.0f, 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
luaFunc(bone_showFrame)
|
luaFunc(bone_showFrame)
|
||||||
{
|
{
|
||||||
Bone *b = bone(L);
|
Bone *b = bone(L);
|
||||||
|
@ -6958,7 +6979,7 @@ luaFunc(entity_getHair)
|
||||||
luaFunc(entity_clearHair)
|
luaFunc(entity_clearHair)
|
||||||
{
|
{
|
||||||
Entity *e = entity(L);
|
Entity *e = entity(L);
|
||||||
if (e)
|
if (e && e->hair)
|
||||||
{
|
{
|
||||||
e->hair->safeKill();
|
e->hair->safeKill();
|
||||||
e->hair = 0;
|
e->hair = 0;
|
||||||
|
@ -8157,6 +8178,9 @@ static const struct {
|
||||||
luaRegister(resetTimer),
|
luaRegister(resetTimer),
|
||||||
|
|
||||||
luaRegister(addInfluence),
|
luaRegister(addInfluence),
|
||||||
|
luaRegister(setSuckPosition),
|
||||||
|
luaRegister(setSuckPosition);
|
||||||
|
luaRegister(setNumSuckPositions),
|
||||||
luaRegister(setupBasicEntity),
|
luaRegister(setupBasicEntity),
|
||||||
luaRegister(playMusic),
|
luaRegister(playMusic),
|
||||||
luaRegister(playMusicStraight),
|
luaRegister(playMusicStraight),
|
||||||
|
|
Loading…
Reference in a new issue