diff --git a/.vscode/settings.json b/.vscode/settings.json index db75f52..71521be 100755 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,6 +6,7 @@ "mcl_core", "mcl_formspec", "owl_tech", - "i3" + "i3", + "mcl_vars" ] } \ No newline at end of file diff --git a/init.lua b/init.lua index 8fd5a6e..f7151ea 100755 --- a/init.lua +++ b/init.lua @@ -6,6 +6,7 @@ local i3_name = minetest.get_modpath('i3') dofile(path .. "/api/init.lua") --all base func +dofile(path .. "/tools/init.lua") --Tools dofile(path .. "/ore/init.lua") --ore loads dofile(path .. "/debug_tools/init.lua") --debug_tools don.t use in surv game --dofile(path .. "/xray/init.lua") --xray don.t use in surv game @@ -17,4 +18,4 @@ dofile(path .. "/lists_of_all.lua") --GLOBAL carialbe if i3_name~=nil then dofile(path .. "/i3_integration/init.lua") --i3 integration end -dofile(path .. "/multiblocks/init.lua") --Multi-nodes \ No newline at end of file +dofile(path .. "/multiblocks/init.lua") --Multi-nodes diff --git a/ore/node_register.lua b/ore/node_register.lua index c9b055a..31c2ee9 100755 --- a/ore/node_register.lua +++ b/ore/node_register.lua @@ -2,6 +2,71 @@ local S = minetest.get_translator(minetest.get_current_modname()) local name = minetest.get_current_modname() local path = minetest.get_modpath(name) +local make_grass_path = function(itemstack, placer, pointed_thing) + -- Use pointed node's on_rightclick function first, if present + local node = minetest.get_node(pointed_thing.under) + if placer and not placer:get_player_control().sneak then + if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then + return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack + end + end + + -- Only make grass path if tool used on side or top of target node + if pointed_thing.above.y < pointed_thing.under.y then + return itemstack + end + + if (minetest.get_item_group(node.name, "path_creation_possible") == 1) then + local above = table.copy(pointed_thing.under) + above.y = above.y + 1 + if minetest.get_node(above).name == "air" then + if minetest.is_protected(pointed_thing.under, placer:get_player_name()) then + minetest.record_protection_violation(pointed_thing.under, placer:get_player_name()) + return itemstack + end + + if not minetest.is_creative_enabled(placer:get_player_name()) then + -- Add wear (as if digging a shovely node) + local toolname = itemstack:get_name() + local wear = mcl_autogroup.get_wear(toolname, "shovely") + itemstack:add_wear(wear) + end + minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = above}, true) + minetest.swap_node(pointed_thing.under, {name="mcl_core:grass_path"}) + end + end + return itemstack +end + +-- Axes +local function make_stripped_trunk(itemstack, placer, pointed_thing) + if pointed_thing.type ~= "node" then return end + + local node = minetest.get_node(pointed_thing.under) + local noddef = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name] + + if not placer:get_player_control().sneak and noddef.on_rightclick then + return minetest.item_place(itemstack, placer, pointed_thing) + end + if minetest.is_protected(pointed_thing.under, placer:get_player_name()) then + minetest.record_protection_violation(pointed_thing.under, placer:get_player_name()) + return itemstack + end + + if noddef._mcl_stripped_variant == nil then + return itemstack + else + minetest.swap_node(pointed_thing.under, {name=noddef._mcl_stripped_variant, param2=node.param2}) + if not minetest.is_creative_enabled(placer:get_player_name()) then + -- Add wear (as if digging a axey node) + local toolname = itemstack:get_name() + local wear = mcl_autogroup.get_wear(toolname, "axey") + itemstack:add_wear(wear) + end + end + return itemstack +end + local hoe_on_place_function = function(wear_divisor) --Copy-past from mcl_farming ( in mc it local func adn can 't access to mod ') return function(itemstack, user, pointed_thing) -- Call on_rightclick if the pointed node defines it @@ -104,6 +169,15 @@ for i, value in ipairs(metals_ore_array) do stack_max = 64, groups = { craftitem=1 }, }) + --Cafte plate + minetest.register_craft({ + type = "shapeless", + output = "owl_tech:"..metals_ore_array[i][1].."_plate", + recipe = {"owl_tech:work_hammer","owl_tech:"..metals_ore_array[i][1].."_ingot","owl_tech:"..metals_ore_array[i][1].."_ingot"}, + replacements = { + {"owl_tech:work_hammer", "owl_tech:work_hammer"}, + } + }) --pick minetest.register_tool("owl_tech:pick_".. metals_ore_array[i][1], { description = S( metals_ore_array[i][2].." Pickaxe"), diff --git a/textures/owl_tech_work_hammer_head.png b/textures/owl_tech_work_hammer_head.png new file mode 100644 index 0000000..8252655 Binary files /dev/null and b/textures/owl_tech_work_hammer_head.png differ diff --git a/tools/init.lua b/tools/init.lua new file mode 100644 index 0000000..846e672 --- /dev/null +++ b/tools/init.lua @@ -0,0 +1,14 @@ +--List of all tools like ( hammers , file ets) + +local S = minetest.get_translator(minetest.get_current_modname()) +local name = minetest.get_current_modname() +local path = minetest.get_modpath(name) +--owl_tech_work_hammer_head.png owl_tech_hoe_stick.png + +minetest.register_craftitem("owl_tech:work_hammer", { + description = S("Work hammer"), + _doc_items_longdesc = S("First way to get plater"), + inventory_image = "owl_tech_work_hammer_head.png^owl_tech_hoe_stick.png", + stack_max = 64, + groups = { craftitem = 1 }, +}) \ No newline at end of file