SHOW:
|
|
- or go back to the newest paste.
| 1 | Loaded texture: C:/Minetest/textures/base/pack/menubg.png | |
| 2 | Loaded texture: C:/Minetest/textures/base/pack/menulogo.png | |
| 3 | 19:54:23: ERROR[main]: ========== ERROR FROM LUA =========== | |
| 4 | 19:54:23: ERROR[main]: Failed to load and run script from | |
| 5 | 19:54:23: ERROR[main]: C:\Minetest\bin\..\mods\minetest\redstone\init.lua: | |
| 6 | 19:54:23: ERROR[main]: C:\Minetest\bin\..\mods\minetest\redstone\init.lua:1: une | |
| 7 | xpected symbol near '´' | |
| 8 | 19:54:23: ERROR[main]: =======END OF ERROR FROM LUA ======== | |
| 9 | 19:54:23: ERROR[main]: Server: Failed to load and run C:\Minetest\bin\..\mods\mi | |
| 10 | netest\redstone\init.lua | |
| 11 | 19:54:23: ERROR[main]: ModError: Failed to load and run C:\Minetest\bin\..\mods\ | |
| 12 | - | minetest\redstone\init.lua |
| 12 | + | minetest\redstone\init.lua |
| 13 | ||
| 14 | //// | |
| 15 | minetest.register_node( "redstone:redstone", {
| |
| 16 | description = "redstone", | |
| 17 | tile_images = { "default_stone.png^redstone_redstone.png" },
| |
| 18 | is_ground_content = true, | |
| 19 | groups = {cracky=3},
| |
| 20 | }) | |
| 21 | ||
| 22 | local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, ore_per_chunk, height_min, height_max) | |
| 23 | if maxp.y < height_min or minp.y > height_max then | |
| 24 | return | |
| 25 | end | |
| 26 | local y_min = math.max(minp.y, height_min) | |
| 27 | local y_max = math.min(maxp.y, height_max) | |
| 28 | local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1) | |
| 29 | local pr = PseudoRandom(seed) | |
| 30 | local num_chunks = math.floor(chunks_per_volume * volume) | |
| 31 | local chunk_size = 3 | |
| 32 | if ore_per_chunk <= 4 then | |
| 33 | chunk_size = 2 | |
| 34 | end | |
| 35 | local inverse_chance = math.floor(chunk_size*chunk_size*chunk_size / ore_per_chunk) | |
| 36 | --print("generate_ore num_chunks: "..dump(num_chunks))
| |
| 37 | for i=1,num_chunks do | |
| 38 | if (y_max-chunk_size+1 <= y_min) then return end | |
| 39 | local y0 = pr:next(y_min, y_max-chunk_size+1) | |
| 40 | if y0 >= height_min and y0 <= height_max then | |
| 41 | local x0 = pr:next(minp.x, maxp.x-chunk_size+1) | |
| 42 | local z0 = pr:next(minp.z, maxp.z-chunk_size+1) | |
| 43 | local p0 = {x=x0, y=y0, z=z0}
| |
| 44 | for x1=0,chunk_size-1 do | |
| 45 | for y1=0,chunk_size-1 do | |
| 46 | for z1=0,chunk_size-1 do | |
| 47 | if pr:next(1,inverse_chance) == 1 then | |
| 48 | local x2 = x0+x1 | |
| 49 | local y2 = y0+y1 | |
| 50 | local z2 = z0+z1 | |
| 51 | local p2 = {x=x2, y=y2, z=z2}
| |
| 52 | if minetest.env:get_node(p2).name == wherein then | |
| 53 | minetest.env:set_node(p2, {name=name})
| |
| 54 | end | |
| 55 | end | |
| 56 | end | |
| 57 | end | |
| 58 | end | |
| 59 | end | |
| 60 | end | |
| 61 | --print("generate_ore done")
| |
| 62 | end | |
| 63 | ||
| 64 | minetest.register_on_generated(function(minp, maxp, seed) | |
| 65 | generate_ore("moreores:redstone", "default:stone", minp, maxp, seed+16, 1/11/11/11, 8, -31000, 64)
| |
| 66 | end) |