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

Little update fixing some minor things

Rename msg() Lua function to screenMessage().
Identify an unused script.
This commit is contained in:
fgenesis 2017-01-20 02:20:58 +01:00
parent e35a309732
commit b52ff75c95
3 changed files with 28 additions and 27 deletions

View file

@ -64,15 +64,15 @@ static std::string getSceneFilename(const std::string &scene)
return ""; return "";
} }
Ingredient *Game::getNearestIngredient(const Vector &pos, int radius) Ingredient *Game::getNearestIngredient(const Vector &pos, float radius)
{ {
int closest = -1; int closest = -1;
int r2 = sqr(radius); float r2 = sqr(radius);
Ingredient *returnIngredient = 0; Ingredient *returnIngredient = 0;
for (Ingredients::iterator i = ingredients.begin(); i != ingredients.end(); i++) for (Ingredients::iterator i = ingredients.begin(); i != ingredients.end(); i++)
{ {
int len = (pos - (*i)->position).getSquaredLength2D(); float len = (pos - (*i)->position).getSquaredLength2D();
if (len <= r2 && (closest == - 1 || len < closest)) if (len <= r2 && (closest == - 1 || len < closest))
{ {
closest = len; closest = len;

View file

@ -460,7 +460,7 @@ public:
Ingredient* spawnIngredient(const std::string &ing, const Vector &pos, int times=1, int out=0); Ingredient* spawnIngredient(const std::string &ing, const Vector &pos, int times=1, int out=0);
void spawnIngredientFromEntity(Entity *ent, IngredientData *data); void spawnIngredientFromEntity(Entity *ent, IngredientData *data);
Ingredient *getNearestIngredient(const Vector &pos, int radius); Ingredient *getNearestIngredient(const Vector &pos, float radius);
Entity *getNearestEntity(const Vector &pos, int radius, Entity *ignore = 0, EntityType et=ET_NOTYPE, DamageType dt=DT_NONE, int lrStart=-1, int lrEnd=-1); Entity *getNearestEntity(const Vector &pos, int radius, Entity *ignore = 0, EntityType et=ET_NOTYPE, DamageType dt=DT_NONE, int lrStart=-1, int lrEnd=-1);
Script *cookingScript; Script *cookingScript;

View file

@ -2187,8 +2187,6 @@ luaFunc(getNoteColor)
luaFunc(getRandNote) luaFunc(getRandNote)
{ {
luaReturnNum(dsq->getRandNote()); luaReturnNum(dsq->getRandNote());
} }
@ -5386,7 +5384,8 @@ luaFunc(centerText)
luaReturnNil(); luaReturnNil();
} }
luaFunc(msg) // this used to be msg(), but this is already an interface function name
luaFunc(screenMessage)
{ {
dsq->screenMessage(getString(L, 1)); dsq->screenMessage(getString(L, 1));
luaReturnNil(); luaReturnNil();
@ -7467,14 +7466,14 @@ luaFunc(entity_getID)
luaFunc(getEntityByID) luaFunc(getEntityByID)
{ {
debugLog("Calling getEntityByID"); //debugLog("Calling getEntityByID");
int v = lua_tointeger(L, 1); int v = lua_tointeger(L, 1);
Entity *found = 0; Entity *found = 0;
if (v) if (v)
{ {
std::ostringstream os; //std::ostringstream os;
os << "searching for entity with id: " << v; //os << "searching for entity with id: " << v;
debugLog(os.str()); //debugLog(os.str());
FOR_ENTITIES(i) FOR_ENTITIES(i)
{ {
Entity *e = *i; Entity *e = *i;
@ -7484,7 +7483,7 @@ luaFunc(getEntityByID)
break; break;
} }
} }
if (!found) /*if (!found)
{ {
std::ostringstream os; std::ostringstream os;
os << "entity with id: " << v << " not found!"; os << "entity with id: " << v << " not found!";
@ -7495,12 +7494,12 @@ luaFunc(getEntityByID)
std::ostringstream os; std::ostringstream os;
os << "Found: " << found->name; os << "Found: " << found->name;
debugLog(os.str()); debugLog(os.str());
}*/
} }
} /*else
else
{ {
debugLog("entity ID was 0"); debugLog("entity ID was 0");
} }*/
luaReturnPtr(found); luaReturnPtr(found);
} }
@ -8156,13 +8155,15 @@ luaFunc(entity_getTarget)
luaFunc(entity_getTargetPositionX) luaFunc(entity_getTargetPositionX)
{ {
Entity *e = entity(L); Entity *e = entity(L);
luaReturnInt(e ? e->getTargetEntity()->position.x : 0); Entity *t = e ? e->getTargetEntity() : NULL;
luaReturnNum(t ? t->position.x : 0.0f);
} }
luaFunc(entity_getTargetPositionY) luaFunc(entity_getTargetPositionY)
{ {
Entity *e = entity(L); Entity *e = entity(L);
luaReturnNum(e ? e->getTargetEntity()->position.y : 0); Entity *t = e ? e->getTargetEntity() : NULL;
luaReturnNum(t ? t->position.y : 0.0f);
} }
luaFunc(entity_isNearObstruction) luaFunc(entity_isNearObstruction)
@ -10078,7 +10079,7 @@ static const struct {
luaRegister(isNestedMain), luaRegister(isNestedMain),
luaRegister(msg), luaRegister(screenMessage),
luaRegister(centerText), luaRegister(centerText),
luaRegister(watchForVoice), luaRegister(watchForVoice),