diff options
author | ShadowNinja <noreply@gmail.com> | 2013-07-17 15:34:35 -0400 |
---|---|---|
committer | ShadowNinja <noreply@gmail.com> | 2013-09-17 16:37:56 -0400 |
commit | ee0765804c0a21deeb2f33c22ac1a36cb0db5f43 (patch) | |
tree | d6445b48f5663e10a83a2f718ffbcce5883be798 /technic_worldgen | |
parent | 48ea6fb99de29a58e01c8c923bdca626aaf47c65 (diff) |
Partial rewrite
Diffstat (limited to 'technic_worldgen')
-rw-r--r-- | technic_worldgen/crafts.lua | 103 | ||||
-rw-r--r-- | technic_worldgen/init.lua | 10 | ||||
-rw-r--r-- | technic_worldgen/oregen.lua | 8 | ||||
-rw-r--r-- | technic_worldgen/rubber.lua | 104 |
4 files changed, 148 insertions, 77 deletions
diff --git a/technic_worldgen/crafts.lua b/technic_worldgen/crafts.lua index a601b7f..f0254d6 100644 --- a/technic_worldgen/crafts.lua +++ b/technic_worldgen/crafts.lua @@ -1,109 +1,68 @@ -minetest.register_craftitem( ":technic:uranium", { +minetest.register_craftitem(":technic:uranium", { description = "Uranium", inventory_image = "technic_uranium.png", on_place_on_ground = minetest.craftitem_place_item, }) -minetest.register_craftitem( ":technic:chromium_lump", { +minetest.register_craftitem(":technic:chromium_lump", { description = "Chromium Lump", inventory_image = "technic_chromium_lump.png", on_place_on_ground = minetest.craftitem_place_item, }) -minetest.register_craftitem( ":technic:chromium_ingot", { +minetest.register_craftitem(":technic:chromium_ingot", { description = "Chromium Ingot", inventory_image = "technic_chromium_ingot.png", on_place_on_ground = minetest.craftitem_place_item, }) -minetest.register_craftitem( ":technic:zinc_lump", { +minetest.register_craftitem(":technic:zinc_lump", { description = "Zinc Lump", inventory_image = "technic_zinc_lump.png", }) -minetest.register_craftitem( ":technic:zinc_ingot", { +minetest.register_craftitem(":technic:zinc_ingot", { description = "Zinc Ingot", inventory_image = "technic_zinc_ingot.png", }) -minetest.register_craftitem( ":technic:stainless_steel_ingot", { +minetest.register_craftitem(":technic:stainless_steel_ingot", { description = "Stainless Steel Ingot", inventory_image = "technic_stainless_steel_ingot.png", }) -minetest.register_craftitem( ":group:brass_ingot", { - description = "Brass Ingot", - inventory_image = "technic_brass_ingot.png", -}) - -minetest.register_craft({ - output = "node technic:uranium_block", - recipe = {{"technic:uranium", "technic:uranium", "technic:uranium"}, - {"technic:uranium", "technic:uranium", "technic:uranium"}, - {"technic:uranium", "technic:uranium", "technic:uranium"}} -}) - -minetest.register_craft({ - output = "craft technic:uranium 9", - recipe = {{"technic:uranium_block"}} -}) - -minetest.register_craft({ - output = "node technic:chromium_block", - recipe = {{"technic:chromium_ingot", "technic:chromium_ingot", "technic:chromium_ingot"}, - {"technic:chromium_ingot", "technic:chromium_ingot", "technic:chromium_ingot"}, - {"technic:chromium_ingot", "technic:chromium_ingot", "technic:chromium_ingot"}} -}) - -minetest.register_craft({ - output = "craft technic:chromium_ingot 9", - recipe = {{"technic:chromium_block"}} -}) - -minetest.register_craft({ - output = "node technic:zinc_block", - recipe = {{"technic:zinc_ingot", "technic:zinc_ingot", "technic:zinc_ingot"}, - {"technic:zinc_ingot", "technic:zinc_ingot", "technic:zinc_ingot"}, - {"technic:zinc_ingot", "technic:zinc_ingot", "technic:zinc_ingot"}} -}) - -minetest.register_craft({ - output = "craft technic:zinc_ingot 9", - recipe = {{"technic:zinc_block"}} -}) - -minetest.register_craft({ - output = "node technic:stainless_steel_block", - recipe = {{"technic:stainless_steel_ingot", "technic:stainless_steel_ingot", "technic:stainless_steel_ingot"}, - {"technic:stainless_steel_ingot", "technic:stainless_steel_ingot", "technic:stainless_steel_ingot"}, - {"technic:stainless_steel_ingot", "technic:stainless_steel_ingot", "technic:stainless_steel_ingot"}} -}) - -minetest.register_craft({ - output = "craft technic:stainless_steel_ingot 9", - recipe = {{"technic:stainless_steel_block"}} -}) - -minetest.register_craft({ - output = "node group:brass_block", - recipe = {{"group:brass_ingot", "group:brass_ingot", "group:brass_ingot"}, - {"group:brass_ingot", "group:brass_ingot", "group:brass_ingot"}, - {"group:brass_ingot", "group:brass_ingot", "group:brass_ingot"}} -}) - -minetest.register_craft({ - output = "craft group:brass_ingot 9", - recipe = {{"group:brass_block"}} -}) +local function register_block(block, ingot) + minetest.register_craft({ + output = block, + recipe = { + {ingot, ingot, ingot}, + {ingot, ingot, ingot}, + {ingot, ingot, ingot}, + } + }) + + minetest.register_craft({ + output = ingot.." 9", + recipe = { + {block} + } + }) +end + +register_block("technic:uranium_block", "technic:uranium") +register_block("technic:chromium_block", "technic:chromium_ingot") +register_block("technic:zinc_block", "technic:zinc_ingot") +register_block("technic:stainless_steel_block", "technic:stainless_steel_ingot") minetest.register_craft({ type = 'cooking', + recipe = "technic:zinc_lump", output = "technic:zinc_ingot", - recipe = "technic:zinc_lump" }) minetest.register_craft({ type = 'cooking', + recipe = "technic:chromium_lump", output = "technic:chromium_ingot", - recipe = "technic:chromium_lump" }) + diff --git a/technic_worldgen/init.lua b/technic_worldgen/init.lua index 3e9e4dd..6209017 100644 --- a/technic_worldgen/init.lua +++ b/technic_worldgen/init.lua @@ -1,7 +1,11 @@ --- Minetest 0.4.6 : technic_worldgen - -modpath=minetest.get_modpath("technic_worldgen") +local modpath = minetest.get_modpath("technic_worldgen") dofile(modpath.."/nodes.lua") dofile(modpath.."/oregen.lua") dofile(modpath.."/crafts.lua") + +-- Rubber trees, moretrees also supplies these +if not minetest.get_modpath("moretrees") then + dofile(modpath.."/rubber.lua") +end + diff --git a/technic_worldgen/oregen.lua b/technic_worldgen/oregen.lua index 50f5415..c48e358 100644 --- a/technic_worldgen/oregen.lua +++ b/technic_worldgen/oregen.lua @@ -8,6 +8,7 @@ minetest.register_ore({ height_min = -300, height_max = -80, }) + minetest.register_ore({ ore_type = "scatter", ore = "technic:mineral_chromium", @@ -18,6 +19,7 @@ minetest.register_ore({ height_min = -31000, height_max = -100, }) + minetest.register_ore({ ore_type = "scatter", ore = "technic:mineral_zinc", @@ -28,7 +30,8 @@ minetest.register_ore({ height_min = -31000, height_max = 2, }) -if technic.config:getBool("enable_marble_generation") then + +if technic.config:get_bool("enable_marble_generation") then minetest.register_ore({ ore_type = "sheet", ore = "technic:marble", @@ -42,7 +45,8 @@ minetest.register_ore({ noise_params = {offset=0, scale=15, spread={x=150, y=150, z=150}, seed=23, octaves=3, persist=0.70} }) end -if technic.config:getBool("enable_granite_generation") then + +if technic.config:get_bool("enable_granite_generation") then minetest.register_ore({ ore_type = "sheet", ore = "technic:granite", diff --git a/technic_worldgen/rubber.lua b/technic_worldgen/rubber.lua new file mode 100644 index 0000000..370d40e --- /dev/null +++ b/technic_worldgen/rubber.lua @@ -0,0 +1,104 @@ +-- Code of rubber tree by PilzAdam + +minetest.register_node(":moretrees:rubber_tree_sapling", { + description = "Rubber Tree Sapling", + drawtype = "plantlike", + tiles = {"technic_rubber_sapling.png"}, + inventory_image = "technic_rubber_sapling.png", + wield_image = "technic_rubber_sapling.png", + paramtype = "light", + walkable = false, + groups = {dig_immediate=3, flammable=2}, + sounds = default.node_sound_defaults(), +}) + +minetest.register_craft({ + type = "fuel", + recipe = "moretrees:rubber_tree_sapling", + burntime = 10 +}) + +minetest.register_node(":moretrees:rubber_tree_trunk", { + description = "Rubber Tree", + tiles = {"default_tree_top.png", "default_tree_top.png", + "technic_rubber_tree_full.png"}, + groups = {tree=1, snappy=1, choppy=2, oddly_breakable_by_hand=1, + flammable=2}, + drop = "default:tree", + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node(":moretrees:rubber_tree_trunk_empty", { + tiles = {"default_tree_top.png", "default_tree_top.png", + "technic_rubber_tree_empty.png"}, + groups = {tree=1, snappy=1, choppy=2, oddly_breakable_by_hand=1, + flammable=2, not_in_creative_inventory=1}, + drop = "default:tree", + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_abm({ + nodenames = {"moretrees:rubber_tree_trunk_empty"}, + interval = 60, + chance = 15, + action = function(pos, node) + minetest.set_node(pos, {name="moretrees:rubber_tree_trunk"}) + end +}) + +minetest.register_node(":moretrees:rubber_tree_leaves", { + drawtype = "allfaces_optional", + visual_scale = 1.3, + tiles = {"technic_rubber_leaves.png"}, + paramtype = "light", + groups = {snappy=3, leafdecay=3, flammable=2, not_in_creative_inventory=1}, + drop = { + max_items = 1, + items = {{ + items = {"moretrees:rubber_tree_sapling"}, + rarity = 20, + }} + }, + sounds = default.node_sound_leaves_defaults(), +}) + +technic.rubber_tree_model={ + axiom = "FFFFA", + rules_a = "[&FFBFA]////[&BFFFA]////[&FBFFA]", + rules_b = "[&FFA]////[&FFA]////[&FFA]", + trunk = "moretrees:rubber_tree_trunk", + leaves = "moretrees:rubber_tree_leaves", + angle = 35, + iterations = 3, + random_level = 1, + trunk_type = "double", + thin_branches = true +} + +minetest.register_abm({ + nodenames = {"moretrees:rubber_tree_sapling"}, + interval = 60, + chance = 20, + action = function(pos, node) + minetest.remove_node(pos) + minetest.spawn_tree(pos, technic.rubber_tree_model) + end +}) + +if technic.config:get_bool("enable_rubber_tree_generation") then + minetest.register_on_generated(function(minp, maxp, blockseed) + if math.random(1, 100) > 5 then + return + end + local tmp = { + x = (maxp.x - minp.x) / 2 + minp.x, + y = (maxp.y - minp.y) / 2 + minp.y, + z = (maxp.z - minp.z) / 2 + minp.z} + local pos = minetest.find_node_near(tmp, maxp.x - minp.x, + {"default:dirt_with_grass"}) + if pos ~= nil then + minetest.spawn_tree({x=pos.x, y=pos.y+1, z=pos.z}, technic.rubber_tree_model) + end + end) +end + |