12345678910111213141516171819202122232425262728293031323334353637383940 |
- minetest.register_node('levels:border', {
- description = 'Invisible Border',
- inventory_image = 'levels_border.png',
- drawtype = 'allfaces',
- paramtype = 'light',
- pointable = false,
- tiles = {'levels_blank.png'},
- groups = {breakable=1, not_in_creative_inventory=1},
- })
- minetest.register_node('levels:border_alt', {
- description = 'visible Border',
- drawtype = 'allfaces',
- paramtype = 'light',
- pointable = true,
- tiles = {'levels_border.png'},
- groups = {breakable=1},
- on_construct = function(pos)
- local timer = minetest.get_node_timer(pos)
- timer:start(30)
- end,
- on_timer = function(pos)
- minetest.set_node(pos, {name='levels:border'})
- end
- })
- minetest.register_chatcommand('border', {
- description = 'Turn invisible borders visible.',
- func = function(name)
- local player = minetest.get_player_by_name(name)
- local pos = vector.round(player:get_pos())
- local pos1 = {x=pos.x+5, y=pos.y+5, z=pos.z+5}
- local pos2 = {x=pos.x-5, y=pos.y-3, z=pos.z-5}
- local node_list = minetest.find_nodes_in_area(pos1, pos2, 'levels:border')
- for _,pos in pairs(node_list) do
- minetest.set_node(pos, {name='levels:border_alt'})
- end
- end
- })
|