New recipst

This commit is contained in:
ConfidentOwl 2022-12-25 21:02:57 +03:00
parent c244f155a6
commit 6cf86adcb2
5 changed files with 92 additions and 2 deletions

View File

@ -6,6 +6,7 @@
"mcl_core",
"mcl_formspec",
"owl_tech",
"i3"
"i3",
"mcl_vars"
]
}

View File

@ -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

View File

@ -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"),

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

14
tools/init.lua Normal file
View File

@ -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 },
})