diff options
27 files changed, 728 insertions, 49 deletions
diff --git a/extranodes/init.lua b/extranodes/init.lua index eb54067..4b304b1 100644 --- a/extranodes/init.lua +++ b/extranodes/init.lua @@ -185,3 +185,14 @@ minetest.register_craft({ { "technic:raw_latex", "default:fence_wood", "technic:raw_latex"}, } }) + +minetest.register_craftitem(":technic:diamond_seed", { + description = "Diamond Seed", + inventory_image = "technic_diamond_seed.png", +}) + +minetest.register_craft({ + type = "cooking", + output = "technic:diamond_seed", + recipe = "technic:graphite" +})
\ No newline at end of file diff --git a/technic/depends.txt b/technic/depends.txt index 5bf9f9f..c052452 100644 --- a/technic/depends.txt +++ b/technic/depends.txt @@ -9,4 +9,4 @@ digilines? digiline_remote? intllib? unified_inventory? -vector_extras? +vector_extras?
\ No newline at end of file diff --git a/technic/machines/HV/electric_furnace.lua b/technic/machines/HV/electric_furnace.lua new file mode 100644 index 0000000..a11bb59 --- /dev/null +++ b/technic/machines/HV/electric_furnace.lua @@ -0,0 +1,18 @@ +-- MV Electric Furnace +-- This is a faster version of the stone furnace which runs on EUs +-- In addition to this it can be upgraded with microcontrollers and batteries +-- This new version uses the batteries to lower the power consumption of the machine +-- Also in addition this furnace can be attached to the pipe system from the pipeworks mod. + +-- FIXME: kpoppel I'd like to introduce an induction heating element here also +minetest.register_craft({ + output = 'technic:hv_electric_furnace', + recipe = { + {'technic:stainless_steel_ingot', 'technic:lv_electric_furnace', 'technic:stainless_steel_ingot'}, + {'pipeworks:tube_1', 'technic:hv_transformer', 'pipeworks:tube_1'}, + {'technic:stainless_steel_ingot', 'technic:hv_cable', 'technic:stainless_steel_ingot'}, + } +}) + +technic.register_electric_furnace({tier="HV", upgrade=1, tube=1, demand={4000, 2500, 1500}, speed=12}) + diff --git a/technic/machines/HV/init.lua b/technic/machines/HV/init.lua index d7136b4..20e256b 100644 --- a/technic/machines/HV/init.lua +++ b/technic/machines/HV/init.lua @@ -15,4 +15,6 @@ dofile(path.."/generator.lua") -- Machines dofile(path.."/quarry.lua") dofile(path.."/forcefield.lua") +dofile(path.."/electric_furnace.lua") + diff --git a/technic/machines/LV/cnc.lua b/technic/machines/LV/cnc.lua index 58ec6ba..6ca9b3c 100644 --- a/technic/machines/LV/cnc.lua +++ b/technic/machines/LV/cnc.lua @@ -171,7 +171,7 @@ local run = function(pos, node) meta:set_int("src_time", meta:get_int("src_time") + 1) if meta:get_int("src_time") >= 3 then -- 3 ticks per output meta:set_int("src_time", 0) - srcstack = inv:get_stack("src", 1) + local srcstack = inv:get_stack("src", 1) srcstack:take_item() inv:set_stack("src", 1, srcstack) inv:add_item("dst", result.." "..meta:get_int("cnc_multiplier")) diff --git a/technic/machines/LV/cnc_api.lua b/technic/machines/LV/cnc_api.lua index f5aae5c..6637fb7 100644 --- a/technic/machines/LV/cnc_api.lua +++ b/technic/machines/LV/cnc_api.lua @@ -303,7 +303,8 @@ function technic.cnc.register_program(recipeitem, suffix, model, groups, images, walkable = true, groups = groups, selection_box = sbox, - collision_box = cbox + collision_box = cbox, + light_source = groups.light_source, }) end diff --git a/technic/machines/LV/cnc_nodes.lua b/technic/machines/LV/cnc_nodes.lua index 05be9af..2440702 100644 --- a/technic/machines/LV/cnc_nodes.lua +++ b/technic/machines/LV/cnc_nodes.lua @@ -1,7 +1,7 @@ -- REGISTER MATERIALS AND PROPERTIES FOR NONCUBIC ELEMENTS: ----------------------------------------------------------- -local S = technic.getter +local S=technic.getter -- DIRT ------- @@ -15,18 +15,77 @@ technic.cnc.register_all("default:wood", {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}, {"default_wood.png"}, S("Wooden")) + +technic.cnc.register_all("default:junglewood", + {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}, + {"default_junglewood.png"}, + S("Junglewood")) + +technic.cnc.register_all("default:pine_wood", + {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}, + {"default_pine_wood.png"}, + S("Pine")) + +technic.cnc.register_all("default:acacia_wood", + {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}, + {"default_acacia_wood.png"}, + S("Acacia")) + +technic.cnc.register_all("default:aspen_wood", + {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}, + {"default_aspen_wood.png"}, + S("Aspen")) + -- STONE -------- technic.cnc.register_all("default:stone", - {cracky=3, not_in_creative_inventory=1}, + {cracky=3, stone=1, not_in_creative_inventory=1}, {"default_stone.png"}, S("Stone")) + +technic.cnc.register_all("default:stonebrick", + {crumbly=2, cracky=3, stone=1, not_in_creative_inventory=1}, + {"default_stone_brick.png"}, + S("Stone Brick")) + +technic.cnc.register_all("default:stone_block", + {crumbly=2, cracky=3, stone=1, not_in_creative_inventory=1}, + {"default_stone_block.png"}, + S("Stone Block")) + + +technic.cnc.register_all("default:desert_stone", + {cracky=3, stone=1, not_in_creative_inventory=1}, + {"default_desert_stone.png"}, + S("Desert Stone")) + +technic.cnc.register_all("default:desert_stonebrick", + {crumbly=2, cracky=3, stone=1, not_in_creative_inventory=1}, + {"default_desert_stone_brick.png"}, + S("Desert Stone Brick")) + +technic.cnc.register_all("default:desert_stone_block", + {crumbly=2, cracky=3, stone=1, not_in_creative_inventory=1}, + {"default_desert_stone_block.png"}, + S("Desert Stone Block")) + -- COBBLE --------- technic.cnc.register_all("default:cobble", - {cracky=3, not_in_creative_inventory=1}, + {cracky=3, stone=1, not_in_creative_inventory=1}, {"default_cobble.png"}, S("Cobble")) + +technic.cnc.register_all("default:mossycobble", + {cracky=3, stone=1, not_in_creative_inventory=1}, + {"default_mossycobble.png"}, + S("Mossy Cobblestone")) + +technic.cnc.register_all("default:desert_cobble", + {cracky=3, stone=1, not_in_creative_inventory=1}, + {"default_desert_cobble.png"}, + S("Desert Cobble")) + -- BRICK -------- technic.cnc.register_all("default:brick", @@ -34,6 +93,7 @@ technic.cnc.register_all("default:brick", {"default_brick.png"}, S("Brick")) + -- SANDSTONE ------------ technic.cnc.register_all("default:sandstone", @@ -41,12 +101,50 @@ technic.cnc.register_all("default:sandstone", {"default_sandstone.png"}, S("Sandstone")) --- LEAVES ---------- -technic.cnc.register_all("default:leaves", - {snappy=2, choppy=2, oddly_breakable_by_hand=3, not_in_creative_inventory=1}, - {"default_leaves.png"}, - S("Leaves")) +technic.cnc.register_all("default:sandstonebrick", + {crumbly=2, cracky=3, not_in_creative_inventory=1}, + {"default_sandstone_brick.png"}, + S("Sandstone Brick")) + +technic.cnc.register_all("default:sandstone_block", + {crumbly=2, cracky=3, not_in_creative_inventory=1}, + {"default_sandstone_block.png"}, + S("Sandstone Block")) + + +technic.cnc.register_all("default:desert_sandstone", + {crumbly=2, cracky=3, not_in_creative_inventory=1}, + {"default_desert_sandstone.png"}, + S("Desert Sandstone")) + +technic.cnc.register_all("default:desert_sandstone_brick", + {crumbly=2, cracky=3, not_in_creative_inventory=1}, + {"default_desert_sandstone_brick.png"}, + S("Desert Sandstone Brick")) + +technic.cnc.register_all("default:desert_sandstone_block", + {crumbly=2, cracky=3, not_in_creative_inventory=1}, + {"default_desert_sandstone_block.png"}, + S("Desert Sandstone Block")) + + +technic.cnc.register_all("default:silver_sandstone", + {crumbly=2, cracky=3, not_in_creative_inventory=1}, + {"default_silver_sandstone.png"}, + S("Silver Sandstone")) + +technic.cnc.register_all("default:silver_sandstone_brick", + {crumbly=2, cracky=3, not_in_creative_inventory=1}, + {"default_silver_sandstone_brick.png"}, + S("Silver Sandstone Brick")) + +technic.cnc.register_all("default:silver_sandstone_block", + {crumbly=2, cracky=3, not_in_creative_inventory=1}, + {"default_silver_sandstone_block.png"}, + S("Silver Sandstone Block")) + + + -- TREE ------- technic.cnc.register_all("default:tree", @@ -54,6 +152,22 @@ technic.cnc.register_all("default:tree", {"default_tree.png"}, S("Tree")) +-- ICE +------- +technic.cnc.register_all("default:ice", + {cracky=3, puts_out_fire=1, cools_lava=1, not_in_creative_inventory=1}, + {"default_ice.png"}, + S("Ice")) + + +-- OBSIDIAN +----------- +technic.cnc.register_all("default:obsidian_block", + {cracky=1, level=2, not_in_creative_inventory=1}, + {"default_obsidian_block.png"}, + S("Obsidian")) + + -- WROUGHT IRON --------------- technic.cnc.register_all("default:steelblock", @@ -68,13 +182,63 @@ technic.cnc.register_all("default:bronzeblock", {"default_bronze_block.png"}, S("Bronze")) --- Stainless Steel +-- Zinc -------- +technic.cnc.register_all("technic:zinc_block", + {cracky=1, level=2, not_in_creative_inventory=1}, + {"technic_zinc_block.png"}, + S("Zinc")) + +-- Cast Iron +------------ +technic.cnc.register_all("technic:cast_iron_block", + {cracky=1, level=2, not_in_creative_inventory=1}, + {"technic_cast_iron_block.png"}, + S("Cast Iron")) + +-- Stainless Steel +------------------ technic.cnc.register_all("technic:stainless_steel_block", {cracky=1, level=2, not_in_creative_inventory=1}, {"technic_stainless_steel_block.png"}, S("Stainless Steel")) +-- Carbon steel +--------------- +technic.cnc.register_all("technic:carbon_steel_block", + {cracky=1, level=2, not_in_creative_inventory=1}, + {"technic_carbon_steel_block.png"}, + S("Carbon Steel")) + +-- Brass +-------- +technic.cnc.register_all("technic:brass_block", + {cracky=1, level=2, not_in_creative_inventory=1}, + {"technic_brass_block.png"}, + S("Brass")) + +-- Copper +--------- +technic.cnc.register_all("default:copperblock", + {cracky=1, level=2, not_in_creative_inventory=1}, + {"default_copper_block.png"}, + S("Copper")) + +-- Tin +------ +technic.cnc.register_all("default:tinblock", + {cracky=1, level=2, not_in_creative_inventory=1}, + {"default_tin_block.png"}, + S("Tin")) + +-- Gold +------- +technic.cnc.register_all("default:goldblock", + {cracky=1, level=2, not_in_creative_inventory=1}, + {"default_gold_block.png"}, + S("Gold")) + + -- Marble ------------ technic.cnc.register_all("technic:marble", @@ -89,3 +253,129 @@ technic.cnc.register_all("technic:granite", {"technic_granite.png"}, S("Granite")) + +if minetest.get_modpath("ethereal") then + -- Glostone + ------------ + technic.cnc.register_all("ethereal:glostone", + {cracky=1, not_in_creative_inventory=1, light_source=13}, + {"glostone.png"}, + S("Glo Stone")) + +end + + +if minetest.get_modpath("ethereal") then + -- Glostone + ------------ + technic.cnc.register_all("ethereal:glostone", + {cracky=1, not_in_creative_inventory=1, light_source=13}, + {"glostone.png"}, + S("Glo Stone")) + + -- Crystal block + ---------------- + technic.cnc.register_all("ethereal:crystal_block", + {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}, + {"crystal_block.png"}, + S("Crystal")) + + -- Misc. Wood types + ------------------- + technic.cnc.register_all("ethereal:banana_wood", + {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}, + {"banana_wood.png"}, + S("Banana Wood")) + + technic.cnc.register_all("ethereal:birch_wood", + {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}, + {"moretrees_birch_wood.png"}, + S("Birch Wood")) + + technic.cnc.register_all("ethereal:frost_wood", + {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}, + {"frost_wood.png"}, + S("Frost Wood")) + + technic.cnc.register_all("ethereal:palm_wood", + {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}, + {"moretrees_palm_wood.png"}, + S("Palm Wood")) + + technic.cnc.register_all("ethereal:willow_wood", + {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}, + {"willow_wood.png"}, + S("Willow Wood")) + + technic.cnc.register_all("ethereal:yellow_wood", + {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}, + {"yellow_wood.png"}, + S("Healing Tree Wood")) + + technic.cnc.register_all("ethereal:redwood_wood", + {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}, + {"redwood_wood.png"}, + S("Redwood")) +end + + +if minetest.get_modpath("moreblocks") then + -- Tiles + ------------ + technic.cnc.register_all("moreblocks:stone_tile", + {stone=1, cracky=3, not_in_creative_inventory=1}, + {"moreblocks_stone_tile.png"}, + S("Stone Tile")) + + technic.cnc.register_all("moreblocks:split_stone_tile", + {stone=1, cracky=3, not_in_creative_inventory=1}, + {"moreblocks_split_stone_tile.png"}, + S("Split Stone Tile")) + + technic.cnc.register_all("moreblocks:checker_stone_tile", + {stone=1, cracky=3, not_in_creative_inventory=1}, + {"moreblocks_checker_stone_tile.png"}, + S("Checker Stone Tile")) + + technic.cnc.register_all("moreblocks:cactus_checker", + {stone=1, cracky=3, not_in_creative_inventory=1}, + {"moreblocks_cactus_checker.png"}, + S("Cactus Checker")) + + -- Bricks + ------------ + technic.cnc.register_all("moreblocks:cactus_brick", + {cracky=3, not_in_creative_inventory=1}, + {"moreblocks_cactus_brick.png"}, + S("Cactus Brick")) + + technic.cnc.register_all("moreblocks:grey_bricks", + {cracky=3, not_in_creative_inventory=1}, + {"moreblocks_grey_bricks.png"}, + S("Grey Bricks")) + + -- Metals + ------------ + technic.cnc.register_all("moreblocks:copperpatina", + {cracky=1, level=2, not_in_creative_inventory=1}, + {"moreblocks_copperpatina.png"}, + S("Copper Patina")) + + -- Clay + ------------ + technic.cnc.register_all("bakedclay:red", + {cracky=3, not_in_creative_inventory=1}, + {"baked_clay_red.png"}, + S("Red Clay")) + + technic.cnc.register_all("bakedclay:orange", + {cracky=3, not_in_creative_inventory=1}, + {"baked_clay_orange.png"}, + S("Orange Clay")) + + technic.cnc.register_all("bakedclay:grey", + {cracky=3, not_in_creative_inventory=1}, + {"baked_clay_grey.png"}, + S("Grey Clay")) + +end diff --git a/technic/machines/register/alloy_recipes.lua b/technic/machines/register/alloy_recipes.lua index bd09bd6..49c41f4 100644 --- a/technic/machines/register/alloy_recipes.lua +++ b/technic/machines/register/alloy_recipes.lua @@ -30,6 +30,12 @@ local recipes = { {"technic:raw_latex 4", "technic:coal_dust 2", "technic:rubber 6", 2}, } +if minetest.get_modpath("ethereal") then + table.insert(recipes, {"default:clay", "dye:red", "bakedclay:red"}) + table.insert(recipes, {"default:clay", "dye:orange", "bakedclay:orange"}) + table.insert(recipes, {"default:clay", "dye:grey", "bakedclay:grey"}) +end + for _, data in pairs(recipes) do technic.register_alloy_recipe({input = {data[1], data[2]}, output = data[3], time = data[4]}) end diff --git a/technic/machines/register/centrifuge_recipes.lua b/technic/machines/register/centrifuge_recipes.lua index 4684ba0..6b887fa 100644 --- a/technic/machines/register/centrifuge_recipes.lua +++ b/technic/machines/register/centrifuge_recipes.lua @@ -15,7 +15,7 @@ local recipes = { { "technic:stainless_steel_dust 4", "technic:wrought_iron_dust 3", "technic:chromium_dust" }, { "technic:brass_dust 3", "technic:copper_dust 2", "technic:zinc_dust" }, { "technic:chernobylite_dust", "default:sand", "technic:uranium3_dust" }, - { "default:dirt 4", "default:sand", "default:gravel", "default:clay_lump 2" }, + { "default:dirt 4", "default:sand", "default:gravel", "default:clay_lump 4" }, } local function uranium_dust(p) @@ -32,7 +32,15 @@ if minetest.get_modpath("bushes_classic") then end if minetest.get_modpath("farming") then - table.insert(recipes, { "farming:wheat 4", "farming:seed_wheat 3", "default:dry_shrub 1" }) + if minetest.get_modpath("cottages") then + -- work as a mechanized threshing floor + table.insert(recipes, { "farming:wheat", "farming:seed_wheat", "cottages:straw_mat" }) + table.insert(recipes, { "farming:barley", "farming:seed_barley", "cottages:straw_mat" }) + else + -- work in a less fancy and less efficient manner + table.insert(recipes, { "farming:wheat 4", "farming:seed_wheat 3", "default:dry_shrub 1" }) + table.insert(recipes, { "farming:barley 4", "farming:seed_barley 3", "default:dry_shrub 1" }) + end end for _, data in pairs(recipes) do diff --git a/technic/machines/register/compressor_recipes.lua b/technic/machines/register/compressor_recipes.lua index a625f1a..02fd741 100644 --- a/technic/machines/register/compressor_recipes.lua +++ b/technic/machines/register/compressor_recipes.lua @@ -17,8 +17,15 @@ local recipes = { {"technic:coal_dust 4", "technic:graphite"}, {"technic:carbon_cloth", "technic:carbon_plate"}, {"technic:uranium35_ingot 5", "technic:uranium_fuel"}, + {"technic:diamond_seed 25", "default:diamond"} } +if minetest.get_modpath("ethereal") then + -- the density of charcoal is ~1/10 of coal, otherwise it's pure carbon + table.insert(recipes, {"ethereal:charcoal_lump 10", "default:coal_lump 1"}) +end + + -- defuse the default sandstone recipe, since we have the compressor to take over in a more realistic manner minetest.clear_craft({ output = "default:sandstone", diff --git a/technic/machines/register/grinder_recipes.lua b/technic/machines/register/grinder_recipes.lua index fa55e7a..241d2ae 100644 --- a/technic/machines/register/grinder_recipes.lua +++ b/technic/machines/register/grinder_recipes.lua @@ -29,6 +29,11 @@ local recipes = { {"default:sandstone", "default:sand 2"}, -- reverse recipe can be found in the compressor } +if minetest.get_modpath("ethereal") then + -- the density of charcoal is ~1/10 of coal, otherwise it's the same graphitic carbon + table.insert(recipes, {"ethereal:charcoal_lump 5", "technic:coal_dust 1"}) +end + -- defuse the sandstone -> 4 sand recipe to avoid infinite sand bugs (also consult the inverse compressor recipe) minetest.clear_craft({ recipe = { @@ -38,6 +43,30 @@ minetest.clear_craft({ if minetest.get_modpath("farming") then table.insert(recipes, {"farming:seed_wheat", "farming:flour 1"}) + table.insert(recipes, {"farming:seed_barley", "farming:flour 1"}) + + -- added by dhausmig + if minetest.registered_items["farming:corn"] ~= nil then + minetest.register_craftitem("technic:cornmeal", { + description = S("Corn Meal"), + inventory_image = "technic_cornmeal.png", + }) + minetest.register_craftitem("technic:cornbread", { + description = S("Cornbread"), + inventory_image = "technic_cornbread.png", + on_use = minetest.item_eat(8), + }) + + minetest.register_craft({ + type = "cooking", + cooktime = 10, + output = "technic:cornbread", + recipe = "technic:cornmeal" + }) + + table.insert(recipes, {"farming:corn", "technic:cornmeal 2"}) + -- end of dhausmig's addition + end end if minetest.get_modpath("moreores") then diff --git a/technic/sounds/technic_lawn_trimmer.ogg b/technic/sounds/technic_lawn_trimmer.ogg Binary files differnew file mode 100644 index 0000000..9ec6886 --- /dev/null +++ b/technic/sounds/technic_lawn_trimmer.ogg diff --git a/technic/textures/technic_chainsaw_mk2.png b/technic/textures/technic_chainsaw_mk2.png Binary files differnew file mode 100644 index 0000000..92186f8 --- /dev/null +++ b/technic/textures/technic_chainsaw_mk2.png diff --git a/technic/textures/technic_cornbread.png b/technic/textures/technic_cornbread.png Binary files differnew file mode 100644 index 0000000..32674f2 --- /dev/null +++ b/technic/textures/technic_cornbread.png diff --git a/technic/textures/technic_cornmeal.png b/technic/textures/technic_cornmeal.png Binary files differnew file mode 100644 index 0000000..e17bb69 --- /dev/null +++ b/technic/textures/technic_cornmeal.png diff --git a/technic/textures/technic_diamond_seed.png b/technic/textures/technic_diamond_seed.png Binary files differnew file mode 100644 index 0000000..53d88fb --- /dev/null +++ b/technic/textures/technic_diamond_seed.png diff --git a/technic/textures/technic_hv_electric_furnace_bottom.png b/technic/textures/technic_hv_electric_furnace_bottom.png Binary files differnew file mode 100644 index 0000000..3f65026 --- /dev/null +++ b/technic/textures/technic_hv_electric_furnace_bottom.png diff --git a/technic/textures/technic_hv_electric_furnace_front.png b/technic/textures/technic_hv_electric_furnace_front.png Binary files differnew file mode 100644 index 0000000..5051cd8 --- /dev/null +++ b/technic/textures/technic_hv_electric_furnace_front.png diff --git a/technic/textures/technic_hv_electric_furnace_front_active.png b/technic/textures/technic_hv_electric_furnace_front_active.png Binary files differnew file mode 100644 index 0000000..76dfbb3 --- /dev/null +++ b/technic/textures/technic_hv_electric_furnace_front_active.png diff --git a/technic/textures/technic_hv_electric_furnace_side.png b/technic/textures/technic_hv_electric_furnace_side.png Binary files differnew file mode 100644 index 0000000..c30a09e --- /dev/null +++ b/technic/textures/technic_hv_electric_furnace_side.png diff --git a/technic/textures/technic_hv_electric_furnace_side_tube.png b/technic/textures/technic_hv_electric_furnace_side_tube.png Binary files differnew file mode 100644 index 0000000..f94c057 --- /dev/null +++ b/technic/textures/technic_hv_electric_furnace_side_tube.png diff --git a/technic/textures/technic_hv_electric_furnace_top.png b/technic/textures/technic_hv_electric_furnace_top.png Binary files differnew file mode 100644 index 0000000..e3d4195 --- /dev/null +++ b/technic/textures/technic_hv_electric_furnace_top.png diff --git a/technic/textures/technic_lawn_trimmer.png b/technic/textures/technic_lawn_trimmer.png Binary files differnew file mode 100644 index 0000000..d44676a --- /dev/null +++ b/technic/textures/technic_lawn_trimmer.png diff --git a/technic/textures/technicx32/technic_cornbread.png b/technic/textures/technicx32/technic_cornbread.png Binary files differnew file mode 100644 index 0000000..05e0416 --- /dev/null +++ b/technic/textures/technicx32/technic_cornbread.png diff --git a/technic/tools/chainsaw.lua b/technic/tools/chainsaw.lua index 3653d2d..80e2bc2 100644 --- a/technic/tools/chainsaw.lua +++ b/technic/tools/chainsaw.lua @@ -1,6 +1,7 @@ -- Configuration -local chainsaw_max_charge = 30000 -- Maximum charge of the saw +local chainsaw_max_charge = 30000 -- Maximum charge of the saw +local chainsaw_max_charge_mk2 = 120000 -- Gives 2500 nodes on a single charge (about 50 complete normal trees) local chainsaw_charge_per_node = 12 -- Cut down tree leaves. Leaf decay may cause slowness on large trees @@ -119,6 +120,39 @@ if minetest.get_modpath("growing_cactus") then timber_nodenames["growing_cactus:branch_xx"] = true end +-- Support ethereal +if minetest.get_modpath("ethereal") then + timber_nodenames["ethereal:willow_trunk"] = true + timber_nodenames["ethereal:redwood_trunk"] = true + timber_nodenames["ethereal:frost_tree"] = true + timber_nodenames["ethereal:yellow_trunk"] = true + timber_nodenames["ethereal:birch_trunk"] = true + timber_nodenames["ethereal:palm_trunk"] = true + timber_nodenames["ethereal:banana_trunk"] = true + timber_nodenames["ethereal:bamboo"] = true + timber_nodenames["ethereal:mushroom_trunk"] = true + timber_nodenames["ethereal:scorched_tree"] = true + + if chainsaw_leaves then + timber_nodenames["ethereal:willow_twig"] = true + timber_nodenames["ethereal:redwood_leaves"] = true + timber_nodenames["ethereal:frost_leaves"] = true + timber_nodenames["ethereal:yellowleaves"] = true + timber_nodenames["ethereal:birch_leaves"] = true + timber_nodenames["ethereal:palmleaves"] = true + timber_nodenames["ethereal:bananaleaves"] = true + timber_nodenames["ethereal:bamboo_leaves"] = true + timber_nodenames["ethereal:mushroom"] = true + timber_nodenames["ethereal:mushroom_pore"] = true + timber_nodenames["ethereal:orange_leaves"] = true + -- fruits + timber_nodenames["ethereal:banana"] = true + timber_nodenames["ethereal:orange"] = true + timber_nodenames["ethereal:coconut"] = true + timber_nodenames["ethereal:golden_apple"] = true + end +end + -- Support farming_plus if minetest.get_modpath("farming_plus") then if chainsaw_leaves then @@ -163,6 +197,7 @@ end local S = technic.getter technic.register_power_tool("technic:chainsaw", chainsaw_max_charge) +technic.register_power_tool("technic:chainsaw_mk2", chainsaw_max_charge_mk2) -- Table for saving what was sawed down local produced = {} @@ -232,9 +267,59 @@ local function iterSawTries(pos) end end + + +local function iterSawTries_mk2(pos) + -- Copy position to prevent mangling it + local pos = vector.new(pos) + local i = 0 + + return function() + i = i + 1 + -- Given a (top view) area like so (where 5 is the starting position): + -- X --> + -- Z 1 2 3 4 5 + -- | 6 7 8 9 10 + -- | 11 12 13 14 15 + -- | 16 17 18 19 20 + -- V 21 22 23 24 25 + -- This will return positions 1...21, 2..,22, 3...23 (skip 13), 4...24, 5...25 + -- and the position above 13. + if i == 1 then + -- Move to starting position + pos.x = pos.x - 2 + pos.z = pos.z - 2 + elseif i == 6 or i == 11 or i == 16 or i == 21 then + -- Move to next X and back to start of Z when we reach + -- the end of a Z line. + pos.x = pos.x + 1 + pos.z = pos.z - 4 + elseif i == 13 then + -- Skip the middle position (we've already run on it) + -- and double-increment the counter. + pos.z = pos.z + 2 + i = i + 1 + elseif i <= 25 then + -- Go to next Z. + pos.z = pos.z + 1 + elseif i == 26 then + -- Move back to center and up. + -- The Y+ position must be last so that we don't dig + -- straight upward and not come down (since the Y- + -- position isn't checked). + pos.x = pos.x - 2 + pos.z = pos.z - 2 + pos.y = pos.y + 1 + else + return nil + end + return pos + end +end + -- This function does all the hard work. Recursively we dig the node at hand -- if it is in the table and then search the surroundings for more stuff to dig. -local function recursive_dig(pos, remaining_charge) +local function recursive_dig(pos, remaining_charge, mk) if remaining_charge < chainsaw_charge_per_node then return remaining_charge end @@ -250,14 +335,37 @@ local function recursive_dig(pos, remaining_charge) remaining_charge = remaining_charge - chainsaw_charge_per_node -- Check surroundings and run recursively if any charge left - for npos in iterSawTries(pos) do - if remaining_charge < chainsaw_charge_per_node then - break + if mk == 1 then + for npos in iterSawTries(pos) do + if remaining_charge < chainsaw_charge_per_node then + break + end + if timber_nodenames[minetest.get_node(npos).name] then + remaining_charge = recursive_dig(npos, remaining_charge, mk) + end end - if timber_nodenames[minetest.get_node(npos).name] then - remaining_charge = recursive_dig(npos, remaining_charge) + elseif mk == 2 then + for npos in iterSawTries_mk2(pos) do + if remaining_charge < chainsaw_charge_per_node then + break + end + if timber_nodenames[minetest.get_node(npos).name] then + remaining_charge = recursive_dig(npos, remaining_charge, mk) + else + local ct = {{x=-1,z=-1},{x=-1,z=1},{x=1,z=-1},{x=1,z=1}} + for _,c in ipairs(ct) do + local pos_alt = vector.new(npos) + pos_alt.x = pos_alt.x + c.x + pos_alt.z = pos_alt.z + c.z + pos_alt.y = pos_alt.y + 1 + if timber_nodenames[minetest.get_node(pos_alt).name] then + remaining_charge = recursive_dig(pos_alt, remaining_charge, mk) + end + end + end end end + return remaining_charge end @@ -296,9 +404,9 @@ local function get_drop_pos(pos) end -- Chainsaw entry point -local function chainsaw_dig(pos, current_charge) +local function chainsaw_dig(pos, current_charge, mk) -- Start sawing things down - local remaining_charge = recursive_dig(pos, current_charge) + local remaining_charge = recursive_dig(pos, current_charge, mk) minetest.sound_play("chainsaw", {pos = pos, gain = 1.0, max_hear_distance = 10}) @@ -322,6 +430,37 @@ local function chainsaw_dig(pos, current_charge) end +local function use_chainsaw(itemstack, user, pointed_thing, mk) + if pointed_thing.type ~= "node" then + return itemstack + end + + local meta = minetest.deserialize(itemstack:get_metadata()) + if not meta or not meta.charge or + meta.charge < chainsaw_charge_per_node then + return + end + + local name = user:get_player_name() + if minetest.is_protected(pointed_thing.under, name) then + minetest.record_protection_violation(pointed_thing.under, name) + return + end + + -- Send current charge to digging function so that the + -- chainsaw will stop after digging a number of nodes + meta.charge = chainsaw_dig(pointed_thing.under, meta.charge, mk) + if not technic.creative_mode then + if mk == 1 then + technic.set_RE_wear(itemstack, meta.charge, chainsaw_max_charge) + elseif mk == 2 then + technic.set_RE_wear(itemstack, meta.charge, chainsaw_max_charge_mk2) + end + itemstack:set_metadata(minetest.serialize(meta)) + end + return itemstack +end + minetest.register_tool("technic:chainsaw", { description = S("Chainsaw"), inventory_image = "technic_chainsaw.png", @@ -329,42 +468,42 @@ minetest.register_tool("technic:chainsaw", { wear_represents = "technic_RE_charge", on_refill = technic.refill_RE_charge, on_use = function(itemstack, user, pointed_thing) - if pointed_thing.type ~= "node" then - return itemstack - end - - local meta = minetest.deserialize(itemstack:get_metadata()) - if not meta or not meta.charge or - meta.charge < chainsaw_charge_per_node then - return - end - - local name = user:get_player_name() - if minetest.is_protected(pointed_thing.under, name) then - minetest.record_protection_violation(pointed_thing.under, name) - return + use_chainsaw(itemstack, user, pointed_thing, 1) + return(itemstack) end +}) - -- Send current charge to digging function so that the - -- chainsaw will stop after digging a number of nodes - meta.charge = chainsaw_dig(pointed_thing.under, meta.charge) - if not technic.creative_mode then - technic.set_RE_wear(itemstack, meta.charge, chainsaw_max_charge) - itemstack:set_metadata(minetest.serialize(meta)) +minetest.register_tool("technic:chainsaw_mk2", { + description = S("Chainsaw Mk2"), + inventory_image = "technic_chainsaw_mk2.png", + stack_max = 1, + wear_represents = "technic_RE_charge", + on_refill = technic.refill_RE_charge, + on_use = function(itemstack, user, pointed_thing) + use_chainsaw(itemstack, user, pointed_thing, 2) + return(itemstack) end - return itemstack - end, }) + local mesecons_button = minetest.get_modpath("mesecons_button") local trigger = mesecons_button and "mesecons_button:button_off" or "default:mese_crystal_fragment" minetest.register_craft({ output = "technic:chainsaw", recipe = { - {"technic:stainless_steel_ingot", trigger, "technic:battery"}, - {"technic:fine_copper_wire", "technic:motor", "technic:battery"}, - {"", "", "technic:stainless_steel_ingot"}, + {"technic:stainless_steel_ingot", trigger, "technic:battery"}, + {"technic:fine_copper_wire", "technic:motor", "technic:battery"}, + {"", "", "technic:stainless_steel_ingot"}, + } +}) + +minetest.register_craft({ + output = "technic:chainsaw_mk2", + recipe = { + {"technic:chainsaw", "technic:stainless_steel_ingot", "technic:stainless_steel_ingot"}, + {"technic:battery", "technic:battery", ""}, + {"technic:battery", "dye:green", ""}, } }) diff --git a/technic/tools/init.lua b/technic/tools/init.lua index 5e0aa02..7d640d1 100644 --- a/technic/tools/init.lua +++ b/technic/tools/init.lua @@ -15,6 +15,7 @@ dofile(path.."/tree_tap.lua") dofile(path.."/sonic_screwdriver.lua") dofile(path.."/prospector.lua") dofile(path.."/vacuum.lua") +dofile(path.."/lawn_trimmer.lua") if minetest.get_modpath("screwdriver") then -- compatibility alias diff --git a/technic/tools/lawn_trimmer.lua b/technic/tools/lawn_trimmer.lua new file mode 100644 index 0000000..fa0004f --- /dev/null +++ b/technic/tools/lawn_trimmer.lua @@ -0,0 +1,167 @@ +--[[ + The Lawn Trimmer, also known as Weed Whacker, is a common gardening power + tool. In minetest, it has several uses. While it removes all members of + 'flora' group and can be used for literally mowing grass or trimming it + around vegetable beds, it's not its most important application. + + 1. The tool can be used when searching for plants that can be cultivated + in the wilderness. Some of them are hard to see through grass; some of + them are hard to tell from the grass; some of them are actually obtained + by removing the grass (e.g. barley seeds). + + 2. Producing organic dye pigments. While growing flowers is a matter of + fertilizing the soil with bone meal, harvesting them by hand is a chore. + + In both scenarios, the tool will be very handy for the player. + It comes with 4 modes of operation, defined by how wide its sweep is: + from 0 (at one's feet) to 3 nodes in radius (square radius, as most + things in minetest are). + + The sound is an edited fragment from + https://www.cutestockfootage.com/sound-effect/9251/grass-trimmer-01 + used in accordance with its licensing terms (free use for any purpose in + an altered form) +]] + +-- Configuration +-- Intended to hold as much as the chainsaw, 10000 units +local lawn_trimmer_max_charge = 10000 +-- With 25 units per object can mow 400 'group:flora' blocks +local lawn_trimmer_charge_per_object = 25 + +local S = technic.getter + +local lawn_trimmer_mode_text = { + S("sweep a single block under the user"), + S("sweep 1 block around the user"), + S("sweep 2 blocks around the user"), + S("sweep 3 blocks around the user") +} + +local node_removed + +-- Mode switcher for the tool +local function lawn_trimmer_setmode(user, itemstack, meta) + local player_name = user:get_player_name() + + if not meta then + meta = {mode = nil} + end + if not meta.mode then + minetest.chat_send_player(player_name, + S("Use while sneaking to change Lawn Trimmer modes.")) + meta.mode = 0 + end + + meta.mode = meta.mode % 4 + 1 + + minetest.chat_send_player(player_name, + S("Lawn Trimmer Mode %d"):format(meta.mode) .. ": " + .. lawn_trimmer_mode_text[meta.mode]) + itemstack:set_name("technic:lawn_trimmer_" .. meta.mode); + itemstack:set_metadata(minetest.serialize(meta)) + return itemstack +end + + +-- Perform the trimming action +local function trim_the_lawn(itemstack, user) + local meta = minetest.deserialize(itemstack:get_metadata()) + local keys = user:get_player_control() + + if not meta or not meta.mode or keys.sneak then + return lawn_trimmer_setmode(user, itemstack, meta) + end + + meta.charge = meta.charge or 0 + + if meta.charge < lawn_trimmer_charge_per_object then + return -- no charge for even a single node, aborting + end + + minetest.sound_play("technic_lawn_trimmer", { + to_player = user:get_player_name(), + gain = 0.4, + }) + + local pos = user:get_pos() + -- Defining the area for the search needs two positions + -- The tool has a limited range in the vertical axis, which is capped at +/- 1 node + local start_pos = { + x = pos.x - meta.mode + 1, + z = pos.z - meta.mode + 1, + y = pos.y - 1 + } + local end_pos = { + x = pos.x + meta.mode - 1, + z = pos.z + meta.mode - 1, + y = pos.y + 1 + } + + -- Since nodes sometimes cannot be removed, we cannot rely on repeating + -- find_node_near() and removing found nodes + local found_flora = minetest.find_nodes_in_area(start_pos, end_pos, {"group:flora"}) + for _, f in ipairs(found_flora) do + node_removed = false + -- Callback will set the flag to true if the node is dug successfully, + -- otherwise skip to the next one. + minetest.node_dig(f, minetest.get_node(f), user) + if node_removed then + meta.charge = meta.charge - lawn_trimmer_charge_per_object + -- Abort if no charge left for another node + if meta.charge < lawn_trimmer_charge_per_object then break end + end + end + + -- The charge won't expire in creative mode, but the tool still + -- has to be charged prior to use + if not technic.creative_mode then + technic.set_RE_wear(itemstack, meta.charge, lawn_trimmer_max_charge) + itemstack:set_metadata(minetest.serialize(meta)) + end + return itemstack +end + +function check_removal() + node_removed = true +end + +-- Register the tool and its varieties in the game +technic.register_power_tool("technic:lawn_trimmer", lawn_trimmer_max_charge) +minetest.register_tool("technic:lawn_trimmer", { + description = S("Lawn Trimmer"), + inventory_image = "technic_lawn_trimmer.png", + stack_max = 1, + wear_represents = "technic_RE_charge", + on_refill = technic.refill_RE_charge, + on_use = trim_the_lawn, + after_use = check_removal +}) + +for i = 1, 4 do + technic.register_power_tool("technic:lawn_trimmer_" .. i, lawn_trimmer_max_charge) + minetest.register_tool("technic:lawn_trimmer_" .. i, { + description = S("Lawn Trimmer Mode %d"):format(i), + inventory_image = "technic_lawn_trimmer.png^technic_tool_mode" .. i .. ".png", + wield_image = "technic_lawn_trimmer.png", + wear_represents = "technic_RE_charge", + on_refill = technic.refill_RE_charge, + groups = {not_in_creative_inventory = 1}, + on_use = trim_the_lawn, + after_use = check_removal + }) +end + + +-- Provide a crafting recipe +local trigger = minetest.get_modpath("mesecons_button") and "mesecons_button:button_off" + or "default:mese_crystal_fragment" + +minetest.register_craft({ + output = 'technic:lawn_trimmer', + recipe = { + {'', 'default:stick', trigger}, + {'technic:motor', 'default:stick', 'technic:battery'}, + {'technic:stainless_steel_ingot', '', ''}, + } +}) |