technic/technic/legacy.lua

79 lines
2.9 KiB
Lua
Raw Normal View History

2013-07-17 21:34:35 +02:00
-- Aliases to convert from legacy node/item names
technic.legacy_nodenames = {
["technic:alloy_furnace"] = "technic:lv_alloy_furnace",
["technic:alloy_furnace_active"] = "technic:lv_alloy_furnace_active",
["technic:battery_box"] = "technic:lv_battery_box0",
["technic:battery_box1"] = "technic:lv_battery_box1",
["technic:battery_box2"] = "technic:lv_battery_box2",
["technic:battery_box3"] = "technic:lv_battery_box3",
["technic:battery_box4"] = "technic:lv_battery_box4",
["technic:battery_box5"] = "technic:lv_battery_box5",
["technic:battery_box6"] = "technic:lv_battery_box6",
["technic:battery_box7"] = "technic:lv_battery_box7",
["technic:battery_box8"] = "technic:lv_battery_box8",
["technic:electric_furnace"] = "technic:lv_electric_furnace",
["technic:electric_furnace_active"] = "technic:lv_electric_furnace_active",
["technic:grinder"] = "technic:lv_grinder",
["technic:grinder_active"] = "technic:lv_grinder_active",
2014-07-02 19:43:13 +02:00
["technic:extractor"] = "technic:lv_extractor",
["technic:extractor_active"] = "technic:lv_extractor_active",
["technic:compressor"] = "technic:lv_compressor",
["technic:compressor_active"] = "technic:lv_compressor_active",
2013-07-17 21:34:35 +02:00
["technic:hv_battery_box"] = "technic:hv_battery_box0",
["technic:mv_battery_box"] = "technic:mv_battery_box0",
["technic:generator"] = "technic:lv_generator",
["technic:generator_active"] = "technic:lv_generator_active",
["technic:iron_dust"] = "technic:wrought_iron_dust",
Uranium enrichment via centrifuge Replacing the extractor-based system, uranium to be used as reactor fuel must now be enriched in stages using the centrifuge. Uranium metal can exist at 36 levels of fissile content, from 0.0% to 3.5% in steps of 0.1%. One round of centrifuging splits two dust of a particular grade in to one dust each of the two neighbouring grades. Uranium of each grade can exist as dust, ingot, and block, with all the regular metal processes to convert between them. Uranium from ore exists in lump form, and is 0.7% fissle. The blocks are radioactive to a degree dependent on fissile content. Thus the chemical refinement and processing of uranium now follows the standard pattern for metals, and is orthogonal to isotopic enrichment. Each form of uranium (dust, ingot, block) intentionally looks identical regardless of fissile grade. If technic_worldgen is used alone, it defines only one grade of uranium (as before), but defines it in the regular metal pattern, with lump, ingot produced by cooking lump, and block crafted from ingots. It identifies the metal only as "uranium". The multiple grades of uranium are defined by the technic mod, which identifies each grade as "N.N%-fissile uranium". The single grade that was registered by technic_worldgen is redefined to be described specifically as "0.7%-fissile uranium". For the redefinition to work, technic_worldgen must load before technic, so technic now declares a dependency on technic_worldgen. Each fuel rod is made from five 3.5%-fissile ingots, each of which in turn requires one to start with five 0.7%-fissile dust, so each fuel rod is now derived from 12.5 uranium lumps (or 25 if the lumps were first cooked rather than being ground). This replaces the 20 lumps required by the former recipes. After setting up and priming the centrifuge cascade, enriching a full set of fuel for the reactor (six fuel rods) takes 14700 centrifuge operations. It's intended to be a practical necessity to automate the centrifuge. In the absence of EU upgrades for the centrifuges, these operations consume 5.88e8 EU, about 0.97% of the 6.048e10 EU that the fuel set will produce in the reactor. The intent is that, in this respect as in others, operating a reactor should carry a very high up-front cost, but ultimately be very profitable.
2014-07-27 03:48:08 +02:00
["technic:enriched_uranium"] = "technic:uranium35_ingot",
2013-07-17 21:34:35 +02:00
}
for old, new in pairs(technic.legacy_nodenames) do
minetest.register_alias(old, new)
end
2016-04-02 01:57:05 +02:00
for i = 0, 64 do
2016-03-20 02:34:56 +01:00
minetest.register_alias("technic:hv_cable"..i, "technic:hv_cable")
minetest.register_alias("technic:mv_cable"..i, "technic:mv_cable")
minetest.register_alias("technic:lv_cable"..i, "technic:lv_cable")
end
-- Item meta
-- Meta keys that have changed
technic.legacy_meta_keys = {
["charge"] = "technic:charge",
}
-- Converts legacy itemstack metadata string to itemstack meta and returns the ItemStackMetaRef
function technic.get_stack_meta(itemstack)
local meta = itemstack:get_meta()
local legacy_string = meta:get("") -- Get deprecated metadata
if legacy_string then
local legacy_table = minetest.deserialize(legacy_string)
if legacy_table then
local table = meta:to_table()
for k, v in pairs(legacy_table) do
table.fields[technic.legacy_meta_keys[k] or k] = v
end
meta:from_table(table)
end
meta:set_string("", "") -- Remove deprecated metadata
end
return meta
end
-- Same as technic.get_stack_meta for cans.
-- (Cans didn't store a serialized table in the legacy metadata string, but just a number.)
function technic.get_stack_meta_cans(itemstack)
local meta = itemstack:get_meta()
local legacy_string = meta:get("") -- Get deprecated metadata
if legacy_string then
meta:set_string("can_level", legacy_string)
meta:set_string("", "") -- Remove deprecated metadata
return meta
end
return meta
end