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

Node place/dig Lua callbacks

This commit is contained in:
Perttu Ahola 2011-11-17 11:22:24 +02:00
parent d7cb6146c8
commit cc03718d3c
5 changed files with 255 additions and 31 deletions

View file

@ -2527,10 +2527,11 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
u8 mineral = MINERAL_NONE;
bool cannot_remove_node = false;
MapNode n(CONTENT_IGNORE);
try
{
MapNode n = m_env->getMap().getNode(p_under);
n = m_env->getMap().getNode(p_under);
// Get mineral
mineral = n.getMineral(m_nodedef);
// Get material at position
@ -2734,6 +2735,11 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
continue;
client->SetBlocksNotSent(modified_blocks);
}
/*
Run script hook
*/
scriptapi_environment_on_dignode(m_lua, p_under, n);
}
/*
@ -2877,6 +2883,11 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
client->SetBlocksNotSent(modified_blocks);
}
/*
Run script hook
*/
scriptapi_environment_on_placenode(m_lua, p_over, n);
/*
Calculate special events
*/