diff options
author | Kahrl <kahrl@gmx.net> | 2011-11-26 00:09:36 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-11-29 19:13:52 +0200 |
commit | c1479a273266709d6d0775c690dce31a7a430aa5 (patch) | |
tree | df1a47c7c0b8d923392f6476fdbaf41a15ed11cb /src/scriptapi.cpp | |
parent | 1f53ca5f4c2736ab060d93885d9bd956f14ae430 (diff) | |
download | minetest-c1479a273266709d6d0775c690dce31a7a430aa5.tar.gz minetest-c1479a273266709d6d0775c690dce31a7a430aa5.tar.bz2 minetest-c1479a273266709d6d0775c690dce31a7a430aa5.zip |
Add node definitions in Lua and do not use content_mapnode_init anymore (except in test.cpp)
Diffstat (limited to 'src/scriptapi.cpp')
-rw-r--r-- | src/scriptapi.cpp | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/scriptapi.cpp b/src/scriptapi.cpp index a6ac4a0f7..d6169cbda 100644 --- a/src/scriptapi.cpp +++ b/src/scriptapi.cpp @@ -212,27 +212,27 @@ static video::SColor readARGB8(lua_State *L, int index) return color; } -static core::aabbox3d<f32> read_aabbox3df32(lua_State *L, int index) +static core::aabbox3d<f32> read_aabbox3df32(lua_State *L, int index, f32 scale) { core::aabbox3d<f32> box; if(lua_istable(L, -1)){ lua_rawgeti(L, -1, 1); - box.MinEdge.X = lua_tonumber(L, -1); + box.MinEdge.X = lua_tonumber(L, -1) * scale; lua_pop(L, 1); lua_rawgeti(L, -1, 2); - box.MinEdge.Y = lua_tonumber(L, -1); + box.MinEdge.Y = lua_tonumber(L, -1) * scale; lua_pop(L, 1); lua_rawgeti(L, -1, 3); - box.MinEdge.Z = lua_tonumber(L, -1); + box.MinEdge.Z = lua_tonumber(L, -1) * scale; lua_pop(L, 1); lua_rawgeti(L, -1, 4); - box.MaxEdge.X = lua_tonumber(L, -1); + box.MaxEdge.X = lua_tonumber(L, -1) * scale; lua_pop(L, 1); lua_rawgeti(L, -1, 5); - box.MaxEdge.Y = lua_tonumber(L, -1); + box.MaxEdge.Y = lua_tonumber(L, -1) * scale; lua_pop(L, 1); lua_rawgeti(L, -1, 6); - box.MaxEdge.Z = lua_tonumber(L, -1); + box.MaxEdge.Z = lua_tonumber(L, -1) * scale; lua_pop(L, 1); } return box; @@ -600,9 +600,6 @@ static int l_register_node(lua_State *L) // If true, param2 is set to direction when placed. Used for torches. // NOTE: the direction format is quite inefficient and should be changed getboolfield(L, table0, "wall_mounted", f.wall_mounted); - // If true, node is equivalent to air. Torches are, air is. Water is not. - // Is used for example to check whether a mud block can have grass on. - getboolfield(L, table0, "air_equivalent", f.air_equivalent); // Whether this content type often contains mineral. // Used for texture atlas creation. // Currently only enabled for CONTENT_STONE. @@ -643,22 +640,22 @@ static int l_register_node(lua_State *L) lua_getfield(L, -1, "fixed"); if(lua_istable(L, -1)) - f.selection_box.fixed = read_aabbox3df32(L, -1); + f.selection_box.fixed = read_aabbox3df32(L, -1, BS); lua_pop(L, 1); lua_getfield(L, -1, "wall_top"); if(lua_istable(L, -1)) - f.selection_box.wall_top = read_aabbox3df32(L, -1); + f.selection_box.wall_top = read_aabbox3df32(L, -1, BS); lua_pop(L, 1); lua_getfield(L, -1, "wall_bottom"); if(lua_istable(L, -1)) - f.selection_box.wall_bottom = read_aabbox3df32(L, -1); + f.selection_box.wall_bottom = read_aabbox3df32(L, -1, BS); lua_pop(L, 1); lua_getfield(L, -1, "wall_side"); if(lua_istable(L, -1)) - f.selection_box.wall_side = read_aabbox3df32(L, -1); + f.selection_box.wall_side = read_aabbox3df32(L, -1, BS); lua_pop(L, 1); } lua_pop(L, 1); |