Paste #aO0 -- näytä pelkkänä tekstinä -- uusi tämän pohjalta
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | local sandjoy_radius = 25 local sandjoy_diameter = 2 * sandjoy_radius + 1 local sandjoy_schematic = { size = {x = sandjoy_diameter, y = 1, z = sandjoy_diameter}, data = {}, } local sandjoy_undoschematic = { size = {x = sandjoy_diameter, y = 1, z = sandjoy_diameter}, data = {}, } for i = 0, sandjoy_diameter*sandjoy_diameter-1 do local nodename = 'default:sand' local prob = 0 if ((i % sandjoy_diameter == 0) or (i % sandjoy_diameter == sandjoy_diameter - 1) or (i < sandjoy_diameter) or (i >= sandjoy_diameter*(sandjoy_diameter-1))) then nodename = 'default:sandstone' prob = 128 end table.insert(sandjoy_schematic.data, {name=nodename, param1=prob, param2=0}) table.insert(sandjoy_undoschematic.data, {name='air', param1=0, param2=0}) end minetest.register_craftitem("sandjoy:sandjoy", { description = "Sand Joy", inventory_image = "default_sand.png^[crack0", on_use = function(itemstack, user, pointed) if pointed.type == 'node' then pos = { x = pointed.under.x - sandjoy_radius, y = pointed.under.y, z = pointed.under.z - sandjoy_radius, } n1 = minetest.get_node(pointed.under) if n1 and n1.name == 'default:sand' then minetest.place_schematic(pos, sandjoy_undoschematic) else minetest.place_schematic(pos, sandjoy_schematic) end end end }) |