#11 Put tabs instead of each 2 spaces

This commit is contained in:
kay27 2022-02-05 02:39:40 +04:00 committed by cora
parent a5fba06a2c
commit e28ccd9a80
2 changed files with 206 additions and 206 deletions

View File

@ -1,47 +1,47 @@
function mcl_amethyst.grow_amethyst_bud(pos,ignore_budding_amethyst) function mcl_amethyst.grow_amethyst_bud(pos,ignore_budding_amethyst)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
if not node.name then return false end if not node.name then return false end
local def = minetest.registered_nodes[node.name] local def = minetest.registered_nodes[node.name]
if not def then return false end if not def then return false end
if not def.groups and def.groups.amethyst_buds then return false end if not def.groups and def.groups.amethyst_buds then return false end
local next_gen = def._mcl_amethyst_next_grade local next_gen = def._mcl_amethyst_next_grade
if not next_gen then return false end if not next_gen then return false end
-- Check Budding Amethyst -- Check Budding Amethyst
if not ignore_budding_amethyst then if not ignore_budding_amethyst then
local dir = minetest.wallmounted_to_dir(node.param2) local dir = minetest.wallmounted_to_dir(node.param2)
local ba_pos = vector.add(pos,dir) local ba_pos = vector.add(pos,dir)
local ba_node = minetest.get_node(ba_pos) local ba_node = minetest.get_node(ba_pos)
if ba_node.name ~= "mcl_amethyst:budding_amethyst_block" then return false end if ba_node.name ~= "mcl_amethyst:budding_amethyst_block" then return false end
end end
local swap_result = table.copy(node) local swap_result = table.copy(node)
swap_result.name = next_gen swap_result.name = next_gen
minetest.swap_node(pos,swap_result) minetest.swap_node(pos,swap_result)
return true return true
end end
local function get_growing_tool_handle(ignore) local function get_growing_tool_handle(ignore)
return function(itemstack, user, pointed_thing) return function(itemstack, user, pointed_thing)
if not user:is_player() then return end if not user:is_player() then return end
local name = user:get_player_name() local name = user:get_player_name()
local pos = minetest.get_pointed_thing_position(pointed_thing) local pos = minetest.get_pointed_thing_position(pointed_thing)
if minetest.is_protected(pos, name) then if minetest.is_protected(pos, name) then
minetest.record_protection_violation(pos, name) minetest.record_protection_violation(pos, name)
minetest.chat_send_player(name,"Not allowed to use Amethyst Growing Tool in a protected area!") minetest.chat_send_player(name,"Not allowed to use Amethyst Growing Tool in a protected area!")
return return
end end
if not mcl_amethyst.grow_amethyst_bud(pos, ignore) then if not mcl_amethyst.grow_amethyst_bud(pos, ignore) then
minetest.chat_send_player(name,"Growing Failed") minetest.chat_send_player(name,"Growing Failed")
end end
end end
end end
minetest.register_tool("mcl_amethyst:growing_tool",{ minetest.register_tool("mcl_amethyst:growing_tool",{
description = "Amethyst Growing Tool", description = "Amethyst Growing Tool",
on_use = get_growing_tool_handle(true), on_use = get_growing_tool_handle(true),
on_place = get_growing_tool_handle(false), on_place = get_growing_tool_handle(false),
inventory_image = "amethyst_cluster.png^amethyst_shard.png", inventory_image = "amethyst_cluster.png^amethyst_shard.png",
groups = { groups = {
tool = 1, tool = 1,
}, },
}) })
mcl_wip.register_experimental_item("mcl_amethyst:growing_tool") mcl_wip.register_experimental_item("mcl_amethyst:growing_tool")

View File

