Page 1 of 1

Item Dropping

Posted: Fri Jul 05, 2013 23:30
by VoidLord
What is the syntax to get an item to drop, 'cause I have a bomb that removes nodes and I want to know how to turn the nodes into items. Here's the code:

for x=-URANIUM_BOMB_RANGE,URANIUM_BOMB_RANGE do
for y=-URANIUM_BOMB_RANGE,URANIUM_BOMB_RANGE do
for z=-URANIUM_BOMB_RANGE,URANIUM_BOMB_RANGE do
if x*x+y*y+z*z <= URANIUM_BOMB_RANGE * URANIUM_BOMB_RANGE + URANIUM_BOMB_RANGE then
local np={x=pos.x+x,y=pos.y+y,z=pos.z+z}
local n = minetest.env:get_node(np)
if n.name ~= "air" then
-- I want to add the item drop here.
minetest.env:remove_node(np)
end
activate_if_tnt(n.name, np, pos, URANIUM_BOMB_RANGE)
end
end
end
end

Posted: Sat Jul 06, 2013 23:34
by tinoesroho
Check the TNT mod by PilzAdam- it does have dropping code. /grin