aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/content_mapnode.cpp9
-rw-r--r--src/content_mapnode.h3
-rw-r--r--src/environment.cpp9
-rw-r--r--src/mapgen.cpp3
-rw-r--r--src/nodedef.cpp5
-rw-r--r--src/nodedef.h3
-rw-r--r--src/scriptapi.cpp25
-rw-r--r--src/server.cpp3
8 files changed, 20 insertions, 40 deletions
diff --git a/src/content_mapnode.cpp b/src/content_mapnode.cpp
index 878d66654..a74760ba3 100644
--- a/src/content_mapnode.cpp
+++ b/src/content_mapnode.cpp
@@ -478,7 +478,6 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
f.setInventoryTexture("junglegrass.png");
f.light_propagates = true;
f.param_type = CPT_LIGHT;
- f.air_equivalent = false; // grass grows underneath
f.dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f.walkable = false;
setLeavesLikeMaterialProperties(f.material, 1.0);
@@ -568,7 +567,6 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
f.param_type = CPT_LIGHT;
f.is_ground_content = true;
f.dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
- f.air_equivalent = true; // grass grows underneath
f.selection_box.type = NODEBOX_FIXED;
f.selection_box.fixed = core::aabbox3d<f32>(
-BS/7, -BS/2, -BS/7, BS/7, BS/2, BS/7);
@@ -589,7 +587,6 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
f.param_type = CPT_LIGHT;
f.is_ground_content = true;
f.dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
- f.air_equivalent = true; // grass grows underneath
f.walkable = false;
f.selection_box.type = NODEBOX_FIXED;
f.furnace_burntime = 5;
@@ -607,7 +604,6 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
f.is_ground_content = true;
f.dug_item = std::string("MaterialItem ")+itos(i)+" 1";
f.wall_mounted = true;
- f.air_equivalent = true;
f.walkable = false;
f.climbable = true;
f.selection_box.type = NODEBOX_WALLMOUNTED;
@@ -665,7 +661,6 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
f.pointable = false;
f.diggable = false;
f.buildable_to = true;
- f.air_equivalent = true;
nodemgr->set(i, f);
i = CONTENT_WATER;
@@ -774,7 +769,6 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
f.sunlight_propagates = true;
f.walkable = false;
f.wall_mounted = true;
- f.air_equivalent = true;
f.dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f.light_source = LIGHT_MAX-1;
f.selection_box.type = NODEBOX_WALLMOUNTED;
@@ -799,7 +793,6 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
f.sunlight_propagates = true;
f.walkable = false;
f.wall_mounted = true;
- f.air_equivalent = true;
f.dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f.metadata_name = "sign";
setConstantMaterialProperties(f.material, 0.5);
@@ -920,7 +913,6 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
f.param_type = CPT_LIGHT;
f.dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f.light_propagates = true;
- f.air_equivalent = false;
f.walkable = false;
setConstantMaterialProperties(f.material, 0.0);
f.furnace_burntime = 10;
@@ -937,7 +929,6 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
f.light_propagates = true;
f.sunlight_propagates = true;
f.walkable = false;
- f.air_equivalent = true;
f.dug_item = std::string("CraftItem apple 1");
setConstantMaterialProperties(f.material, 0.0);
f.furnace_burntime = 3;
diff --git a/src/content_mapnode.h b/src/content_mapnode.h
index 57be6da72..b928e4407 100644
--- a/src/content_mapnode.h
+++ b/src/content_mapnode.h
@@ -28,7 +28,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
class IWritableNodeDefManager;
-// Initialize default (legacy) node definitions
+// Initialize legacy node definitions
+// Not used used anywhere else than in test.cpp (and SHALL NOT BE)
void content_mapnode_init(IWritableNodeDefManager *nodemgr);
// Backwards compatibility for non-extended content types in v19
diff --git a/src/environment.cpp b/src/environment.cpp
index 5206ecc5d..f1278a64b 100644
--- a/src/environment.cpp
+++ b/src/environment.cpp
@@ -644,7 +644,8 @@ void ServerEnvironment::activateBlock(MapBlock *block, u32 additional_dtime)
if(dtime_s > 300)
{
MapNode n_top = block->getNodeNoEx(p0+v3s16(0,1,0));
- if(m_gamedef->ndef()->get(n_top).air_equivalent &&
+ if(m_gamedef->ndef()->get(n_top).light_propagates &&
+ !m_gamedef->ndef()->get(n_top).isLiquid() &&
n_top.getLight(LIGHTBANK_DAY, m_gamedef->ndef()) >= 13)
{
n.setContent(LEGN(m_gamedef->ndef(), "CONTENT_GRASS"));
@@ -1018,7 +1019,8 @@ void ServerEnvironment::step(float dtime)
if(myrand()%20 == 0)
{
MapNode n_top = m_map->getNodeNoEx(p+v3s16(0,1,0));
- if(m_gamedef->ndef()->get(n_top).air_equivalent &&
+ if(m_gamedef->ndef()->get(n_top).light_propagates &&
+ !m_gamedef->ndef()->get(n_top).isLiquid() &&
n_top.getLightBlend(getDayNightRatio(),
m_gamedef->ndef()) >= 13)
{
@@ -1035,7 +1037,8 @@ void ServerEnvironment::step(float dtime)
//if(myrand()%20 == 0)
{
MapNode n_top = m_map->getNodeNoEx(p+v3s16(0,1,0));
- if(m_gamedef->ndef()->get(n_top).air_equivalent == false)
+ if(m_gamedef->ndef()->get(n_top).light_propagates == false ||
+ m_gamedef->ndef()->get(n_top).isLiquid())
{
n.setContent(LEGN(m_gamedef->ndef(), "CONTENT_MUD"));
m_map->addNodeWithEvent(p, n);
diff --git a/src/mapgen.cpp b/src/mapgen.cpp
index f1e109b2d..c2256cedb 100644
--- a/src/mapgen.cpp
+++ b/src/mapgen.cpp
@@ -2222,8 +2222,7 @@ void make_block(BlockMakeData *data)
{
u32 i = data->vmanip->m_area.index(p);
MapNode *n = &data->vmanip->m_data[i];
- if(data->nodedef->get(*n).is_ground_content
- || n->getContent() == LEGN(ndef, "CONTENT_JUNGLETREE"))
+ if(data->nodedef->get(*n).is_ground_content)
{
found = true;
break;
diff --git a/src/nodedef.cpp b/src/nodedef.cpp
index 7855ffef7..c5ad3af01 100644
--- a/src/nodedef.cpp
+++ b/src/nodedef.cpp
@@ -137,7 +137,6 @@ void ContentFeatures::reset()
climbable = false;
buildable_to = false;
wall_mounted = false;
- air_equivalent = false;
often_contains_mineral = false;
dug_item = "";
extra_dug_item = "";
@@ -185,7 +184,6 @@ void ContentFeatures::serialize(std::ostream &os)
writeU8(os, climbable);
writeU8(os, buildable_to);
writeU8(os, wall_mounted);
- writeU8(os, air_equivalent);
writeU8(os, often_contains_mineral);
os<<serializeString(dug_item);
os<<serializeString(extra_dug_item);
@@ -237,7 +235,6 @@ void ContentFeatures::deSerialize(std::istream &is, IGameDef *gamedef)
climbable = readU8(is);
buildable_to = readU8(is);
wall_mounted = readU8(is);
- air_equivalent = readU8(is);
often_contains_mineral = readU8(is);
dug_item = deSerializeString(is);
extra_dug_item = deSerializeString(is);
@@ -329,7 +326,6 @@ public:
f.pointable = false;
f.diggable = false;
f.buildable_to = true;
- f.air_equivalent = true;
// Insert directly into containers
content_t c = CONTENT_AIR;
m_content_features[c] = f;
@@ -348,7 +344,6 @@ public:
f.diggable = false;
// A way to remove accidental CONTENT_IGNOREs
f.buildable_to = true;
- f.air_equivalent = true;
// Insert directly into containers
content_t c = CONTENT_IGNORE;
m_content_features[c] = f;
diff --git a/src/nodedef.h b/src/nodedef.h
index 645e75e3e..e0b5c864c 100644
--- a/src/nodedef.h
+++ b/src/nodedef.h
@@ -174,9 +174,6 @@ struct ContentFeatures
// If true, param2 is set to direction when placed. Used for torches.
// NOTE: the direction format is quite inefficient and should be changed
bool 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.
- bool air_equivalent;
// Whether this content type often contains mineral.
// Used for texture atlas creation.
// Currently only enabled for CONTENT_STONE.
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);
diff --git a/src/server.cpp b/src/server.cpp
index 6d34a0fac..7b44b1c03 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -1021,9 +1021,6 @@ Server::Server(
infostream<<"m_nodedef="<<m_nodedef<<std::endl;
- // Initialize default node definitions
- content_mapnode_init(m_nodedef);
-
// Path to builtin.lua
std::string builtinpath = porting::path_data + DIR_DELIM + "builtin.lua";
// Add default global mod path