From c1479a273266709d6d0775c690dce31a7a430aa5 Mon Sep 17 00:00:00 2001 From: Kahrl Date: Sat, 26 Nov 2011 00:09:36 +0200 Subject: Add node definitions in Lua and do not use content_mapnode_init anymore (except in test.cpp) --- src/scriptapi.cpp | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'src/scriptapi.cpp') 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 read_aabbox3df32(lua_State *L, int index) +static core::aabbox3d read_aabbox3df32(lua_State *L, int index, f32 scale) { core::aabbox3d 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); -- cgit v1.2.3