1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-02-13 16:16:08 +00:00

More new Lua functions.

- shot_getMaxSpeed()
- shot_setMaxSpeed()
- shot_getHomingness()
- shot_setHomingness()
- shot_getLifeTime()
- shot_setLifeTime()
- getScreenVirtualSize()
This commit is contained in:
fgenesis 2013-07-20 20:16:26 +02:00
parent 7fb9204e97
commit 9f4c55c177
2 changed files with 62 additions and 10 deletions

View file

@ -2105,6 +2105,48 @@ luaFunc(shot_getDamageType)
luaReturnNum(shot ? shot->getDamageType() : DT_NONE);
}
luaFunc(shot_getMaxSpeed)
{
Shot *shot = getShot(L);
luaReturnNum(shot ? shot->maxSpeed : 0.0f);
}
luaFunc(shot_setMaxSpeed)
{
Shot *shot = getShot(L);
if (shot)
shot->homingness = lua_tonumber(L, 2);
luaReturnNil();
}
luaFunc(shot_getHomingness)
{
Shot *shot = getShot(L);
luaReturnNum(shot ? shot->homingness : 0.0f);
}
luaFunc(shot_setHomingness)
{
Shot *shot = getShot(L);
if (shot)
shot->homingness = lua_tonumber(L, 2);
luaReturnNil();
}
luaFunc(shot_getLifeTime)
{
Shot *shot = getShot(L);
luaReturnNum(shot ? shot->lifeTime : 0.0f);
}
luaFunc(shot_setLifeTime)
{
Shot *shot = getShot(L);
if (shot)
shot->lifeTime = lua_tonumber(L, 2);
luaReturnNil();
}
luaFunc(entity_setVel)
{
Entity *e = entity(L);
@ -7968,6 +8010,11 @@ luaFunc(getScreenSize)
luaReturnVec2(core->width, core->height);
}
luaFunc(getScreenVirtualSize)
{
luaReturnVec2(core->getVirtualWidth(), core->getVirtualHeight());
}
luaFunc(inv_isFull)
{
IngredientData *data = dsq->continuity.getIngredientDataByName(getString(L, 1));
@ -8821,6 +8868,12 @@ static const struct {
luaRegister(shot_getDamage),
luaRegister(shot_getDamageType),
luaRegister(shot_getName),
luaRegister(shot_getMaxSpeed),
luaRegister(shot_setMaxSpeed),
luaRegister(shot_getHomingness),
luaRegister(shot_setHomingness),
luaRegister(shot_getLifeTime),
luaRegister(shot_setLifeTime),
luaRegister(entity_pathBurst),
luaRegister(entity_handleShotCollisions),
luaRegister(entity_handleShotCollisionsSkeletal),
@ -8933,9 +8986,6 @@ static const struct {
luaRegister(entity_watchEntity),
luaRegister(entity_setCollideRadius),
luaRegister(entity_getCollideRadius),
luaRegister(entity_isEntityInRange),
luaRegister(entity_isPositionInRange),
@ -9051,6 +9101,7 @@ static const struct {
luaRegister(getScreenVirtualOff),
luaRegister(getScreenSize),
luaRegister(getScreenVirtualSize),
luaRegister(inv_isFull),
luaRegister(inv_getMaxAmount),

View file

@ -37,7 +37,7 @@ struct ShotData
int blendType;
bool segments;
float damage;
int maxSpeed, homing, homingMax;
float maxSpeed, homing, homingMax;
double homingIncr;
DamageType damageType;
Vector scale;
@ -46,7 +46,7 @@ struct ShotData
float effectTime;
int collideRadius;
float collideRadius;
float lifeTime;
int numSegs, segDist;
@ -61,7 +61,7 @@ struct ShotData
float spinSpeed;
bool invisible, checkDamageTarget, hitWalls, hitEnts, alwaysDoHitEffects;
int rotIncr;
float rotIncr;
float avatarKickBack, avatarKickBackTime;
@ -89,7 +89,8 @@ public:
static void killAllShots();
static void clearShotGarbage();
Entity *target, *firer;
int maxSpeed, targetPt;
int targetPt;
float maxSpeed;
void fire(bool playSfx = true);
void hitEntity(Entity *e, Bone *b, bool isValid=true);
@ -125,6 +126,9 @@ public:
inline const char *getName() const { return shotData ? shotData->name.c_str() : ""; }
float extraDamage;
float homingness;
float lifeTime;
protected:
float waveTimer;
@ -133,9 +137,6 @@ protected:
ParticleEffect *emitter;
double homingness;
float lifeTime;
void onHitWall();
void onEndOfLife();