diff --git a/README.md b/README.txt similarity index 59% rename from README.md rename to README.txt index c146ac8..9ab17a5 100644 --- a/README.md +++ b/README.txt @@ -1,6 +1,4 @@ display_blocks ============== -The original mod was from the diamond mod the garden part. -I thought the garden could be better so i made diplay_blocks to expand. This mod adds blocks that create crystals on top. Some have different light levels others can be seen through and i hope i can make them do other things too. diff --git a/config.txt b/config.txt new file mode 100644 index 0000000..e69de29 diff --git a/depends.txt b/depends.txt index 4ad96d5..592441e 100644 --- a/depends.txt +++ b/depends.txt @@ -1 +1,3 @@ default +titanium? +technic? \ No newline at end of file diff --git a/init.lua b/init.lua index d15613c..988ccef 100644 --- a/init.lua +++ b/init.lua @@ -1,56 +1,74 @@ ---Loads dependencies so there is no need to have the other mods -dofile(minetest.get_modpath("display_blocks").."/ores.lua"); +dofile(minetest.get_modpath("display_blocks").."/config.txt") --- ---Mese Display --- +function disp(base, name, light, rec, rp) + minetest.register_node( "display_blocks:"..base.."_base", { + description = name.."Display Base", + tile_images = { "display_blocks_"..base.."_block.png" }, + is_ground_content = true, + groups = {cracky=3,}, + light_source = light, + sunlight_propagates = true, + paramtype = "light", + drawtype = "glasslike", + }) -minetest.register_node( "display_blocks:mese_base", { - description = "Mese Display Base", - tile_images = { "display_blocks_mese_block.png" }, - is_ground_content = true, - groups = {cracky=3}, -}) + minetest.register_node( "display_blocks:"..base.."_crystal", { + drawtype = "plantlike", + description = name.." Display Crystal", + tile_images = { "display_blocks_"..base.."_crystal.png" }, + is_ground_content = true, + paramtype = "light", + visual_scale = 1.2, + groups = {immortal=1, not_in_creative_inventory=1}, + }) -minetest.register_node( "display_blocks:mese_crystal", { - drawtype = "plantlike", - description = "Mese Display Crystal", - tile_images = { "default_mese_crystal.png" }, - is_ground_content = true, - paramtype = "light", - visual_scale = 1.2, - groups = {immortal=1, not_in_creative_inventory=1}, -}) + minetest.register_abm({ + nodenames = {"display_blocks:"..base.."_base"}, + interval = 1.0, + chance = 1.0, + action = function(pos, node, active_object_count, active_object_count_wider) + pos.y = pos.y + 1 + minetest.env:add_node(pos, {name="display_blocks:"..base.."_crystal"}) + end + }) -minetest.register_abm({ - nodenames = {"display_blocks:mese_base"}, - interval = 1.0, - chance = 1, - action = function(pos, node, active_object_count, active_object_count_wider) - pos.y = pos.y + 1 - minetest.env:add_node(pos, {name="display_blocks:mese_crystal"}) + function remove_crystal(pos, node, active_object_count, active_object_count_wider) + if + node.name == "display_blocks:"..base.."_base" + then + pos.y = pos.y + 1 + minetest.env:remove_node(pos, {name="display_blocks:"..base.."_crystal"}) + end end -}) + minetest.register_on_dignode(remove_crystal) -function remove_crystal(pos, node, active_object_count, active_object_count_wider) - if - node.name == "display_blocks:mese_base" - then - pos.y = pos.y + 1 - minetest.env:remove_node(pos, {name="display_blocks:mese_crystal"}) - end + minetest.register_craft({ + output = 'display_blocks:,..base..'_base 5', + recipe = { + {'', 'default:mese_crystal_fragment', ''}, + {rec, 'default:glass', rec}, + {'', rec, ''}, + } + replacements = {{rec, rp}}, + }) +) + +-- disp(base, name, rec, rp) +disp("mese", "Mese", 0, "default:mese_block", "") +disp("titanium", "Titanium", 0, "titanium:block", '') +disp("glass", "Glass", 0, "default:sand", "") +disp("fire", "Fire", 15, "bucket:bucket_lava", "bucket:bucket_empty") +disp("air", "Air", 5, "bucket:bucket_empty", "bucket:bucket_empty") +disp("water", "Water", 0, "bucket:bucket_water", "bucket:bucket_empty") + +if minetest.get_modpath("technic") and uranium_with_technic == false then + dofile(minetest.get_modpath("display_blocks").."/technic.lua") +elseif minetest.get_modpath("technic") and uranium_with_technic == true then + dofile(minetest.get_modpath("display_blocks").."/technic.lua") + dofile(minetest.get_modpath("display_blocks").."/uranium.lua") +else + dofile(minetest.get_modpath("display_blocks").."/uranium.lua") end -minetest.register_on_dignode(remove_crystal) - -minetest.register_craft({ - output = 'display_blocks:mese_base 5', - recipe = { - {'', 'default:mese_crystal_fragment', ''}, - {'default:mese_crystal', 'default:mese_block', 'default:mese_crystal'}, - {'', 'default:mese_crystal', ''}, - } -}) - -- --Mese Giver Display @@ -67,8 +85,8 @@ minetest.register_node( "display_blocks:mese_giver_base", { minetest.register_abm({ nodenames = {"display_blocks:mese_giver_base"}, - interval = 600.0, - chance = 6, + interval = 60.0, + chance = 2, action = function(pos, node, active_object_count, active_object_count_wider) pos.y = pos.y + 1 minetest.env:add_node(pos, {name="default:mese"}) @@ -94,338 +112,4 @@ minetest.register_craft({ } }) - --- ---Titanium Display --- - -minetest.register_node( "display_blocks:titanium_base", { - description = "Titanium Display Base", - tile_images = { "display_blocks_titanium_block.png" }, - is_ground_content = true, - groups = {cracky=3}, -}) - -minetest.register_node( "display_blocks:titanium_crystal", { - drawtype = "plantlike", - description = "Titanium Display Crystal", - tile_images = { "display_blocks_titanium_crystal.png" }, - is_ground_content = true, - paramtype = "light", - visual_scale = 1.2, - groups = {immortal=1, not_in_creative_inventory=1}, -}) - -minetest.register_abm({ - nodenames = {"display_blocks:titanium_base"}, - interval = 1.0, - chance = 1, - action = function(pos, node, active_object_count, active_object_count_wider) - pos.y = pos.y + 1 - minetest.env:add_node(pos, {name="display_blocks:titanium_crystal"}) - end -}) - -function remove_crystal(pos, node, active_object_count, active_object_count_wider) - if - node.name == "display_blocks:titanium_base" - then - pos.y = pos.y + 1 - minetest.env:remove_node(pos, {name="display_blocks:titanium_crystal"}) - end -end -minetest.register_on_dignode(remove_crystal) - -minetest.register_craft({ - output = 'display_blocks:titanium_base 5', - recipe = { - {'', 'default:mese_crystal_fragment', ''}, - {'titanium:tougher_titanium', 'titanium:block', 'titanium:tougher_titanium'}, - {'', 'titanium:tougher_titanium', ''}, - } -}) - - --- ---Uranium Display --- - -minetest.register_node( "display_blocks:uranium_base", { - description = "Uranium Display Base", - tile_images = { "display_blocks_uranium_block.png" }, - is_ground_content = true, - light_source = 15, - groups = {cracky=3}, -}) - -minetest.register_node( "display_blocks:uranium_crystal", { - drawtype = "plantlike", - description = "Uranium Display Crystal", - tile_images = { "display_blocks_uranium_crystal.png" }, - is_ground_content = true, - paramtype = "light", - visual_scale = 1.2, - groups = {immortal=1, not_in_creative_inventory=1}, -}) - -minetest.register_abm({ - nodenames = {"display_blocks:uranium_base"}, - interval = 1.0, - chance = 1, - action = function(pos, node, active_object_count, active_object_count_wider) - pos.y = pos.y + 1 - minetest.env:add_node(pos, {name="display_blocks:uranium_crystal"}) - end -}) - -function remove_crystal(pos, node, active_object_count, active_object_count_wider) - if - node.name == "display_blocks:uranium_base" - then - pos.y = pos.y + 1 - minetest.env:remove_node(pos, {name="display_blocks:uranium_crystal"}) - end -end -minetest.register_on_dignode(remove_crystal) - -minetest.register_craft({ - output = 'display_blocks:uranium_base 5', - recipe = { - {'', 'default:mese_crystal_fragment', ''}, - {'display_blocks:uranium_dust', 'display_blocks:uranium_block', 'display_blocks:uranium_dust'}, - {'', 'display_blocks:uranium_dust', ''}, - } -}) - - --- ---Glass Display --- - -minetest.register_node( "display_blocks:glass_base", { - description = "Glass Display Base", - tile_images = { "display_blocks_glass_block.png" }, - is_ground_content = true, - groups = {cracky=3,}, - sunlight_propagates = true, - paramtype = "light", - drawtype = "glasslike", -}) - -minetest.register_node( "display_blocks:glass_crystal", { - drawtype = "plantlike", - description = "Glass Display Crystal", - tile_images = { "display_blocks_glass_crystal.png" }, - is_ground_content = true, - paramtype = "light", - visual_scale = 1.2, - groups = {immortal=1, not_in_creative_inventory=1}, -}) - -minetest.register_abm({ - nodenames = {"display_blocks:glass_base"}, - interval = 1.0, - chance = 1, - action = function(pos, node, active_object_count, active_object_count_wider) - pos.y = pos.y + 1 - minetest.env:add_node(pos, {name="display_blocks:glass_crystal"}) - end -}) - -function remove_crystal(pos, node, active_object_count, active_object_count_wider) - if - node.name == "display_blocks:glass_base" - then - pos.y = pos.y + 1 - minetest.env:remove_node(pos, {name="display_blocks:glass_crystal"}) - end -end -minetest.register_on_dignode(remove_crystal) - -minetest.register_craft({ - output = 'display_blocks:glass_base 5', - recipe = { - {'', 'default:mese_crystal_fragment', ''}, - {'default:sand', 'default:glass', 'default:sand'}, - {'', 'default:sand', ''}, - } -}) - - --- ---Fire Display --- - -minetest.register_node( "display_blocks:fire_base", { - description = "Fire Display Base", - tile_images = { "display_blocks_fire_block.png" }, - is_ground_content = true, - groups = {cracky=3,}, - sunlight_propagates = true, - paramtype = "light", - drawtype = "glasslike", -}) - -minetest.register_node( "display_blocks:fire_crystal", { - drawtype = "plantlike", - description = "Fire Display Crystal", - tile_images = { "display_blocks_fire_crystal.png" }, - is_ground_content = true, - paramtype = "light", - visual_scale = 1.2, - light_source = 10, - groups = {immortal=1, not_in_creative_inventory=1}, -}) - -minetest.register_abm({ - nodenames = {"display_blocks:fire_base"}, - interval = 1.0, - chance = 1, - action = function(pos, node, active_object_count, active_object_count_wider) - pos.y = pos.y + 1 - minetest.env:add_node(pos, {name="display_blocks:fire_crystal"}) - end -}) - -function remove_crystal(pos, node, active_object_count, active_object_count_wider) - if - node.name == "display_blocks:fire_base" - then - pos.y = pos.y + 1 - minetest.env:remove_node(pos, {name="display_blocks:fire_crystal"}) - end -end -minetest.register_on_dignode(remove_crystal) - -minetest.register_craft({ - output = 'display_blocks:fire_base 5', - recipe = { - {'', 'default:mese_crystal_fragment', ''}, - {'bucket:bucket_lava', 'default:glass', 'bucket:bucket_lava'}, - {'', 'bucket:bucket_lava', ''}, - } -}) - - --- ---Air Display --- - -minetest.register_node( "display_blocks:air_base", { - description = "Air Display Base", - tile_images = { "display_blocks_air_block.png" }, - is_ground_content = true, - groups = {cracky=3,}, - sunlight_propagates = true, - paramtype = "light", - drawtype = "glasslike", -}) - -minetest.register_node( "display_blocks:air_crystal", { - drawtype = "plantlike", - description = "Air Display Crystal", - tile_images = { "display_blocks_air_crystal.png" }, - is_ground_content = true, - paramtype = "light", - visual_scale = 1.2, - groups = {immortal=1, not_in_creative_inventory=1}, -}) - -minetest.register_abm({ - nodenames = {"display_blocks:air_base"}, - interval = 1.0, - chance = 1, - action = function(pos, node, active_object_count, active_object_count_wider) - pos.y = pos.y + 1 - minetest.env:add_node(pos, {name="display_blocks:air_crystal"}) - end -}) - -function remove_crystal(pos, node, active_object_count, active_object_count_wider) - if - node.name == "display_blocks:air_base" - then - pos.y = pos.y + 1 - minetest.env:remove_node(pos, {name="display_blocks:air_crystal"}) - end -end -minetest.register_on_dignode(remove_crystal) - -minetest.register_craft({ - output = 'display_blocks:air_base 5', - recipe = { - {'', 'default:mese_crystal_fragment', ''}, - {'bucket:bucket', 'default:glass', 'bucket:bucket'}, - {'', 'bucket:bucket', ''}, - } -}) - - --- ---Water Display --- - -minetest.register_node( "display_blocks:water_base", { - description = "Water Display Base", - tile_images = { "display_blocks_water_block.png" }, - is_ground_content = true, - groups = {cracky=3,}, - sunlight_propagates = true, - paramtype = "light", - drawtype = "glasslike", -}) - -minetest.register_node( "display_blocks:water_crystal", { - drawtype = "plantlike", - description = "Water Display Crystal", - tile_images = { "display_blocks_water_crystal.png" }, - is_ground_content = true, - paramtype = "light", - visual_scale = 1.2, - groups = {immortal=1, not_in_creative_inventory=1}, -}) - -minetest.register_abm({ - nodenames = {"display_blocks:water_base"}, - interval = 1.0, - chance = 1, - action = function(pos, node, active_object_count, active_object_count_wider) - pos.y = pos.y + 1 - minetest.env:add_node(pos, {name="display_blocks:water_crystal"}) - end -}) - -function remove_crystal(pos, node, active_object_count, active_object_count_wider) - if - node.name == "display_blocks:water_base" - then - pos.y = pos.y + 1 - minetest.env:remove_node(pos, {name="display_blocks:water_crystal"}) - end -end -minetest.register_on_dignode(remove_crystal) - -minetest.register_craft({ - output = 'display_blocks:water_base 5', - recipe = { - {'', 'default:mese_crystal_fragment', ''}, - {'bucket:bucket_water', 'default:glass', 'bucket:bucket_water'}, - {'', 'bucket:bucket_water', ''}, - } -}) - - ---Aliases -minetest.register_alias("mesebase", "display_blocks:mese_base") -minetest.register_alias("mesegiverbase", "display_blocks:mese_giver_base") -minetest.register_alias("titaniumbase", "display_blocks:titanium_base") -minetest.register_alias("uraniumbase", "display_blocks:uranium_base") -minetest.register_alias("glassbase", "display_blocks:glass_base") -minetest.register_alias("firebase", "display_blocks:fire_base") -minetest.register_alias("airbase", "display_blocks:air_base") -minetest.register_alias("waterbase", "display_blocks:water_base") - - - - print("[Display Blocks] Loaded! by jojoa1997 :-)") diff --git a/ores.lua b/ores.lua deleted file mode 100644 index cffba2f..0000000 --- a/ores.lua +++ /dev/null @@ -1,88 +0,0 @@ --- ---Uranium --- - - -minetest.register_node( "display_blocks:uranium_ore", { - description = "Uranium Ore", - tile_images = { "default_stone.png^uranium_ore.png" }, - is_ground_content = true, - groups = {cracky=3}, - drop = 'craft "display_blocks:uranium_dust" 3', -}) - -minetest.register_craftitem( "display_blocks:uranium_dust", { - description = "Uranium Dust", - inventory_image = "uranium_dust.png", - on_place_on_ground = minetest.craftitem_place_item, -}) - -minetest.register_node( "display_blocks:uranium_block", { - description = "Uranium Block", - tile_images = { "uranium_block.png" }, - light_propagates = true, - paramtype = "light", - sunlight_propagates = true, - light_source = 15, - is_ground_content = true, - groups = {snappy=1,bendy=2,cracky=1,melty=2,level=2}, -}) - - -minetest.register_craft( { - output = 'node "display_blocks:uranium_block" 1', - recipe = { - { 'display_blocks:uranium_dust', 'display_blocks:uranium_dust', 'display_blocks:uranium_dust' }, - { 'display_blocks:uranium_dust', 'display_blocks:uranium_dust', 'display_blocks:uranium_dust' }, - { 'display_blocks:uranium_dust', 'display_blocks:uranium_dust', 'display_blocks:uranium_dust' }, - } -}) - --- Ore generation - -local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, ore_per_chunk, height_min, height_max) - if maxp.y < height_min or minp.y > height_max then - return - end - local y_min = math.max(minp.y, height_min) - local y_max = math.min(maxp.y, height_max) - local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1) - local pr = PseudoRandom(seed) - local num_chunks = math.floor(chunks_per_volume * volume) - local chunk_size = 3 - if ore_per_chunk <= 4 then - chunk_size = 2 - end - local inverse_chance = math.floor(chunk_size*chunk_size*chunk_size / ore_per_chunk) - --print("generate_ore num_chunks: "..dump(num_chunks)) - for i=1,num_chunks do - if (y_max-chunk_size+1 <= y_min) then return end - local y0 = pr:next(y_min, y_max-chunk_size+1) - if y0 >= height_min and y0 <= height_max then - local x0 = pr:next(minp.x, maxp.x-chunk_size+1) - local z0 = pr:next(minp.z, maxp.z-chunk_size+1) - local p0 = {x=x0, y=y0, z=z0} - for x1=0,chunk_size-1 do - for y1=0,chunk_size-1 do - for z1=0,chunk_size-1 do - if pr:next(1,inverse_chance) == 1 then - local x2 = x0+x1 - local y2 = y0+y1 - local z2 = z0+z1 - local p2 = {x=x2, y=y2, z=z2} - if minetest.env:get_node(p2).name == wherein then - minetest.env:set_node(p2, {name=name}) - end - end - end - end - end - end - end - --print("generate_ore done") -end - -minetest.register_on_generated(function(minp, maxp, seed) -generate_ore("display_blocks:uranium_ore", "default:stone", minp, maxp, seed+21, 1/13/13/13, 5, -31000, -150) - -end) diff --git a/technic.lua b/technic.lua new file mode 100644 index 0000000..dd688a2 --- /dev/null +++ b/technic.lua @@ -0,0 +1,6 @@ +disp("uranium", "Uranium", 10, "technic:uranium", "") + +if uranium_with_technic == true then + minetest.register_alias("display_blocks:uranium_dust", "technic:uranium_block") + minetest.register_alias("display_blocks:uranium_block", "technic:uranium_block") +end \ No newline at end of file diff --git a/textures/display_blocks_mese_crystal.png b/textures/display_blocks_mese_crystal.png new file mode 100644 index 0000000..afc68b7 Binary files /dev/null and b/textures/display_blocks_mese_crystal.png differ diff --git a/uranium.lua b/uranium.lua new file mode 100644 index 0000000..9604eca --- /dev/null +++ b/uranium.lua @@ -0,0 +1,58 @@ +disp("uranium", "Uranium", 10, "uranium:uranium_block", "") + +minetest.register_node( "display_blocks:uranium_ore", { + description = "Uranium Ore", + tile_images = { "default_stone.png^uranium_ore.png" }, + is_ground_content = true, + groups = {cracky=3}, + drop = 'craft "display_blocks:uranium_dust" 3', +}) + +minetest.register_craftitem( "display_blocks:uranium_dust", { + description = "Uranium Dust", + inventory_image = "uranium_dust.png", + on_place_on_ground = minetest.craftitem_place_item, +}) + +minetest.register_node( "display_blocks:uranium_block", { + description = "Uranium Block", + tile_images = { "uranium_block.png" }, + light_propagates = true, + paramtype = "light", + sunlight_propagates = true, + light_source = 15, + is_ground_content = true, + groups = {snappy=1,bendy=2,cracky=1,melty=2,level=2}, +}) + + +minetest.register_craft( { + output = 'node "display_blocks:uranium_block" 1', + recipe = { + { 'display_blocks:uranium_dust', 'display_blocks:uranium_dust', 'display_blocks:uranium_dust' }, + { 'display_blocks:uranium_dust', 'display_blocks:uranium_dust', 'display_blocks:uranium_dust' }, + { 'display_blocks:uranium_dust', 'display_blocks:uranium_dust', 'display_blocks:uranium_dust' }, + } +}) + +minetest.register_ore({ + ore_type = "scatter", + ore = "display_blocks:uranium_dust", + wherein = "default:stone", + clust_scarcity = 10*10*10, + clust_num_ores =18, + clust_size = 3, + height_min = -3000, + height_max = -200, +}) + +minetest.register_ore({ + ore_type = "scatter", + ore = "display_blocks:uranium_dust", + wherein = "default:stone", + clust_scarcity =20*20*20, + clust_num_ores =40, + clust_size = 4, + height_min = -7000, + height_max = -5000, +})