publish
parent
cc7c2d52df
commit
fd9c38fad5
|
@ -0,0 +1,7 @@
|
|||
mcl_init?
|
||||
mcl_formspec?
|
||||
mcl_sounds?
|
||||
mcl_core?
|
||||
screwdriver?
|
||||
default
|
||||
moreores?
|
|
@ -0,0 +1,593 @@
|
|||
local S = minetest.get_translator("mcl_anvil_for_mt_game")
|
||||
|
||||
local MAX_NAME_LENGTH = 35
|
||||
local MAX_WEAR = 65535
|
||||
local SAME_TOOL_REPAIR_BOOST = math.ceil(MAX_WEAR * 0.12) -- 12%
|
||||
local MATERIAL_TOOL_REPAIR_BOOST = {
|
||||
math.ceil(MAX_WEAR * 0.25), -- 25%
|
||||
math.ceil(MAX_WEAR * 0.5), -- 50%
|
||||
math.ceil(MAX_WEAR * 0.75), -- 75%
|
||||
MAX_WEAR, -- 100%
|
||||
}
|
||||
local NAME_COLOR = "#FFFF4C"
|
||||
|
||||
local gui_form_ng = function(_1,_2,_3,_4)
|
||||
return "image["..tostring(_1)..","..tostring(_2)..";"..tostring(_3)..","..tostring(_4)..";gui_formbg.png^[transformR270]"
|
||||
end
|
||||
|
||||
local function get_anvil_formspec(set_name)
|
||||
if not set_name then
|
||||
set_name = ""
|
||||
end
|
||||
return "size[9,8.75]"..
|
||||
"background[-0.19,-0.25;9.41,9.49;mcl_anvils_inventory.png]"..
|
||||
"list[current_player;main;0,4.5;8,3;8]"..
|
||||
-- "image[0,4.5;9,3;gui_formbg.png^[transformR270]"..
|
||||
"list[current_player;main;0,7.74;8,1;]"..
|
||||
-- gui_form_ng(0,7.74,9,1)..
|
||||
"list[context;input;1,2.5;1,1;]"..
|
||||
-- gui_form_ng(1,2.5,1,1)..
|
||||
"list[context;input;4,2.5;1,1;1]"..
|
||||
-- gui_form_ng(4,2.5,1,1)..
|
||||
"list[context;output;8,2.5;1,1;]"..
|
||||
-- gui_form_ng(8,2.5,1,1)..
|
||||
"label[3,0.1;"..minetest.formspec_escape(minetest.colorize("#fff", S("Repair and Rename"))).."]"..
|
||||
"field[3.25,1;4,1;name;;"..minetest.formspec_escape(set_name).."]"..
|
||||
"field_close_on_enter[name;false]"..
|
||||
"button[7,0.7;2,1;name_button;"..minetest.formspec_escape(S("Set Name")).."]"..
|
||||
"listring[context;output]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[context;input]"..
|
||||
"listring[current_player;main]"..
|
||||
default.get_hotbar_bg(0,4.85)
|
||||
end
|
||||
|
||||
-- Given a tool and material stack, returns how many items of the material stack
|
||||
-- needs to be used up to repair the tool.
|
||||
local function get_consumed_materials(tool, material)
|
||||
local wear = tool:get_wear()
|
||||
if wear == 0 then
|
||||
return 0
|
||||
end
|
||||
local health = (MAX_WEAR - wear)
|
||||
local matsize = material:get_count()
|
||||
local materials_used = 0
|
||||
for m=1, math.min(4, matsize) do
|
||||
materials_used = materials_used + 1
|
||||
if (wear - MATERIAL_TOOL_REPAIR_BOOST[m]) <= 0 then
|
||||
break
|
||||
end
|
||||
end
|
||||
return materials_used
|
||||
end
|
||||
|
||||
-- Given 2 input stacks, tells you which is the tool and which is the material.
|
||||
-- Returns ("tool", input1, input2) if input1 is tool and input2 is material.
|
||||
-- Returns ("material", input2, input1) if input1 is material and input2 is tool.
|
||||
-- Returns nil otherwise.
|
||||
local function distinguish_tool_and_material(input1, input2)
|
||||
local def1 = input1:get_definition()
|
||||
local def2 = input2:get_definition()
|
||||
if def1.type == "tool" and def1._repair_material then
|
||||
return "tool", input1, input2
|
||||
elseif def2.type == "tool" and def2._repair_material then
|
||||
return "material", input2, input1
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
-- Update the inventory slots of an anvil node.
|
||||
-- meta: Metadata of anvil node
|
||||
local function update_anvil_slots(meta)
|
||||
local inv = meta:get_inventory()
|
||||
local new_name = meta:get_string("set_name")
|
||||
local input1, input2, output
|
||||
input1 = inv:get_stack("input", 1)
|
||||
input2 = inv:get_stack("input", 2)
|
||||
output = inv:get_stack("output", 1)
|
||||
local new_output, name_item
|
||||
local just_rename = false
|
||||
|
||||
-- Both input slots occupied
|
||||
if (not input1:is_empty() and not input2:is_empty()) then
|
||||
-- Repair, if tool
|
||||
local def1 = input1:get_definition()
|
||||
local def2 = input2:get_definition()
|
||||
|
||||
-- Repair calculation helper.
|
||||
-- Adds the “inverse” values of wear1 and wear2.
|
||||
-- Then adds a boost health value directly.
|
||||
-- Returns the resulting (capped) wear.
|
||||
local function calculate_repair(wear1, wear2, boost)
|
||||
local new_health = (MAX_WEAR - wear1) + (MAX_WEAR - wear2)
|
||||
if boost then
|
||||
new_health = new_health + boost
|
||||
end
|
||||
return math.max(0, math.min(MAX_WEAR, MAX_WEAR - new_health))
|
||||
end
|
||||
|
||||
-- Same tool twice
|
||||
if input1:get_name() == input2:get_name() and def1.type == "tool" and (input1:get_wear() > 0 or input2:get_wear() > 0) then
|
||||
-- Add tool health together plus a small bonus
|
||||
-- TODO: Combine tool enchantments
|
||||
local new_wear = calculate_repair(input1:get_wear(), input2:get_wear(), SAME_TOOL_REPAIR_BOOST)
|
||||
input1:set_wear(new_wear)
|
||||
name_item = input1
|
||||
new_output = name_item
|
||||
-- Tool + repair item
|
||||
else
|
||||
-- Any tool can have a repair item. This may be defined in the tool's item definition
|
||||
-- as an itemstring in the field `_repair_material`. Only if this field is set, the
|
||||
-- tool can be repaired with a material item.
|
||||
-- Example: Iron Pickaxe + Iron Ingot. `_repair_material = mcl_core:iron_ingot`
|
||||
|
||||
-- Big repair bonus
|
||||
-- TODO: Combine tool enchantments
|
||||
local distinguished, tool, material = distinguish_tool_and_material(input1, input2)
|
||||
if distinguished then
|
||||
local tooldef = tool:get_definition()
|
||||
local has_correct_material = false
|
||||
if string.sub(tooldef._repair_material, 1, 6) == "group:" then
|
||||
has_correct_material = minetest.get_item_group(material:get_name(), string.sub(tooldef._repair_material, 7)) ~= 0
|
||||
elseif material:get_name() == tooldef._repair_material then
|
||||
has_correct_material = true
|
||||
end
|
||||
if has_correct_material and tool:get_wear() > 0 then
|
||||
local materials_used = get_consumed_materials(tool, material)
|
||||
local new_wear = calculate_repair(tool:get_wear(), MAX_WEAR, MATERIAL_TOOL_REPAIR_BOOST[materials_used])
|
||||
tool:set_wear(new_wear)
|
||||
name_item = tool
|
||||
new_output = name_item
|
||||
else
|
||||
new_output = ""
|
||||
end
|
||||
else
|
||||
new_output = ""
|
||||
end
|
||||
end
|
||||
-- Exactly 1 input slot occupied
|
||||
elseif (not input1:is_empty() and input2:is_empty()) or (input1:is_empty() and not input2:is_empty()) then
|
||||
-- Just rename item
|
||||
if input1:is_empty() then
|
||||
name_item = input2
|
||||
else
|
||||
name_item = input1
|
||||
end
|
||||
just_rename = true
|
||||
else
|
||||
new_output = ""
|
||||
end
|
||||
|
||||
-- Rename handling
|
||||
if name_item then
|
||||
-- No renaming allowed with group no_rename=1
|
||||
if minetest.get_item_group(name_item:get_name(), "no_rename") == 1 then
|
||||
new_output = ""
|
||||
else
|
||||
if new_name == nil then
|
||||
new_name = ""
|
||||
end
|
||||
local meta = name_item:get_meta()
|
||||
local old_name = meta:get_string("name")
|
||||
-- Limit name length
|
||||
new_name = string.sub(new_name, 1, MAX_NAME_LENGTH)
|
||||
-- Don't rename if names are identical
|
||||
if new_name ~= old_name then
|
||||
-- Rename item
|
||||
if new_name == "" then
|
||||
meta:set_string("description", "")
|
||||
else
|
||||
-- Custom name set. Colorize it!
|
||||
-- This makes the name visually different from unnamed items
|
||||
meta:set_string("description", minetest.colorize(NAME_COLOR, new_name))
|
||||
end
|
||||
-- Save the raw name internally, too
|
||||
meta:set_string("name", new_name)
|
||||
new_output = name_item
|
||||
elseif just_rename then
|
||||
new_output = ""
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Set the new output slot
|
||||
if new_output ~= nil then
|
||||
inv:set_stack("output", 1, new_output)
|
||||
end
|
||||
end
|
||||
|
||||
-- Drop input items of anvil at pos with metadata meta
|
||||
local function drop_anvil_items(pos, meta)
|
||||
local inv = meta:get_inventory()
|
||||
for i=1, inv:get_size("input") do
|
||||
local stack = inv:get_stack("input", i)
|
||||
if not stack:is_empty() then
|
||||
local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5}
|
||||
minetest.add_item(p, stack)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function damage_particles(pos, node)
|
||||
minetest.add_particlespawner({
|
||||
amount = 30,
|
||||
time = 0.1,
|
||||
minpos = vector.add(pos, {x=-0.5, y=-0.5, z=-0.5}),
|
||||
maxpos = vector.add(pos, {x=0.5, y=-0.25, z=0.5}),
|
||||
minvel = {x=-0.5, y=0.05, z=-0.5},
|
||||
maxvel = {x=0.5, y=0.3, z=0.5},
|
||||
minacc = {x=0, y=-9.81, z=0},
|
||||
maxacc = {x=0, y=-9.81, z=0},
|
||||
minexptime = 0.1,
|
||||
maxexptime = 0.5,
|
||||
minsize = 0.4,
|
||||
maxsize = 0.5,
|
||||
collisiondetection = true,
|
||||
vertical = false,
|
||||
node = node,
|
||||
})
|
||||
end
|
||||
|
||||
local function destroy_particles(pos, node)
|
||||
minetest.add_particlespawner({
|
||||
amount = math.random(20, 30),
|
||||
time = 0.1,
|
||||
minpos = vector.add(pos, {x=-0.4, y=-0.4, z=-0.4}),
|
||||
maxpos = vector.add(pos, {x=0.4, y=0.4, z=0.4}),
|
||||
minvel = {x=-0.5, y=-0.1, z=-0.5},
|
||||
maxvel = {x=0.5, y=0.2, z=0.5},
|
||||
minacc = {x=0, y=-9.81, z=0},
|
||||
maxacc = {x=0, y=-9.81, z=0},
|
||||
minexptime = 0.2,
|
||||
maxexptime = 0.65,
|
||||
minsize = 0.8,
|
||||
maxsize = 1.2,
|
||||
collisiondetection = true,
|
||||
vertical = false,
|
||||
node = node,
|
||||
})
|
||||
end
|
||||
|
||||
-- Damage the anvil by 1 level.
|
||||
-- Destroy anvil when at highest damage level.
|
||||
-- Returns true if anvil was destroyed.
|
||||
local function damage_anvil(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
local new
|
||||
if node.name == "mcl_anvil_for_mt_game:anvil" then
|
||||
minetest.swap_node(pos, {name="mcl_anvil_for_mt_game:anvil_damage_1", param2=node.param2})
|
||||
damage_particles(pos, node)
|
||||
minetest.sound_play(default.node_sound_metal_defaults(), {pos=pos, max_hear_distance=16}, true)
|
||||
return false
|
||||
elseif node.name == "mcl_anvil_for_mt_game:anvil_damage_1" then
|
||||
minetest.swap_node(pos, {name="mcl_anvil_for_mt_game:anvil_damage_2", param2=node.param2})
|
||||
damage_particles(pos, node)
|
||||
minetest.sound_play(default.node_sound_metal_defaults(), {pos=pos, max_hear_distance=16}, true)
|
||||
return false
|
||||
elseif node.name == "mcl_anvil_for_mt_game:anvil_damage_2" then
|
||||
-- Destroy anvil
|
||||
local meta = minetest.get_meta(pos)
|
||||
drop_anvil_items(pos, meta)
|
||||
minetest.sound_play(default.node_sound_metal_defaults(), {pos=pos, max_hear_distance=16}, true)
|
||||
minetest.remove_node(pos)
|
||||
destroy_particles(pos, node)
|
||||
minetest.check_single_for_falling({x=pos.x, y=pos.y+1, z=pos.z})
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
-- Roll a virtual dice and damage anvil at a low chance.
|
||||
local function damage_anvil_by_using(pos)
|
||||
local r = math.random(1, 100)
|
||||
-- 12% chance
|
||||
if r <= 12 then
|
||||
return damage_anvil(pos)
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
local function damage_anvil_by_falling(pos, distance)
|
||||
local chance
|
||||
local r = math.random(1, 100)
|
||||
if distance > 1 then
|
||||
if r <= (5*distance) then
|
||||
damage_anvil(pos)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local anvildef = {
|
||||
groups = {cracky = 1, level = 2, falling_node=1, falling_node_damage=1, crush_after_fall=1, deco_block=1, anvil=1},
|
||||
tiles = {"mcl_anvils_anvil_top_damaged_0.png^[transformR90", "mcl_anvils_anvil_base.png", "mcl_anvils_anvil_side.png"},
|
||||
_tt_help = S("Repair and rename items"),
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
paramtype2 = "facedir",
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-8/16, 2/16, -5/16, 8/16, 8/16, 5/16}, -- top
|
||||
{-5/16, -4/16, -2/16, 5/16, 5/16, 2/16}, -- middle
|
||||
{-8/16, -8/16, -5/16, 8/16, -4/16, 5/16}, -- base
|
||||
}
|
||||
},
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
_mcl_blast_resistance = 1200,
|
||||
_mcl_hardness = 5,
|
||||
_mcl_after_falling = damage_anvil_by_falling,
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local meta2 = meta
|
||||
meta:from_table(oldmetadata)
|
||||
drop_anvil_items(pos, meta)
|
||||
meta:from_table(meta2:to_table())
|
||||
end,
|
||||
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||
local name = player:get_player_name()
|
||||
if minetest.is_protected(pos, name) then
|
||||
minetest.record_protection_violation(pos, name)
|
||||
return 0
|
||||
else
|
||||
return stack:get_count()
|
||||
end
|
||||
end,
|
||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
local name = player:get_player_name()
|
||||
if minetest.is_protected(pos, name) then
|
||||
minetest.record_protection_violation(pos, name)
|
||||
return 0
|
||||
elseif listname == "output" then
|
||||
return 0
|
||||
else
|
||||
return stack:get_count()
|
||||
end
|
||||
end,
|
||||
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
local name = player:get_player_name()
|
||||
if minetest.is_protected(pos, name) then
|
||||
minetest.record_protection_violation(pos, name)
|
||||
return 0
|
||||
elseif to_list == "output" then
|
||||
return 0
|
||||
elseif from_list == "output" and to_list == "input" then
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
if inv:get_stack(to_list, to_index):is_empty() then
|
||||
return count
|
||||
else
|
||||
return 0
|
||||
end
|
||||
else
|
||||
return count
|
||||
end
|
||||
end,
|
||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
update_anvil_slots(meta)
|
||||
end,
|
||||
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if from_list == "output" and to_list == "input" then
|
||||
local inv = meta:get_inventory()
|
||||
for i=1, inv:get_size("input") do
|
||||
if i ~= to_index then
|
||||
local istack = inv:get_stack("input", i)
|
||||
istack:set_count(math.max(0, istack:get_count() - count))
|
||||
inv:set_stack("input", i, istack)
|
||||
end
|
||||
end
|
||||
end
|
||||
update_anvil_slots(meta)
|
||||
|
||||
if from_list == "output" then
|
||||
local destroyed = damage_anvil_by_using(pos)
|
||||
-- Close formspec if anvil was destroyed
|
||||
if destroyed then
|
||||
--[[ Closing the formspec w/ emptyformname is discouraged. But this is justified
|
||||
because node formspecs seem to only have an empty formname in MT 0.4.16.
|
||||
Also, sice this is on_metadata_inventory_take, we KNOW which formspec has
|
||||
been opened by the player. So this should be safe nonetheless.
|
||||
TODO: Update this line when node formspecs get proper identifiers in Minetest. ]]
|
||||
minetest.close_formspec(player:get_player_name(), "")
|
||||
end
|
||||
end
|
||||
end,
|
||||
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if listname == "output" then
|
||||
local inv = meta:get_inventory()
|
||||
local input1 = inv:get_stack("input", 1)
|
||||
local input2 = inv:get_stack("input", 2)
|
||||
-- Both slots occupied?
|
||||
if not input1:is_empty() and not input2:is_empty() then
|
||||
-- Take as many items as needed
|
||||
local distinguished, tool, material = distinguish_tool_and_material(input1, input2)
|
||||
if distinguished then
|
||||
-- Tool + material: Take tool and as many materials as needed
|
||||
local materials_used = get_consumed_materials(tool, material)
|
||||
material:set_count(material:get_count() - materials_used)
|
||||
tool:take_item()
|
||||
if distinguished == "tool" then
|
||||
input1, input2 = tool, material
|
||||
else
|
||||
input1, input2 = material, tool
|
||||
end
|
||||
inv:set_stack("input", 1, input1)
|
||||
inv:set_stack("input", 2, input2)
|
||||
else
|
||||
-- Else take 1 item from each stack
|
||||
input1:take_item()
|
||||
input2:take_item()
|
||||
inv:set_stack("input", 1, input1)
|
||||
inv:set_stack("input", 2, input2)
|
||||
end
|
||||
else
|
||||
-- Otherwise: Rename mode. Remove the same amount of items from input
|
||||
-- as has been taken from output
|
||||
if not input1:is_empty() then
|
||||
input1:set_count(math.max(0, input1:get_count() - stack:get_count()))
|
||||
inv:set_stack("input", 1, input1)
|
||||
end
|
||||
if not input2:is_empty() then
|
||||
input2:set_count(math.max(0, input2:get_count() - stack:get_count()))
|
||||
inv:set_stack("input", 2, input2)
|
||||
end
|
||||
end
|
||||
local destroyed = damage_anvil_by_using(pos)
|
||||
-- Close formspec if anvil was destroyed
|
||||
if destroyed then
|
||||
-- See above for justification.
|
||||
minetest.close_formspec(player:get_player_name(), "")
|
||||
end
|
||||
elseif listname == "input" then
|
||||
update_anvil_slots(meta)
|
||||
end
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("input", 2)
|
||||
inv:set_size("output", 1)
|
||||
local form = get_anvil_formspec()
|
||||
meta:set_string("formspec", form)
|
||||
end,
|
||||
on_receive_fields = function(pos, formname, fields, sender)
|
||||
local sender_name = sender:get_player_name()
|
||||
if minetest.is_protected(pos, sender_name) then
|
||||
minetest.record_protection_violation(pos, sender_name)
|
||||
return
|
||||
end
|
||||
if fields.name_button or fields.name then
|
||||
local set_name
|
||||
if fields.name == nil then
|
||||
set_name = ""
|
||||
else
|
||||
set_name = fields.name
|
||||
end
|
||||
local meta = minetest.get_meta(pos)
|
||||
-- Limit name length
|
||||
set_name = string.sub(set_name, 1, MAX_NAME_LENGTH)
|
||||
meta:set_string("set_name", set_name)
|
||||
update_anvil_slots(meta)
|
||||
meta:set_string("formspec", get_anvil_formspec(set_name))
|
||||
end
|
||||
end,
|
||||
}
|
||||
if minetest.get_modpath("screwdriver") then
|
||||
anvildef.on_rotate = screwdriver.rotate_simple
|
||||
end
|
||||
|
||||
local anvildef0 = table.copy(anvildef)
|
||||
anvildef0.description = S("Anvil")
|
||||
anvildef0._doc_items_longdesc =
|
||||
S("The anvil allows you to repair tools and armor, and to give names to items. It has a limited durability, however. Don't let it fall on your head, it could be quite painful!")
|
||||
anvildef0._doc_items_usagehelp =
|
||||
S("To use an anvil, rightclick it. An anvil has 2 input slots (on the left) and one output slot.").."\n"..
|
||||
S("To rename items, put an item stack in one of the item slots while keeping the other input slot empty. Type in a name, hit enter or “Set Name”, then take the renamed item from the output slot.").."\n"..
|
||||
S("There are two possibilities to repair tools (and armor):").."\n"..
|
||||
S("• Tool + Tool: Place two tools of the same type in the input slots. The “health” of the repaired tool is the sum of the “health” of both input tools, plus a 12% bonus.").."\n"..
|
||||
S("• Tool + Material: Some tools can also be repaired by combining them with an item that it's made of. For example, iron pickaxes can be repaired with iron ingots. This repairs the tool by 25%.").."\n"..
|
||||
S("Armor counts as a tool. It is possible to repair and rename a tool in a single step.").."\n\n"..
|
||||
S("The anvil has limited durability and 3 damage levels: undamaged, slightly damaged and very damaged. Each time you repair or rename something, there is a 12% chance the anvil gets damaged. Anvils also have a chance of being damaged when they fall by more than 1 block. If a very damaged anvil is damaged again, it is destroyed.")
|
||||
|
||||
local anvildef1 = table.copy(anvildef)
|
||||
anvildef1.description = S("Slightly Damaged Anvil")
|
||||
anvildef1._doc_items_create_entry = false
|
||||
anvildef1.groups.not_in_creative_inventory = 1
|
||||
anvildef1.groups.anvil = 2
|
||||
anvildef1._doc_items_create_entry = false
|
||||
anvildef1.tiles = {"mcl_anvils_anvil_top_damaged_1.png^[transformR90", "mcl_anvils_anvil_base.png", "mcl_anvils_anvil_side.png"}
|
||||
|
||||
local anvildef2 = table.copy(anvildef)
|
||||
anvildef2.description = S("Very Damaged Anvil")
|
||||
anvildef2._doc_items_create_entry = false
|
||||
anvildef2.groups.not_in_creative_inventory = 1
|
||||
anvildef2.groups.anvil = 3
|
||||
anvildef2._doc_items_create_entry = false
|
||||
anvildef2.tiles = {"mcl_anvils_anvil_top_damaged_2.png^[transformR90", "mcl_anvils_anvil_base.png", "mcl_anvils_anvil_side.png"}
|
||||
|
||||
minetest.register_node("mcl_anvil_for_mt_game:anvil", anvildef0)
|
||||
minetest.register_node("mcl_anvil_for_mt_game:anvil_damage_1", anvildef1)
|
||||
minetest.register_node("mcl_anvil_for_mt_game:anvil_damage_2", anvildef2)
|
||||
|
||||
if minetest.get_modpath("mcl_core") then
|
||||
minetest.register_craft({
|
||||
output = "mcl_anvil_for_mt_game:anvil",
|
||||
recipe = {
|
||||
{ "default:steelblock", "default:steelblock", "default:steelblock" },
|
||||
{ "", "default:steel_ingot", "" },
|
||||
{ "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" },
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
if minetest.get_modpath("doc") then
|
||||
doc.add_entry_alias("nodes", "mcl_anvil_for_mt_game:anvil", "nodes", "mcl_anvil_for_mt_game:anvil_damage_1")
|
||||
doc.add_entry_alias("nodes", "mcl_anvil_for_mt_game:anvil", "nodes", "mcl_anvil_for_mt_game:anvil_damage_2")
|
||||
end
|
||||
|
||||
-- Legacy
|
||||
minetest.register_lbm({
|
||||
label = "Update anvil formspecs (0.60.0)",
|
||||
name = "mcl_anvil_for_mt_game:update_formspec_0_60_0",
|
||||
nodenames = { "group:anvil" },
|
||||
run_at_every_load = false,
|
||||
action = function(pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local set_name = meta:get_string("set_name")
|
||||
meta:set_string("formspec", get_anvil_formspec(set_name))
|
||||
end,
|
||||
})
|
||||
|
||||
-- MTG Add part
|
||||
local function set_repair_item(name,item)
|
||||
minetest.override_item(name,{
|
||||
_repair_material = item,
|
||||
})
|
||||
end
|
||||
set_repair_item("default:pick_wood","group:wood")
|
||||
set_repair_item("default:pick_stone","group:stone")
|
||||
set_repair_item("default:pick_bronze","default:bronze_ingot")
|
||||
set_repair_item("default:pick_steel","default:steel_ingot")
|
||||
set_repair_item("default:pick_mese","default:mese_crystal")
|
||||
set_repair_item("default:pick_diamond","default:diamond")
|
||||
set_repair_item("default:axe_wood","group:wood")
|
||||
set_repair_item("default:axe_stone","group:stone")
|
||||
set_repair_item("default:axe_bronze","default:bronze_ingot")
|
||||
set_repair_item("default:axe_steel","default:steel_ingot")
|
||||
set_repair_item("default:axe_mese","default:mese_crystal")
|
||||
set_repair_item("default:axe_diamond","default:diamond")
|
||||
set_repair_item("default:shovel_wood","group:wood")
|
||||
set_repair_item("default:shovel_stone","group:stone")
|
||||
set_repair_item("default:shovel_bronze","default:bronze_ingot")
|
||||
set_repair_item("default:shovel_steel","default:steel_ingot")
|
||||
set_repair_item("default:shovel_mese","default:mese_crystal")
|
||||
set_repair_item("default:shovel_diamond","default:diamond")
|
||||
set_repair_item("default:sword_wood","group:wood")
|
||||
set_repair_item("default:sword_stone","group:stone")
|
||||
set_repair_item("default:sword_bronze","default:bronze_ingot")
|
||||
set_repair_item("default:sword_steel","default:steel_ingot")
|
||||
set_repair_item("default:sword_mese","default:mese_crystal")
|
||||
set_repair_item("default:sword_diamond","default:diamond")
|
||||
if minetest.get_modpath("moreores") then
|
||||
set_repair_item("moreores:pick_silver","moreores:silver_ingot")
|
||||
set_repair_item("moreores:pick_mithril","moreores:silver_mithril")
|
||||
set_repair_item("moreores:axe_silver","moreores:silver_ingot")
|
||||
set_repair_item("moreores:axe_mithril","moreores:silver_mithril")
|
||||
set_repair_item("moreores:shovel_silver","moreores:silver_ingot")
|
||||
set_repair_item("moreores:shovel_mithril","moreores:silver_mithril")
|
||||
set_repair_item("moreores:sword_silver","moreores:silver_ingot")
|
||||
set_repair_item("moreores:sword_mithril","moreores:silver_mithril")
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
# textdomain: mcl_anvils
|
||||
Set Name=Name setzen
|
||||
Repair and Name=Reparieren und benennen
|
||||
Inventory=Inventar
|
||||
Anvil=Amboss
|
||||
The anvil allows you to repair tools and armor, and to give names to items. It has a limited durability, however. Don't let it fall on your head, it could be quite painful!=Der Amboss ermöglicht es, Werkzeuge und Rüstung zu reparieren und Gegenstände zu benennen. Er hat jedoch eine begrenzte Lebensdauer. Lassen Sie ihn nicht auf Ihren Kopf fallen, das könnte ziemlich schmerzhaft sein!
|
||||
To use an anvil, rightclick it. An anvil has 2 input slots (on the left) and one output slot.=Um einen Amboss zu benutzen, rechtsklicken Sie auf ihn. Ein Amboss hat 2 Eingabeplätze (links) und einen Ausgabeplatz (rechts).
|
||||
To rename items, put an item stack in one of the item slots while keeping the other input slot empty. Type in a name, hit enter or “Set Name”, then take the renamed item from the output slot.=Um Gegenstände umzubenennen, platzieren Sie einen Gegenstand in einen der Eingangsplätze und lassen Sie den anderen frei. Geben Sie einen Namen ein und drücken Sie die Eingabetaste oder „Name setzen”, dann nehmen Sie den umbenannten Gegenstand an sich.
|
||||
There are two possibilities to repair tools (and armor):=Es gibt zwei Möglichkeiten, Werkzeuge (und Rüstung) zu reparieren:
|
||||
• Tool + Tool: Place two tools of the same type in the input slots. The “health” of the repaired tool is the sum of the “health” of both input tools, plus a 12% bonus.=• Werkzeug + Werkzeug: Platzieren sie zwei gleiche Werkzeuge in die Eingangsplätze. Der Zustand des reparierten Werkzeugs ist die Summe des Zustands beider Eingangswerkzeuge, plus einem Bonus von 12%.
|
||||
• Tool + Material: Some tools can also be repaired by combining them with an item that it's made of. For example, iron pickaxes can be repaired with iron ingots. This repairs the tool by 25%.=• Werkzeug + Material: Einige Werkzeuge können auch repariert werden, indem man sie mit einem Gegenstand, aus dem sie gemacht worden sind, kombiniert. Zum Beispiel können Eisenspitzhacken mit Eisenbarren repariert werden. Dadurch wird das Werkzeug um 25% repariert.
|
||||
Armor counts as a tool. It is possible to repair and rename a tool in a single step.=Rüstung zählt als Werkzeug. Es ist möglich, ein Werkzeug in einem Arbeitsschritt zu reparieren und zu benennen.
|
||||
The anvil has limited durability and 3 damage levels: undamaged, slightly damaged and very damaged. Each time you repair or rename something, there is a 12% chance the anvil gets damaged. Anvils also have a chance of being damaged when they fall by more than 1 block. If a very damaged anvil is damaged again, it is destroyed.=Der Amboss hat begrenze Lebensdauer und 3 Schadensstufen: Kein Schaden, leicht beschädigt, und stark beschädigt. Jedes mal, wenn Sie etwas reparieren oder umbenennen, gibt es eine 12%-ige Chance, dass der Amboss Schaden nimmt. Ambosse können auch beschädigt werden, wenn sie um mehr als 1 Block fallen. Wenn ein sehr beschädigter Amboss erneut beschädigt wird, wird er zerstört.
|
||||
Slightly Damaged Anvil=Leicht beschädigter Amboss
|
||||
Very Damaged Anvil=Stark beschädigter Amboss
|
||||
Repair and rename items=Für die Reparatur und Umbenennung von Gegenständen
|
|
@ -0,0 +1,15 @@
|
|||
# textdomain: mcl_anvils
|
||||
Set Name=Establece un nombre
|
||||
Repair and Name=Reparar y nombrar
|
||||
Inventory=Inventario
|
||||
Anvil=Yunque
|
||||
The anvil allows you to repair tools and armor, and to give names to items. It has a limited durability, however. Don't let it fall on your head, it could be quite painful!=El yunque le permite reparar herramientas y armaduras, y dar nombres a los elementos. Sin embargo, tiene una durabilidad limitada. No lo dejes caer sobre tu cabeza, ¡podría ser bastante doloroso!
|
||||
To use an anvil, rightclick it. An anvil has 2 input slots (on the left) and one output slot.=Para usar un yunque, haga clic derecho sobre él. Un yunque tiene 2 ranuras de entrada (a la izquierda) y una ranura de salida.
|
||||
To rename items, put an item stack in one of the item slots while keeping the other input slot empty. Type in a name, hit enter or “Set Name”, then take the renamed item from the output slot.=Para cambiar el nombre de los elementos, coloque una pila de elementos en una de las ranuras de elementos mientras mantiene vacía la otra ranura de entrada. Escriba un nombre, presione enter o "Establecer nombre", luego obtenga el elemento renombrado en la ranura de salida.
|
||||
There are two possibilities to repair tools (and armor):=Hay dos posibilidades para reparar herramientas (y armaduras):
|
||||
• Tool + Tool: Place two tools of the same type in the input slots. The “health” of the repaired tool is the sum of the “health” of both input tools, plus a 12% bonus.=• Herramienta + Herramienta: Coloque dos herramientas del mismo tipo en las ranuras de entrada. La "salud" de la herramienta reparada es la suma de la "salud" de ambas herramientas, con un bono del 12%.
|
||||
• Tool + Material: Some tools can also be repaired by combining them with an item that it's made of. For example, iron pickaxes can be repaired with iron ingots. This repairs the tool by 25%.=• Herramienta + Material: Algunas herramientas también pueden repararse combinándolas con un elemento del que está hecho. Por ejemplo, los picos de hierro pueden repararse con lingotes de hierro. Esto repara la herramienta en un 25%.
|
||||
Armor counts as a tool. It is possible to repair and rename a tool in a single step.=La armadura cuenta como una herramienta. Es posible reparar y cambiar el nombre de una herramienta en un solo paso.
|
||||
The anvil has limited durability and 3 damage levels: undamaged, slightly damaged and very damaged. Each time you repair or rename something, there is a 12% chance the anvil gets damaged. Anvils also have a chance of being damaged when they fall by more than 1 block. If a very damaged anvil is damaged again, it is destroyed.=El yunque tiene una durabilidad limitada y 3 niveles de daño: sin daños, ligeramente dañado y muy dañado. Cada vez que reparas o cambias el nombre de algo, hay un 12% de posibilidades de que el yunque se dañe. Los yunques también tienen la posibilidad de dañarse cuando caen en más de 1 bloque. Si un yunque muy dañado se daña nuevamente, se destruye.
|
||||
Slightly Damaged Anvil=Yunque dañado
|
||||
Very Damaged Anvil=Yunque muy dañado
|
|
@ -0,0 +1,16 @@
|
|||
# textdomain: mcl_anvils
|
||||
Set Name=Définir le Nom
|
||||
Repair and Name=Réparation et Nomme
|
||||
Inventory=Inventaire
|
||||
Anvil=Enclume
|
||||
The anvil allows you to repair tools and armor, and to give names to items. It has a limited durability, however. Don't let it fall on your head, it could be quite painful!=L'enclume vous permet de réparer des outils et des armures, et de donner des noms à des objets. Il a cependant une durabilité limitée. Ne la laissez pas tomber sur la tête, cela pourrait être assez douloureux!
|
||||
To use an anvil, rightclick it. An anvil has 2 input slots (on the left) and one output slot.=Pour utiliser une enclume, faites un clic droit dessus. Une enclume a 2 emplacements d'entrée (à gauche) et un emplacement de sortie.
|
||||
To rename items, put an item stack in one of the item slots while keeping the other input slot empty. Type in a name, hit enter or “Set Name”, then take the renamed item from the output slot.=Pour renommer des objets, placez une pile d'objets dans l'un des emplacements d'objets tout en laissant l'autre emplacement d'entrée vide. Tapez un nom, appuyez sur Entrée ou sur «Définir le nom», puis prenez l'élément renommé dans l'emplacement de sortie.
|
||||
There are two possibilities to repair tools (and armor):=Il existe deux possibilités pour réparer les outils (et les armures):
|
||||
• Tool + Tool: Place two tools of the same type in the input slots. The “health” of the repaired tool is the sum of the “health” of both input tools, plus a 12% bonus.=• Outil + Outil: Placez deux outils du même type dans les emplacements d'entrée. La "santé" de l'outil réparé est la somme de la "santé" des deux outils d'entrée, plus un bonus de 12%.
|
||||
• Tool + Material: Some tools can also be repaired by combining them with an item that it's made of. For example, iron pickaxes can be repaired with iron ingots. This repairs the tool by 25%.=• Outil + Matériel: Certains outils peuvent également être réparés en les combinant avec un élément dont il est fait. Par exemple, les pioches de fer peuvent être réparées avec des lingots de fer. Cela répare l'outil de 25%.
|
||||
Armor counts as a tool. It is possible to repair and rename a tool in a single step.=L'armure compte comme un outil. Il est possible de réparer et de renommer un outil en une seule étape.
|
||||
The anvil has limited durability and 3 damage levels: undamaged, slightly damaged and very damaged. Each time you repair or rename something, there is a 12% chance the anvil gets damaged. Anvils also have a chance of being damaged when they fall by more than 1 block. If a very damaged anvil is damaged again, it is destroyed.=L'enclume a une durabilité limitée et 3 niveaux de dommages: en bon état, légèrement endommagé et très endommagé. Chaque fois que vous réparez ou renommez quelque chose, il y a 12% de chances que l'enclume soit endommagée. Les enclumes ont également une chance d'être endommagées lorsqu'elles tombent de plus d'un bloc. Si une enclume très endommagée est à nouveau endommagée, elle est détruite.
|
||||
Slightly Damaged Anvil=Enclume Légèrement Endommagée
|
||||
Very Damaged Anvil=Enclume Très Endommagée
|
||||
Repair and rename items=Réparer et renommer des objets
|
|
@ -0,0 +1,16 @@
|
|||
# textdomain: mcl_anvils
|
||||
Set Name=Дать имя
|
||||
Repair and Name=Починить и дать имя
|
||||
Inventory=Инвентарь
|
||||
Anvil=Наковальня
|
||||
The anvil allows you to repair tools and armor, and to give names to items. It has a limited durability, however. Don't let it fall on your head, it could be quite painful!=Наковальня позволяет ремонтировать инструменты и защиту, а также давать имена предметам. Но она имеет ограниченный срок службы. Не дайте ей упасть вам на голову, это может быть больно!
|
||||
To use an anvil, rightclick it. An anvil has 2 input slots (on the left) and one output slot.=Чтобы воспользоваться наковальней, кликните по ней правой кнопкой. Наковальня имеет два входных отсека (слева) и один выходной.
|
||||
To rename items, put an item stack in one of the item slots while keeping the other input slot empty. Type in a name, hit enter or “Set Name”, then take the renamed item from the output slot.=Для переименования положите стопку предметов в один отсек, второй оставьте пустым. Наберите имя, нажмите [Enter] или “Дать имя” и заберите переименованные предметы из выходного отсека.
|
||||
There are two possibilities to repair tools (and armor):=Есть два способа отремонтировать инструменты (и защиту):
|
||||
• Tool + Tool: Place two tools of the same type in the input slots. The “health” of the repaired tool is the sum of the “health” of both input tools, plus a 12% bonus.=• Инструмент + Инструмент: Положите два инструмента одного типа во входные отсеки. “Здоровье” отремонтированного инструмента будет равно сумме “здоровья” каждого из них, плюс 12% бонус.
|
||||
• Tool + Material: Some tools can also be repaired by combining them with an item that it's made of. For example, iron pickaxes can be repaired with iron ingots. This repairs the tool by 25%.=• Инструмент + Материал: Некоторые инструменты можно также ремонтировать, добавляя к ним предмет, из которого они сделаны. Например, железные кирки ремонтируются добавлением слитков железа. Таким способом инструмент восстанавливается на 25%.
|
||||
Armor counts as a tool. It is possible to repair and rename a tool in a single step.=Защиты считается за инструмент. Можно ремонтировать и переименовывать за одно действие.
|
||||
The anvil has limited durability and 3 damage levels: undamaged, slightly damaged and very damaged. Each time you repair or rename something, there is a 12% chance the anvil gets damaged. Anvils also have a chance of being damaged when they fall by more than 1 block. If a very damaged anvil is damaged again, it is destroyed.=Наковальня имеет ограниченный срок службы и 3 уровня износа: новая, немного изношенная, сильно повреждённая. Каждый раз, ремонтируя или переименовывая что-либо, вы имеете 12-процентный шанс повредить наковальню. Наковальни также могут повреждаться, когда они падают с высоте более 1 блока. Если повреждённая наковальня повреждается снова, то она уничтожается.
|
||||
Slightly Damaged Anvil=Немного изношенная наковальня
|
||||
Very Damaged Anvil=Сильно повреждённая наковальня
|
||||
Repair and rename items=Ремонтирует и переименовывает предметы
|
|
@ -0,0 +1,16 @@
|
|||
# textdomain: mcl_anvils
|
||||
Set Name=
|
||||
Repair and Name=
|
||||
Inventory=
|
||||
Anvil=
|
||||
The anvil allows you to repair tools and armor, and to give names to items. It has a limited durability, however. Don't let it fall on your head, it could be quite painful!=
|
||||
To use an anvil, rightclick it. An anvil has 2 input slots (on the left) and one output slot.=
|
||||
To rename items, put an item stack in one of the item slots while keeping the other input slot empty. Type in a name, hit enter or “Set Name”, then take the renamed item from the output slot.=
|
||||
There are two possibilities to repair tools (and armor):=
|
||||
• Tool + Tool: Place two tools of the same type in the input slots. The “health” of the repaired tool is the sum of the “health” of both input tools, plus a 12% bonus.=
|
||||
• Tool + Material: Some tools can also be repaired by combining them with an item that it's made of. For example, iron pickaxes can be repaired with iron ingots. This repairs the tool by 25%.=
|
||||
Armor counts as a tool. It is possible to repair and rename a tool in a single step.=
|
||||
The anvil has limited durability and 3 damage levels: undamaged, slightly damaged and very damaged. Each time you repair or rename something, there is a 12% chance the anvil gets damaged. Anvils also have a chance of being damaged when they fall by more than 1 block. If a very damaged anvil is damaged again, it is destroyed.=
|
||||
Slightly Damaged Anvil=
|
||||
Very Damaged Anvil=
|
||||
Repair and rename items=
|
Binary file not shown.
After Width: | Height: | Size: 125 B |
Binary file not shown.
After Width: | Height: | Size: 155 B |
Binary file not shown.
After Width: | Height: | Size: 195 B |
Binary file not shown.
After Width: | Height: | Size: 209 B |
Binary file not shown.
After Width: | Height: | Size: 220 B |
Binary file not shown.
After Width: | Height: | Size: 699 B |
Loading…
Reference in New Issue