master
parent
20726d5f3e
commit
2a07b98464
47
item.lua
47
item.lua
|
@ -17,7 +17,6 @@ minetest.register_node(
|
|||
meta:set_string(
|
||||
"formspec",
|
||||
[[
|
||||
formspec_version[3]
|
||||
size[10,10]
|
||||
list[context;fuel;2,3;1,1;]
|
||||
list[context;src;2,1;1,1;]
|
||||
|
@ -29,6 +28,12 @@ minetest.register_node(
|
|||
meta:set_int("srcprogress", 0)
|
||||
meta:set_float("iron", 0.0)
|
||||
meta:set_float("coal", 0.0)
|
||||
meta:set_float("copper", 0.0)
|
||||
meta:set_float("tin", 0.0)
|
||||
meta:set_float("gold", 0.0)
|
||||
meta:set_float("mese_crystal", 0.0)
|
||||
meta:set_float("diamond", 0.0)
|
||||
meta:set_float("mese", 0.0)
|
||||
end,
|
||||
can_dig = function(pos, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
@ -74,17 +79,53 @@ minetest.register_abm(
|
|||
inv:add_item("dst", ItemStack("default:coal_lump"))
|
||||
meta:set_float("coal", 0.0)
|
||||
end
|
||||
if meta:get_float("copper") >= 100 then
|
||||
inv:add_item("dst", ItemStack("default:copper_lump"))
|
||||
meta:set_float("copper", 0.0)
|
||||
end
|
||||
if meta:get_float("tin") >= 100 then
|
||||
inv:add_item("dst", ItemStack("default:tin_lump"))
|
||||
meta:set_float("tin", 0.0)
|
||||
end
|
||||
if meta:get_float("gold") >= 100 then
|
||||
inv:add_item("dst", ItemStack("default:gold_lump"))
|
||||
meta:set_float("gold", 0.0)
|
||||
end
|
||||
if meta:get_float("mese_crystal") >= 100 then
|
||||
inv:add_item("dst", ItemStack("default:mese_crystal"))
|
||||
meta:set_float("mese_crystal", 0.0)
|
||||
end
|
||||
if meta:get_float("diamond") >= 100 then
|
||||
inv:add_item("dst", ItemStack("default:diamond"))
|
||||
meta:set_float("diamond", 0.0)
|
||||
end
|
||||
if meta:get_float("mese") >= 100 then
|
||||
inv:add_item("dst", ItemStack("default:mese"))
|
||||
meta:set_float("mese", 0.0)
|
||||
end
|
||||
if not inv:is_empty("src") and inv:get_list("src")[1]:get_name() == "default:cobble" then
|
||||
local srcstack = inv:get_stack("src", 1)
|
||||
srcstack:take_item()
|
||||
inv:set_stack("src", 1, srcstack)
|
||||
meta:set_float("coal", meta:get_float("coal") + math.random(41, 59) / 100)
|
||||
meta:set_float("copper", meta:get_float("copper") + math.random(14, 41) / 500)
|
||||
meta:set_float("tin", meta:get_float("tin") + math.random(14, 41) / 500)
|
||||
meta:set_float("iron", meta:get_float("iron") + math.random(6, 41) / 1000)
|
||||
meta:set_float("gold", meta:get_float("gold") + math.random(3, 6) / 5000)
|
||||
meta:set_float("mese_crystal", meta:get_float("mese_crystal") + math.random(3, 11) / 10000)
|
||||
meta:set_float("diamond", meta:get_float("diamond") + math.random(9, 11) / 50000)
|
||||
meta:set_float("mese", meta:get_float("mese") + math.random(1, 9) / 100000)
|
||||
end
|
||||
meta:set_string(
|
||||
"infotext",
|
||||
"Coal:" ..
|
||||
string.format("%.2f", meta:get_float("coal")) .. "%\nIron:" .. string.format("%.2f", meta:get_float("iron")) .. "%"
|
||||
S("Coal")..":" .. string.format("%.2f", meta:get_float("coal")) ..
|
||||
"%\n"..S("Iron")..":" .. string.format("%.2f", meta:get_float("iron")) ..
|
||||
"%\n"..S("Copper")..":" .. string.format("%.2f", meta:get_float("copper")) ..
|
||||
"%\n"..S("Gold")..":" .. string.format("%.2f", meta:get_float("gold")) ..
|
||||
"%\n"..S("Tin")..":" .. string.format("%.2f", meta:get_float("tin")) ..
|
||||
"%\n"..S("Mese crystal")..":" .. string.format("%.2f", meta:get_float("mese_crystal")) ..
|
||||
"%\n"..S("Diamond")..":" .. string.format("%.2f", meta:get_float("diamond")) ..
|
||||
"%\n"..S("Mese")..":" .. string.format("%.2f", meta:get_float("mese")) ..
|
||||
)
|
||||
end
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
# textdomain:minechemistry
|
||||
Coal = 煤
|
||||
Tin = 锡
|
||||
Iron = 铁
|
||||
Gold = 黄金
|
||||
Copper = 铜
|
||||
Mese crystal = 黄石
|
||||
Diamond = 钻石
|
||||
Mese = 黄石块
|
Loading…
Reference in New Issue