1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Add node definitions in Lua and do not use content_mapnode_init anymore (except in test.cpp)

This commit is contained in:
Kahrl 2011-11-26 00:09:36 +02:00 committed by Perttu Ahola
parent 1f53ca5f4c
commit c1479a2732
9 changed files with 452 additions and 40 deletions

View file

@ -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);