running on top when near a bomb

This commit is contained in:
Bluub
2021-06-18 21:34:54 +02:00
parent 5565a15ab3
commit 341e9cd302
4 changed files with 29 additions and 5 deletions
+11 -1
View File
@@ -42,7 +42,7 @@ namespace BBM
void LuaMap::setPlayer(Vector3f pos)
{
_player = Vector2f(pos.x, pos.y);
_player = Vector2f(pos.x, pos.z);
_roundedPlayer = Vector2f(std::round(_player.x), std::round(_player.y));
}
@@ -226,4 +226,14 @@ namespace BBM
const LuaMap *map = (const LuaMap *) lua_topointer(L, lua_upvalueindex(1));
return 1;
}
int LuaMap::isPlayerInDanger(lua_State *L)
{
auto y = lua_tonumber(L, -1);
auto x = lua_tonumber(L, -2);
LuaG::State state(L);
const LuaMap *map = (const LuaMap *) lua_topointer(L, lua_upvalueindex(1));
lua_pushboolean(L, map->_danger[map->_roundedPlayer.y][map->_roundedPlayer.x] > 0);
return 1;
}
}