aboutsummaryrefslogtreecommitdiff
path: root/src/map.cpp
Commit message (Expand)AuthorAge
* Some work-in-progress in hp and mobs and a frightening amount of random fixes.Perttu Ahola2011-04-21
* updated example map generator python scriptPerttu Ahola2011-04-11
* fixed warnings reported by cppcheckPerttu Ahola2011-04-11
* hopefully fixed a bit morePerttu Ahola2011-04-11
* improved old map supportPerttu Ahola2011-04-11
* added ignoring of map_meta.txt to better support old mapsPerttu Ahola2011-04-11
* better support for old mapsPerttu Ahola2011-04-10
* missing include for server buildPerttu Ahola2011-04-10
* Map generation is now properly threaded and doesn't block block placement and...Perttu Ahola2011-04-10
* a commit before starting to reorganize the map loading/generation logicPerttu Ahola2011-04-10
* new-style rats are now generated in the mapPerttu Ahola2011-04-10
* new object systemPerttu Ahola2011-04-10
* Furnace is now usable. Added more tools.Perttu Ahola2011-04-05
* initial workings of the furnacePerttu Ahola2011-04-05
* changed node metadata format to better accomodate future needs and problemsPerttu Ahola2011-04-05
* Node metadata frameworkPerttu Ahola2011-04-04
* Made a proper queued thread to client for handling some block mesh updates. A...Perttu Ahola2011-04-04
* Modified block mesh generation to have clearer input and output. Instead of b...Perttu Ahola2011-04-03
* commit before some more radical changesPerttu Ahola2011-04-03
* copied draft of updateNodeMeshes from backupPerttu Ahola2011-04-03
* Revert mapgen to best working version (2)Perttu Ahola2011-04-03
* Mapgen is better now. Not a lot, but a bit!Perttu Ahola2011-04-02
* commit before some radical changesPerttu Ahola2011-04-02
* mapgen work-in-progressPerttu Ahola2011-03-02
* mapgen tweakingPerttu Ahola2011-03-01
* tweaked mapgenPerttu Ahola2011-02-28
* tweaked mapgenPerttu Ahola2011-02-28
* added trees (very glitchy) and changed grass texturePerttu Ahola2011-02-28
* A third try on terrain generation. No trees yet.Perttu Ahola2011-02-28
* mainly work on object scripting apiPerttu Ahola2011-02-23
* Temporary commit; lots of test code and stuffPerttu Ahola2011-02-21
* fixed invalid block loading (the action is to generate a new one)Perttu Ahola2011-02-16
* small fixes: crack texture, server build on windows, configuration file examp...Perttu Ahola2011-02-16
* mud gets now grass onto it when placed into sunlight. also removed three old ...Perttu Ahola2011-02-15
* server now won't crash when it is tries to generate blocks that are not insid...Perttu Ahola2011-02-15
* Some fiddling around with fog... not much changedPerttu Ahola2011-02-14
* fixed bug in sneakingPerttu Ahola2011-02-14
* added sneaking/crouching and changelogPerttu Ahola2011-02-14
* mapgen parameter tweakingPerttu Ahola2011-02-13
* now it works nicelyPerttu Ahola2011-02-11
* fully working i guessPerttu Ahola2011-02-11
* work-in-progress texture atlas optimizationPerttu Ahola2011-02-10
* made it to work with my windows compilerPerttu Ahola2011-02-08
* bug-fixin'Perttu Ahola2011-02-08
* mapgen tweakingPerttu Ahola2011-02-06
* mapgen stuffPerttu Ahola2011-02-05
* added sand to map generatorPerttu Ahola2011-02-04
* nicer looking waterPerttu Ahola2011-02-04
* all kinds of tweaking and fixingPerttu Ahola2011-02-04
* some generation-time mud flow tweakingPerttu Ahola2011-02-03
">(L, 2)); return 1; } int LuaMinimap::l_get_angle(lua_State *L) { LuaMinimap *ref = checkobject(L, 1); Minimap *m = getobject(ref); lua_pushinteger(L, m->getAngle()); return 1; } int LuaMinimap::l_set_angle(lua_State *L) { LuaMinimap *ref = checkobject(L, 1); Minimap *m = getobject(ref); m->setAngle(lua_tointeger(L, 2)); return 1; } int LuaMinimap::l_get_mode(lua_State *L) { LuaMinimap *ref = checkobject(L, 1); Minimap *m = getobject(ref); lua_pushinteger(L, m->getMinimapMode()); return 1; } int LuaMinimap::l_set_mode(lua_State *L) { LuaMinimap *ref = checkobject(L, 1); Minimap *m = getobject(ref); s32 mode = lua_tointeger(L, 2); if (mode < MINIMAP_MODE_OFF || mode >= MINIMAP_MODE_COUNT) { return 0; } m->setMinimapMode((MinimapMode) mode); return 1; } int LuaMinimap::l_set_shape(lua_State *L) { LuaMinimap *ref = checkobject(L, 1); Minimap *m = getobject(ref); if (!lua_isnumber(L, 2)) return 0; m->setMinimapShape((MinimapShape)((int)lua_tonumber(L, 2))); return 0; } int LuaMinimap::l_get_shape(lua_State *L) { LuaMinimap *ref = checkobject(L, 1); Minimap *m = getobject(ref); lua_pushnumber(L, (int)m->getMinimapShape()); return 1; } int LuaMinimap::l_show(lua_State *L) { // If minimap is disabled by config, don't show it. if (!g_settings->getBool("enable_minimap")) return 1; Client *client = getClient(L); assert(client); LuaMinimap *ref = checkobject(L, 1); Minimap *m = getobject(ref); if (m->getMinimapMode() == MINIMAP_MODE_OFF) m->setMinimapMode(MINIMAP_MODE_SURFACEx1); client->showMinimap(true); return 1; } int LuaMinimap::l_hide(lua_State *L) { Client *client = getClient(L); assert(client); LuaMinimap *ref = checkobject(L, 1); Minimap *m = getobject(ref); if (m->getMinimapMode() != MINIMAP_MODE_OFF) m->setMinimapMode(MINIMAP_MODE_OFF); client->showMinimap(false); return 1; } LuaMinimap *LuaMinimap::checkobject(lua_State *L, int narg) { NO_MAP_LOCK_REQUIRED; luaL_checktype(L, narg, LUA_TUSERDATA); void *ud = luaL_checkudata(L, narg, className); if (!ud) luaL_typerror(L, narg, className); return *(LuaMinimap **)ud; // unbox pointer } Minimap* LuaMinimap::getobject(LuaMinimap *ref) { return ref->m_minimap; } int LuaMinimap::gc_object(lua_State *L) { LuaMinimap *o = *(LuaMinimap **)(lua_touserdata(L, 1)); delete o; return 0; } void LuaMinimap::Register(lua_State *L) { lua_newtable(L); int methodtable = lua_gettop(L); luaL_newmetatable(L, className); int metatable = lua_gettop(L); lua_pushliteral(L, "__metatable"); lua_pushvalue(L, methodtable); lua_settable(L, metatable); // hide metatable from Lua getmetatable() lua_pushliteral(L, "__index"); lua_pushvalue(L, methodtable); lua_settable(L, metatable); lua_pushliteral(L, "__gc"); lua_pushcfunction(L, gc_object); lua_settable(L, metatable); lua_pop(L, 1); // drop metatable luaL_openlib(L, 0, methods, 0); // fill methodtable lua_pop(L, 1); // drop methodtable } const char LuaMinimap::className[] = "Minimap"; const luaL_Reg LuaMinimap::methods[] = { luamethod(LuaMinimap, show), luamethod(LuaMinimap, hide), luamethod(LuaMinimap, get_pos), luamethod(LuaMinimap, set_pos), luamethod(LuaMinimap, get_angle), luamethod(LuaMinimap, set_angle), luamethod(LuaMinimap, get_mode), luamethod(LuaMinimap, set_mode), luamethod(LuaMinimap, set_shape), luamethod(LuaMinimap, get_shape), {0,0} };