@ -3,210 +3,210 @@ mcl_amethyst = {}
-- Amethyst block -- Amethyst block
minetest.register_node("mcl_amethyst:amethyst_block",{ minetest.register_node("mcl_amethyst:amethyst_block",{
description = S("Block of Amethyst"), description = S("Block of Amethyst"),
tiles = {"amethyst_block.png"}, tiles = {"amethyst_block.png"},
_mcl_hardness = 1.5, _mcl_hardness = 1.5,
_mcl_blast_resistance = 1.5, _mcl_blast_resistance = 1.5,
groups = { groups = {
pickaxey = 1, pickaxey = 1,
building_block = 1, building_block = 1,
}, },
sounds = mcl_sounds.node_sound_glass_defaults(), sounds = mcl_sounds.node_sound_glass_defaults(),
is_ground_content = true, is_ground_content = true,
stack_max = 64, stack_max = 64,
_doc_items_longdesc = S("The Block of Anethyst is a decoration block creft from amethyst shards."), _doc_items_longdesc = S("The Block of Anethyst is a decoration block creft from amethyst shards."),
}) })
-- (WIP!) Budding Amethyst -- (WIP!) Budding Amethyst
minetest.register_node("mcl_amethyst:budding_amethyst_block",{ minetest.register_node("mcl_amethyst:budding_amethyst_block",{
description = S("Budding Amethyst"), description = S("Budding Amethyst"),
tiles = {"budding_amethyst.png"}, tiles = {"budding_amethyst.png"},
drop = "", drop = "",
_mcl_hardness = 1.5, _mcl_hardness = 1.5,
_mcl_blast_resistance = 1.5, _mcl_blast_resistance = 1.5,
groups = { groups = {
pickaxey = 1, pickaxey = 1,
building_block = 1, building_block = 1,
dig_by_piston = 1, dig_by_piston = 1,
}, },
sounds = mcl_sounds.node_sound_glass_defaults(), sounds = mcl_sounds.node_sound_glass_defaults(),
is_ground_content = true, is_ground_content = true,
stack_max = 64, stack_max = 64,
_doc_items_longdesc = S("The Budding Anethyst can grow amethyst"), _doc_items_longdesc = S("The Budding Anethyst can grow amethyst"),
}) })
mcl_wip.register_wip_item("mcl_amethyst:budding_amethyst_block") mcl_wip.register_wip_item("mcl_amethyst:budding_amethyst_block")
-- Amethyst Shard -- Amethyst Shard
minetest.register_craftitem("mcl_amethyst:amethyst_shard",{ minetest.register_craftitem("mcl_amethyst:amethyst_shard",{
description = S("Amethyst Shard"), description = S("Amethyst Shard"),
inventory_image = "amethyst_shard.png", inventory_image = "amethyst_shard.png",
stack_max = 64, stack_max = 64,
groups = { groups = {
craftitem = 1, craftitem = 1,
}, },
_doc_items_longdesc = S("An amethyst shard is a crystalline mineral."), _doc_items_longdesc = S("An amethyst shard is a crystalline mineral."),
}) })
-- Calcite -- Calcite
minetest.register_node("mcl_amethyst:calcite",{ minetest.register_node("mcl_amethyst:calcite",{
description = S("Calcite"), description = S("Calcite"),
tiles = {"calcite.png"}, tiles = {"calcite.png"},
_mcl_hardness = 0.75, _mcl_hardness = 0.75,
_mcl_blast_resistance = 0.75, _mcl_blast_resistance = 0.75,
groups = { groups = {
pickaxey = 1, pickaxey = 1,
building_block = 1, building_block = 1,
}, },
sounds = mcl_sounds.node_sound_stone_defaults(), sounds = mcl_sounds.node_sound_stone_defaults(),
is_ground_content = true, is_ground_content = true,
stack_max = 64, stack_max = 64,
_doc_items_longdesc = S("Calcite can be found as part of amethyst geodes."), _doc_items_longdesc = S("Calcite can be found as part of amethyst geodes."),
}) })
-- Tinied Glass -- Tinied Glass
minetest.register_node("mcl_amethyst:tinted_glass",{ minetest.register_node("mcl_amethyst:tinted_glass",{
description = S("Tinted Glass"), description = S("Tinted Glass"),
tiles = {"tinted_glass.png"}, tiles = {"tinted_glass.png"},
_mcl_hardness = 0.3, _mcl_hardness = 0.3,
_mcl_blast_resistance = 0.3, _mcl_blast_resistance = 0.3,
drawtype = "glasslike", drawtype = "glasslike",
use_texture_alpha = "clip", use_texture_alpha = "clip",
sunlight_propagates = false, sunlight_propagates = false,
groups = { groups = {
handy = 1, handy = 1,
building_block = 1, building_block = 1,
deco_block = 1, deco_block = 1,
}, },
sounds = mcl_sounds.node_sound_glass_defaults(), sounds = mcl_sounds.node_sound_glass_defaults(),
is_ground_content = false, is_ground_content = false,
stack_max = 64, stack_max = 64,
_doc_items_longdesc = S("Tinted Glass is a type of glass which blocks lights while it is visually transparent."), _doc_items_longdesc = S("Tinted Glass is a type of glass which blocks lights while it is visually transparent."),
}) })
-- Amethyst Cluster -- Amethyst Cluster
local bud_def = { local bud_def = {
{"small","Small","mcl_amethyst:medium_amethyst_bud"}, {"small","Small","mcl_amethyst:medium_amethyst_bud"},
{"medium","Medium","mcl_amethyst:large_amethyst_bud"}, {"medium","Medium","mcl_amethyst:large_amethyst_bud"},
{"large","Large","mcl_amethyst:amethyst_cluster"}, {"large","Large","mcl_amethyst:amethyst_cluster"},
} }
for x,y in pairs(bud_def) do for x,y in pairs(bud_def) do
minetest.register_node("mcl_amethyst:" .. y[1] .. "_amethyst_bud",{ minetest.register_node("mcl_amethyst:" .. y[1] .. "_amethyst_bud",{
description = y[2] .. " Amethyst Bud", description = y[2] .. " Amethyst Bud",
_mcl_hardness = 1.5, _mcl_hardness = 1.5,
_mcl_blast_resistance = 1.5, _mcl_blast_resistance = 1.5,
drop = "", drop = "",
tiles = {y[1] .. "_amethyst_bud.png",}, tiles = {y[1] .. "_amethyst_bud.png",},
inventory_image = y[1] .. "_amethyst_bud.png", inventory_image = y[1] .. "_amethyst_bud.png",
paramtype1 = "light", paramtype1 = "light",
paramtype2 = "wallmounted", paramtype2 = "wallmounted",
drawtype = "plantlike", drawtype = "plantlike",
use_texture_alpha = "clip", use_texture_alpha = "clip",
sunlight_propagates = true, sunlight_propagates = true,
groups = { groups = {
dig_by_water = 1, dig_by_water = 1,
destroy_by_lava_flow = 1, destroy_by_lava_flow = 1,
dig_by_piston = 1, dig_by_piston = 1,
pickaxey = 1, pickaxey = 1,
deco_block = 1, deco_block = 1,
amethyst_buds = 1, amethyst_buds = 1,
attached_node = 1, attached_node = 1,
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
-- fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, -- fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
fixed = { -7/16, -8/16, -7/16, 7/16, -7/16, 7/16 }, fixed = { -7/16, -8/16, -7/16, 7/16, -7/16, 7/16 },
}, },
collision_box = { collision_box = {
type = "fixed", type = "fixed",
-- fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, -- fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
fixed = { -7/16, -8/16, -7/16, 7/16, -7/16, 7/16 }, fixed = { -7/16, -8/16, -7/16, 7/16, -7/16, 7/16 },
}, },
_mcl_silk_touch_drop = true, _mcl_silk_touch_drop = true,
_mcl_amethyst_next_grade = y[3], _mcl_amethyst_next_grade = y[3],
_doc_items_longdesc = S(y[2] .. " Amethyst Bud is the " .. y[1] .. " grouth of amethyst bud."), _doc_items_longdesc = S(y[2] .. " Amethyst Bud is the " .. y[1] .. " grouth of amethyst bud."),
}) })
end end
minetest.register_node("mcl_amethyst:amethyst_cluster",{ minetest.register_node("mcl_amethyst:amethyst_cluster",{
description = "Amethyst Cluster", description = "Amethyst Cluster",
_mcl_hardness = 1.5, _mcl_hardness = 1.5,
_mcl_blast_resistance = 1.5, _mcl_blast_resistance = 1.5,
_doc_items_longdesc = S("Amethyst Cluster is the final grouth of amethyst bud."), _doc_items_longdesc = S("Amethyst Cluster is the final grouth of amethyst bud."),
drop = { drop = {
max_items = 1, max_items = 1,
items = { items = {
{ {
tools = {"~mcl_tools:pick_"}, tools = {"~mcl_tools:pick_"},
items = {"mcl_amethyst:amethyst_shard 4"}, items = {"mcl_amethyst:amethyst_shard 4"},
}, },
{ {
items = {"mcl_amethyst:amethyst_shard 2"}, items = {"mcl_amethyst:amethyst_shard 2"},
}, },
} }
}, },
tiles = {"amethyst_cluster.png",}, tiles = {"amethyst_cluster.png",},
inventory_image = "amethyst_cluster.png", inventory_image = "amethyst_cluster.png",
paramtype2 = "wallmounted", paramtype2 = "wallmounted",
drawtype = "plantlike", drawtype = "plantlike",
paramtype1 = "light", paramtype1 = "light",
use_texture_alpha = "clip", use_texture_alpha = "clip",
sunlight_propagates = true, sunlight_propagates = true,
groups = { groups = {
dig_by_water = 1, dig_by_water = 1,
destroy_by_lava_flow = 1, destroy_by_lava_flow = 1,
dig_by_piston = 1, dig_by_piston = 1,
pickaxey = 1, pickaxey = 1,
deco_block = 1, deco_block = 1,
attached_node = 1, attached_node = 1,
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
-- fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, -- fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
fixed = { -7/16, -8/16, -7/16, 7/16, -7/16, 7/16 }, fixed = { -7/16, -8/16, -7/16, 7/16, -7/16, 7/16 },
}, },
collision_box = { collision_box = {
type = "fixed", type = "fixed",
-- fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, -- fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
fixed = { -7/16, -8/16, -7/16, 7/16, -7/16, 7/16 }, fixed = { -7/16, -8/16, -7/16, 7/16, -7/16, 7/16 },
}, },
_mcl_silk_touch_drop = true, _mcl_silk_touch_drop = true,
}) })
-- Register Crafts -- Register Crafts
minetest.register_craft({ minetest.register_craft({
output = "mcl_amethyst:amethyst_block", output = "mcl_amethyst:amethyst_block",
recipe = { recipe = {
{"mcl_amethyst:amethyst_shard","mcl_amethyst:amethyst_shard",}, {"mcl_amethyst:amethyst_shard","mcl_amethyst:amethyst_shard",},
{"mcl_amethyst:amethyst_shard","mcl_amethyst:amethyst_shard",}, {"mcl_amethyst:amethyst_shard","mcl_amethyst:amethyst_shard",},
}, },
}) })
minetest.register_craft({ minetest.register_craft({
output = "mcl_amethyst:tinted_glass 2", output = "mcl_amethyst:tinted_glass 2",
recipe = { recipe = {
{"","mcl_amethyst:amethyst_shard",""}, {"","mcl_amethyst:amethyst_shard",""},
{"mcl_amethyst:amethyst_shard","mcl_core:glass","mcl_amethyst:amethyst_shard",}, {"mcl_amethyst:amethyst_shard","mcl_core:glass","mcl_amethyst:amethyst_shard",},
{"","mcl_amethyst:amethyst_shard",""}, {"","mcl_amethyst:amethyst_shard",""},
}, },
}) })
if minetest.get_modpath("mcl_spyglass") then if minetest.get_modpath("mcl_spyglass") then
minetest.clear_craft({output = "mcl_spyglass:spyglass",}) minetest.clear_craft({output = "mcl_spyglass:spyglass",})
local function craft_spyglass(ingot) local function craft_spyglass(ingot)
minetest.register_craft({ minetest.register_craft({
output = "mcl_spyglass:spyglass", output = "mcl_spyglass:spyglass",
recipe = { recipe = {
{"mcl_amethyst:amethyst_shard"}, {"mcl_amethyst:amethyst_shard"},
{ingot}, {ingot},
{ingot}, {ingot},
} }
}) })
end end
if minetest.get_modpath("mcl_copper") then if minetest.get_modpath("mcl_copper") then
craft_spyglass("mcl_copper:copper_ingot") craft_spyglass("mcl_copper:copper_ingot")
else else
craft_spyglass("mcl_core:iron_ingot") craft_spyglass("mcl_core:iron_ingot")
end end
end end
-- Amethyst Growing -- Amethyst Growing