mirror of
https://github.com/minetest-mods/technic.git
synced 2025-07-04 17:20:37 +02:00
Add support for translations via intllib
This commit is contained in:
@ -7,6 +7,7 @@
|
||||
-- I could imagine some form of API allowing modders to come with their own node
|
||||
-- box definitions and easily stuff it in the this machine for production.
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
local shape = {}
|
||||
local onesize_products = {
|
||||
@ -126,7 +127,7 @@ end
|
||||
|
||||
-- The actual block inactive state
|
||||
minetest.register_node("technic:cnc", {
|
||||
description = "CNC Milling Machine",
|
||||
description = S("CNC Machine"),
|
||||
tiles = {"technic_cnc_top.png", "technic_cnc_bottom.png", "technic_cnc_side.png",
|
||||
"technic_cnc_side.png", "technic_cnc_side.png", "technic_cnc_front.png"},
|
||||
drawtype = "nodebox",
|
||||
@ -142,7 +143,7 @@ minetest.register_node("technic:cnc", {
|
||||
legacy_facedir_simple = true,
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", "CNC Machine")
|
||||
meta:set_string("infotext", S("CNC Machine"))
|
||||
meta:set_float("technic_power_machine", 1)
|
||||
meta:set_string("formspec", cnc_formspec)
|
||||
local inv = meta:get_inventory()
|
||||
@ -154,7 +155,7 @@ minetest.register_node("technic:cnc", {
|
||||
local inv = meta:get_inventory()
|
||||
if not inv:is_empty("src") or not inv:is_empty("dst") then
|
||||
minetest.chat_send_player(player:get_player_name(),
|
||||
"Machine cannot be removed because it is not empty");
|
||||
S("Machine cannot be removed because it is not empty"))
|
||||
return false
|
||||
else
|
||||
return true
|
||||
@ -165,7 +166,7 @@ minetest.register_node("technic:cnc", {
|
||||
|
||||
-- Active state block
|
||||
minetest.register_node("technic:cnc_active", {
|
||||
description = "CNC Machine",
|
||||
description = S("CNC Machine"),
|
||||
tiles = {"technic_cnc_top_active.png", "technic_cnc_bottom.png", "technic_cnc_side.png",
|
||||
"technic_cnc_side.png", "technic_cnc_side.png", "technic_cnc_front_active.png"},
|
||||
paramtype2 = "facedir",
|
||||
@ -176,7 +177,7 @@ minetest.register_node("technic:cnc_active", {
|
||||
local inv = meta:get_inventory()
|
||||
if not inv:is_empty("src") or not inv:is_empty("dst") then
|
||||
minetest.chat_send_player(player:get_player_name(),
|
||||
"CNC machine cannot be removed because it is not empty");
|
||||
S("Machine cannot be removed because it is not empty"))
|
||||
return false
|
||||
end
|
||||
return true
|
||||
@ -193,7 +194,7 @@ minetest.register_abm({
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local eu_input = meta:get_int("LV_EU_input")
|
||||
local machine_name = "CNC"
|
||||
local machine_name = S("CNC Machine")
|
||||
local machine_node = "technic:cnc"
|
||||
local demand = 450
|
||||
|
||||
@ -213,17 +214,17 @@ minetest.register_abm({
|
||||
(not minetest.registered_nodes[result]) or
|
||||
(not inv:room_for_item("dst", result)) then
|
||||
hacky_swap_node(pos, machine_node)
|
||||
meta:set_string("infotext", machine_name.." Idle")
|
||||
meta:set_string("infotext", S("%s Idle"):format(machine_name))
|
||||
meta:set_string("cnc_product", "")
|
||||
return
|
||||
end
|
||||
|
||||
if eu_input < demand then
|
||||
hacky_swap_node(pos, machine_node)
|
||||
meta:set_string("infotext", machine_name.." Unpowered")
|
||||
meta:set_string("infotext", S("%s Unpowered"):format(machine_name))
|
||||
elseif eu_input >= demand then
|
||||
hacky_swap_node(pos, machine_node.."_active")
|
||||
meta:set_string("infotext", machine_name.." Active")
|
||||
meta:set_string("infotext", S("%s Active"):format(machine_name))
|
||||
meta:set_int("src_time", meta:get_int("src_time") + 1)
|
||||
if meta:get_int("src_time") >= 3 then -- 3 ticks per output
|
||||
meta:set_int("src_time", 0)
|
||||
|
@ -1,7 +1,9 @@
|
||||
-- API for the technic CNC machine
|
||||
-- Again code is adapted from the NonCubic Blocks MOD v1.4 by yves_de_beck
|
||||
technic.cnc = {}
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
technic.cnc = {}
|
||||
|
||||
technic.cnc.detail_level = 16
|
||||
|
||||
@ -151,119 +153,119 @@ end
|
||||
technic.cnc.programs = {
|
||||
{suffix = "technic_cnc_stick",
|
||||
nodebox = {-0.15, -0.5, -0.15, 0.15, 0.5, 0.15},
|
||||
desc = "Stick"},
|
||||
desc = S("Stick")},
|
||||
|
||||
{suffix = "technic_cnc_element_end_double",
|
||||
nodebox = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.5},
|
||||
desc = "Element End Double"},
|
||||
desc = S("Element End Double")},
|
||||
|
||||
{suffix = "technic_cnc_element_cross_double",
|
||||
nodebox = {
|
||||
{0.3, -0.5, -0.3, 0.5, 0.5, 0.3},
|
||||
{-0.3, -0.5, -0.5, 0.3, 0.5, 0.5},
|
||||
{-0.5, -0.5, -0.3, -0.3, 0.5, 0.3}},
|
||||
desc = "Element Cross Double"},
|
||||
desc = S("Element Cross Double")},
|
||||
|
||||
{suffix = "technic_cnc_element_t_double",
|
||||
nodebox = {
|
||||
{-0.3, -0.5, -0.5, 0.3, 0.5, 0.3},
|
||||
{-0.5, -0.5, -0.3, -0.3, 0.5, 0.3},
|
||||
{0.3, -0.5, -0.3, 0.5, 0.5, 0.3}},
|
||||
desc = "Element T Double"},
|
||||
desc = S("Element T Double")},
|
||||
|
||||
{suffix = "technic_cnc_element_edge_double",
|
||||
nodebox = {
|
||||
{-0.3, -0.5, -0.5, 0.3, 0.5, 0.3},
|
||||
{-0.5, -0.5, -0.3, -0.3, 0.5, 0.3}},
|
||||
desc = "Element Edge Double"},
|
||||
desc = S("Element Edge Double")},
|
||||
|
||||
{suffix = "technic_cnc_element_straight_double",
|
||||
nodebox = {-0.3, -0.5, -0.5, 0.3, 0.5, 0.5},
|
||||
desc = "Element Straight Double"},
|
||||
desc = S("Element Straight Double")},
|
||||
|
||||
{suffix = "technic_cnc_element_end",
|
||||
nodebox = {-0.3, -0.5, -0.3, 0.3, 0, 0.5},
|
||||
desc = "Element End"},
|
||||
desc = S("Element End")},
|
||||
|
||||
{suffix = "technic_cnc_element_cross",
|
||||
nodebox = {
|
||||
{0.3, -0.5, -0.3, 0.5, 0, 0.3},
|
||||
{-0.3, -0.5, -0.5, 0.3, 0, 0.5},
|
||||
{-0.5, -0.5, -0.3, -0.3, 0, 0.3}},
|
||||
desc = "Element Cross"},
|
||||
desc = S("Element Cross")},
|
||||
|
||||
{suffix = "technic_cnc_element_t",
|
||||
nodebox = {
|
||||
{-0.3, -0.5, -0.5, 0.3, 0, 0.3},
|
||||
{-0.5, -0.5, -0.3, -0.3, 0, 0.3},
|
||||
{0.3, -0.5, -0.3, 0.5, 0, 0.3}},
|
||||
desc = "Element T"},
|
||||
desc = S("Element T")},
|
||||
|
||||
{suffix = "technic_cnc_element_edge",
|
||||
nodebox = {
|
||||
{-0.3, -0.5, -0.5, 0.3, 0, 0.3},
|
||||
{-0.5, -0.5, -0.3, -0.3, 0, 0.3}},
|
||||
desc = "Element Edge"},
|
||||
desc = S("Element Edge")},
|
||||
|
||||
{suffix = "technic_cnc_element_straight",
|
||||
nodebox = {-0.3, -0.5, -0.5, 0.3, 0, 0.5},
|
||||
desc = "Element Straight"},
|
||||
desc = S("Element Straight")},
|
||||
|
||||
{suffix = "technic_cnc_sphere",
|
||||
nodebox = cnc_sphere(),
|
||||
desc = "Sphere"},
|
||||
desc = S("Sphere")},
|
||||
|
||||
{suffix = "technic_cnc_cylinder_horizontal",
|
||||
nodebox = cnc_cylinder_horizontal(),
|
||||
desc = "Cylinder Horizontal"},
|
||||
desc = S("Horizontal Cylinder")},
|
||||
|
||||
{suffix = "technic_cnc_cylinder",
|
||||
nodebox = cnc_cylinder(),
|
||||
desc = ""},
|
||||
desc = S("Cylinder")},
|
||||
|
||||
{suffix = "technic_cnc_twocurvededge",
|
||||
nodebox = cnc_twocurvededge(),
|
||||
desc = "One Curved Edge Block"},
|
||||
desc = S("Two Curved Edge Block")},
|
||||
|
||||
{suffix = "technic_cnc_onecurvededge",
|
||||
nodebox = cnc_onecurvededge(),
|
||||
desc = "Two Curved Edge Block"},
|
||||
desc = S("One Curved Edge Block")},
|
||||
|
||||
{suffix = "technic_cnc_spike",
|
||||
nodebox = cnc_spike(),
|
||||
desc = "Spike"},
|
||||
desc = S("Spike")},
|
||||
|
||||
{suffix = "technic_cnc_pyramid",
|
||||
nodebox = cnc_pyramid(),
|
||||
desc = "Pyramid"},
|
||||
desc = S("Pyramid")},
|
||||
|
||||
{suffix = "technic_cnc_slope_inner_edge_upsdown",
|
||||
nodebox = cnc_slope_inner_edge_upsdown(),
|
||||
desc = "Slope Upside Down Inner Edge"},
|
||||
desc = S("Slope Upside Down Inner Edge")},
|
||||
|
||||
{suffix = "technic_cnc_slope_edge_upsdown",
|
||||
nodebox = cnc_slope_edge_upsdown(),
|
||||
desc = "Slope Upside Down Edge"},
|
||||
desc = S("Slope Upside Down Edge")},
|
||||
|
||||
{suffix = "technic_cnc_slope_inner_edge",
|
||||
nodebox = cnc_slope_inner_edge(),
|
||||
desc = "Slope Inner Edge"},
|
||||
desc = S("Slope Inner Edge")},
|
||||
|
||||
{suffix = "technic_cnc_slope_edge",
|
||||
nodebox = cnc_slope_edge(),
|
||||
desc = "Slope Edge"},
|
||||
desc = S("Slope Edge")},
|
||||
|
||||
{suffix = "technic_cnc_slope_upsdown",
|
||||
nodebox = cnc_slope_upsdown(),
|
||||
desc = "Slope Upside Down"},
|
||||
desc = S("Slope Upside Down")},
|
||||
|
||||
{suffix = "technic_cnc_slope_lying",
|
||||
nodebox = cnc_slope_lying(),
|
||||
desc = "Slope Lying"},
|
||||
desc = S("Slope Lying")},
|
||||
|
||||
{suffix = "technic_cnc_slope",
|
||||
nodebox = cnc_slope(),
|
||||
desc = "Slope"},
|
||||
desc = S("Slope")},
|
||||
}
|
||||
|
||||
-- Allow disabling certain programs for some node. Default is allowing all types for all nodes
|
||||
|
@ -1,11 +1,14 @@
|
||||
-- REGISTER MATERIALS AND PROPERTIES FOR NONCUBIC ELEMENTS:
|
||||
-----------------------------------------------------------
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
-- DIRT
|
||||
-------
|
||||
technic.cnc.register_all("default:dirt",
|
||||
{snappy=2,choppy=2,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
|
||||
{"default_grass.png", "default_dirt.png", "default_grass.png"},
|
||||
"Dirt")
|
||||
S("Dirt"))
|
||||
technic.cnc.programs_disable["default:dirt"] = {"technic_cnc_sphere", "technic_cnc_slope_upsdown",
|
||||
"technic_cnc_edge", "technic_cnc_inner_edge",
|
||||
"technic_cnc_slope_edge_upsdown", "technic_cnc_slope_inner_edge_upsdown",
|
||||
@ -16,56 +19,56 @@ technic.cnc.programs_disable["default:dirt"] = {"technic_cnc_sphere", "technic_c
|
||||
technic.cnc.register_all("default:tree",
|
||||
{snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1},
|
||||
{"default_tree.png"},
|
||||
"Wooden")
|
||||
S("Wooden"))
|
||||
|
||||
-- WOOD
|
||||
-------
|
||||
technic.cnc.register_all("default:wood",
|
||||
{snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1},
|
||||
{"default_wood.png"},
|
||||
"Wooden")
|
||||
S("Wooden"))
|
||||
-- STONE
|
||||
--------
|
||||
technic.cnc.register_all("default:stone",
|
||||
{cracky=3, not_in_creative_inventory=1},
|
||||
{"default_stone.png"},
|
||||
"Stone")
|
||||
S("Stone"))
|
||||
-- COBBLE
|
||||
---------
|
||||
technic.cnc.register_all("default:cobble",
|
||||
{cracky=3, not_in_creative_inventory=1},
|
||||
{"default_cobble.png"},
|
||||
"Cobble")
|
||||
S("Cobble"))
|
||||
-- BRICK
|
||||
--------
|
||||
technic.cnc.register_all("default:brick",
|
||||
{cracky=3, not_in_creative_inventory=1},
|
||||
{"default_brick.png"},
|
||||
"Brick")
|
||||
S("Brick"))
|
||||
|
||||
-- SANDSTONE
|
||||
------------
|
||||
technic.cnc.register_all("default:sandstone",
|
||||
{crumbly=2, cracky=2, not_in_creative_inventory=1},
|
||||
{"default_sandstone.png"},
|
||||
"Sandstone")
|
||||
S("Sandstone"))
|
||||
|
||||
-- LEAVES
|
||||
---------
|
||||
technic.cnc.register_all("default:leaves",
|
||||
{snappy=2, choppy=2, oddly_breakable_by_hand=3, not_in_creative_inventory=1},
|
||||
{"default_leaves.png"},
|
||||
"Leaves")
|
||||
S("Leaves"))
|
||||
-- TREE
|
||||
-------
|
||||
technic.cnc.register_all("default:tree",
|
||||
{snappy=1, choppy=2, oddly_breakable_by_hand=2, flammable=3, wood=1, not_in_creative_inventory=1},
|
||||
{"default_tree.png"},
|
||||
"Tree")
|
||||
S("Tree"))
|
||||
-- STEEL
|
||||
--------
|
||||
technic.cnc.register_all("default:steel",
|
||||
{snappy=1, bendy=2, cracky=1, melty=2, level=2, not_in_creative_inventory=1},
|
||||
{"default_steel_block.png"},
|
||||
"Steel")
|
||||
S("Steel"))
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
|
||||
-- Coal driven alloy furnace. This uses no EUs:
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:coal_alloy_furnace',
|
||||
@ -12,7 +13,7 @@ minetest.register_craft({
|
||||
})
|
||||
|
||||
minetest.register_node("technic:coal_alloy_furnace", {
|
||||
description = "Alloy Furnace",
|
||||
description = S("Coal Alloy Furnace"),
|
||||
tiles = {"technic_coal_alloy_furnace_top.png", "technic_coal_alloy_furnace_bottom.png", "technic_coal_alloy_furnace_side.png",
|
||||
"technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_front.png"},
|
||||
paramtype2 = "facedir",
|
||||
@ -22,7 +23,7 @@ minetest.register_node("technic:coal_alloy_furnace", {
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
meta:set_string("formspec", coal_alloy_furnace_formspec)
|
||||
meta:set_string("infotext", "Alloy Furnace")
|
||||
meta:set_string("infotext", S("Coal Alloy Furnace"))
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("fuel", 1)
|
||||
inv:set_size("src", 1)
|
||||
@ -68,9 +69,10 @@ minetest.register_abm({
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local recipe = nil
|
||||
local machine_name = S("Coal Alloy Furnace")
|
||||
local formspec =
|
||||
"size[8,9]"..
|
||||
"label[0,0;Alloy Furnace]"..
|
||||
"label[0,0;"..machine_name.."]"..
|
||||
"image[2,2;1,1;default_furnace_fire_bg.png]"..
|
||||
"list[current_name;fuel;2,3;1,1;]"..
|
||||
"list[current_name;src;2,1;1,1;]"..
|
||||
@ -125,13 +127,13 @@ minetest.register_abm({
|
||||
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
|
||||
local percent = math.floor(meta:get_float("fuel_time") /
|
||||
meta:get_float("fuel_totaltime") * 100)
|
||||
meta:set_string("infotext","Furnace active: "..percent.."%")
|
||||
meta:set_string("infotext", S("%s Active"):format(machine_name).." ("..percent.."%)")
|
||||
hacky_swap_node(pos, "technic:coal_alloy_furnace_active")
|
||||
meta:set_string("formspec",
|
||||
"size[8,9]"..
|
||||
"label[0,0;Electric Alloy Furnace]"..
|
||||
"label[0,0;"..machine_name.."]"..
|
||||
"image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:"..
|
||||
(100-percent)..":default_furnace_fire_fg.png]"..
|
||||
(100 - percent)..":default_furnace_fire_fg.png]"..
|
||||
"list[current_name;fuel;2,3;1,1;]"..
|
||||
"list[current_name;src;2,1;1,1;]"..
|
||||
"list[current_name;src2;3,1;1,1;]"..
|
||||
@ -164,7 +166,7 @@ minetest.register_abm({
|
||||
end
|
||||
|
||||
if fuel.time <= 0 then
|
||||
meta:set_string("infotext", "Furnace out of fuel")
|
||||
meta:set_string("infotext", S("%s Out Of Fuel"):format(machine_name))
|
||||
hacky_swap_node(pos, "technic:coal_alloy_furnace")
|
||||
meta:set_string("formspec", formspec)
|
||||
return
|
||||
|
@ -1,10 +1,12 @@
|
||||
technic.compressor_recipes ={}
|
||||
|
||||
technic.compressor_recipes = {}
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
technic.register_compressor_recipe = function(src, src_count, dst, dst_count)
|
||||
technic.compressor_recipes[src] = {src_count = src_count, dst_name = dst, dst_count = dst_count}
|
||||
if unified_inventory then
|
||||
unified_inventory.register_craft(
|
||||
{
|
||||
unified_inventory.register_craft({
|
||||
type = "compressing",
|
||||
output = dst.." "..dst_count,
|
||||
items = {src.." "..src_count},
|
||||
@ -44,13 +46,13 @@ minetest.register_craft({
|
||||
|
||||
local compressor_formspec =
|
||||
"invsize[8,9;]"..
|
||||
"label[0,0;Compressor]"..
|
||||
"label[0,0;"..S("Compressor").."]"..
|
||||
"list[current_name;src;3,1;1,1;]"..
|
||||
"list[current_name;dst;5,1;2,2;]"..
|
||||
"list[current_player;main;0,5;8,4;]"
|
||||
|
||||
minetest.register_node("technic:compressor", {
|
||||
description = "Compressor",
|
||||
description = S("Compressor"),
|
||||
tiles = {"technic_compressor_top.png", "technic_compressor_bottom.png",
|
||||
"technic_compressor_side.png", "technic_compressor_side.png",
|
||||
"technic_compressor_back.png", "technic_compressor_front.png"},
|
||||
@ -60,8 +62,7 @@ minetest.register_node("technic:compressor", {
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", "Compressor")
|
||||
meta:set_float("technic_power_machine", 1)
|
||||
meta:set_string("infotext", S("Compressor"))
|
||||
meta:set_string("formspec", compressor_formspec)
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("src", 1)
|
||||
@ -72,7 +73,7 @@ minetest.register_node("technic:compressor", {
|
||||
local inv = meta:get_inventory()
|
||||
if not inv:is_empty("src") or not inv:is_empty("dst") then
|
||||
minetest.chat_send_player(player:get_player_name(),
|
||||
"Machine cannot be removed because it is not empty")
|
||||
S("Machine cannot be removed because it is not empty"))
|
||||
return false
|
||||
else
|
||||
return true
|
||||
@ -81,7 +82,7 @@ minetest.register_node("technic:compressor", {
|
||||
})
|
||||
|
||||
minetest.register_node("technic:compressor_active", {
|
||||
description = "Compressor",
|
||||
description = S("Compressor"),
|
||||
tiles = {"technic_compressor_top.png", "technic_compressor_bottom.png",
|
||||
"technic_compressor_side.png", "technic_compressor_side.png",
|
||||
"technic_compressor_back.png", "technic_compressor_front_active.png"},
|
||||
@ -94,7 +95,7 @@ minetest.register_node("technic:compressor_active", {
|
||||
local inv = meta:get_inventory()
|
||||
if not inv:is_empty("src") or not inv:is_empty("dst") then
|
||||
minetest.chat_send_player(player:get_player_name(),
|
||||
"Machine cannot be removed because it is not empty");
|
||||
S("Machine cannot be removed because it is not empty"))
|
||||
return false
|
||||
else
|
||||
return true
|
||||
@ -109,7 +110,7 @@ minetest.register_abm({
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local eu_input = meta:get_int("LV_EU_input")
|
||||
local machine_name = "Compressor"
|
||||
local machine_name = S("Compressor")
|
||||
local machine_node = "technic:compressor"
|
||||
local demand = 300
|
||||
|
||||
@ -139,7 +140,7 @@ minetest.register_abm({
|
||||
if empty or (not result) or
|
||||
(not inv:room_for_item("dst", result)) then
|
||||
hacky_swap_node(pos, machine_node)
|
||||
meta:set_string("infotext", machine_name.." Idle")
|
||||
meta:set_string("infotext", S("%s Idle"):format(machine_name))
|
||||
meta:set_int("LV_EU_demand", 0)
|
||||
meta:set_int("src_time", 0)
|
||||
return
|
||||
@ -147,10 +148,10 @@ minetest.register_abm({
|
||||
|
||||
if eu_input < demand then
|
||||
hacky_swap_node(pos, machine_node)
|
||||
meta:set_string("infotext", machine_name.." Unpowered")
|
||||
meta:set_string("infotext", S("%s Unpowered"):format(machine_name))
|
||||
elseif eu_input >= demand then
|
||||
hacky_swap_node(pos, machine_node.."_active")
|
||||
meta:set_string("infotext", machine_name.." Active")
|
||||
meta:set_string("infotext", S("%s Active"):format(machine_name))
|
||||
|
||||
meta:set_int("src_time", meta:get_int("src_time") + 1)
|
||||
if meta:get_int("src_time") >= 4 then
|
||||
|
@ -1,5 +1,8 @@
|
||||
|
||||
technic.extractor_recipes ={}
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
technic.register_extractor_recipe = function(src, src_count, dst, dst_count)
|
||||
technic.extractor_recipes[src] = {src_count = src_count, dst_name = dst, dst_count = dst_count}
|
||||
if unified_inventory then
|
||||
@ -50,13 +53,13 @@ minetest.register_craft({
|
||||
|
||||
local extractor_formspec =
|
||||
"invsize[8,9;]"..
|
||||
"label[0,0;Extractor]"..
|
||||
"label[0,0;"..S("Extractor").."]"..
|
||||
"list[current_name;src;3,1;1,1;]"..
|
||||
"list[current_name;dst;5,1;2,2;]"..
|
||||
"list[current_player;main;0,5;8,4;]"
|
||||
|
||||
minetest.register_node("technic:extractor", {
|
||||
description = "Extractor",
|
||||
description = S("Extractor"),
|
||||
tiles = {"technic_lv_grinder_top.png", "technic_lv_grinder_bottom.png", "technic_lv_grinder_side.png",
|
||||
"technic_lv_grinder_side.png", "technic_lv_grinder_side.png", "technic_lv_grinder_front.png"},
|
||||
paramtype2 = "facedir",
|
||||
@ -65,7 +68,7 @@ minetest.register_node("technic:extractor", {
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", "Extractor")
|
||||
meta:set_string("infotext", S("Extractor"))
|
||||
meta:set_string("formspec", extractor_formspec)
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("src", 1)
|
||||
@ -76,7 +79,7 @@ minetest.register_node("technic:extractor", {
|
||||
local inv = meta:get_inventory()
|
||||
if not inv:is_empty("src") or not inv:is_empty("dst") then
|
||||
minetest.chat_send_player(player:get_player_name(),
|
||||
"Machine cannot be removed because it is not empty");
|
||||
S("Machine cannot be removed because it is not empty"))
|
||||
return false
|
||||
else
|
||||
return true
|
||||
@ -85,7 +88,7 @@ minetest.register_node("technic:extractor", {
|
||||
})
|
||||
|
||||
minetest.register_node("technic:extractor_active", {
|
||||
description = "Extractor",
|
||||
description = S("Extractor"),
|
||||
tiles = {"technic_lv_grinder_top.png", "technic_lv_grinder_bottom.png",
|
||||
"technic_lv_grinder_side.png", "technic_lv_grinder_side.png",
|
||||
"technic_lv_grinder_side.png", "technic_lv_grinder_front_active.png"},
|
||||
@ -98,7 +101,7 @@ minetest.register_node("technic:extractor_active", {
|
||||
local inv = meta:get_inventory()
|
||||
if not inv:is_empty("src") or not inv:is_empty("dst") then
|
||||
minetest.chat_send_player(player:get_player_name(),
|
||||
"Machine cannot be removed because it is not empty");
|
||||
S("Machine cannot be removed because it is not empty"))
|
||||
return false
|
||||
else
|
||||
return true
|
||||
@ -118,7 +121,7 @@ minetest.register_abm({
|
||||
local eu_input = meta:get_int("LV_EU_input")
|
||||
|
||||
-- Machine information
|
||||
local machine_name = "Extractor"
|
||||
local machine_name = S("Extractor")
|
||||
local machine_node = "technic:extractor"
|
||||
local demand = 300
|
||||
|
||||
@ -144,7 +147,7 @@ minetest.register_abm({
|
||||
if inv:is_empty("src") or (not recipe) or (not result) or
|
||||
(not inv:room_for_item("dst", result)) then
|
||||
hacky_swap_node(pos, machine_node)
|
||||
meta:set_string("infotext", machine_name.." Idle")
|
||||
meta:set_string("infotext", S("%s Idle"):format(machine_name))
|
||||
meta:set_int("LV_EU_demand", 0)
|
||||
return
|
||||
end
|
||||
@ -152,11 +155,11 @@ minetest.register_abm({
|
||||
if eu_input < demand then
|
||||
-- unpowered - go idle
|
||||
hacky_swap_node(pos, machine_node)
|
||||
meta:set_string("infotext", machine_name.." Unpowered")
|
||||
meta:set_string("infotext", S("%s Unpowered"):format(machine_name))
|
||||
elseif eu_input >= demand then
|
||||
-- Powered
|
||||
hacky_swap_node(pos, machine_node.."_active")
|
||||
meta:set_string("infotext", machine_name.." Active")
|
||||
meta:set_string("infotext", S("%s Active"):format(machine_name))
|
||||
|
||||
meta:set_int("src_time", meta:get_int("src_time") + 1)
|
||||
if meta:get_int("src_time") >= 4 then -- 4 ticks per output
|
||||
|
@ -5,6 +5,8 @@
|
||||
|
||||
minetest.register_alias("geothermal", "technic:geothermal")
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:geothermal',
|
||||
recipe = {
|
||||
@ -15,18 +17,17 @@ minetest.register_craft({
|
||||
})
|
||||
|
||||
minetest.register_craftitem("technic:geothermal", {
|
||||
description = "Geothermal Generator",
|
||||
stack_max = 99,
|
||||
description = S("Geothermal Generator"),
|
||||
})
|
||||
|
||||
local geothermal_formspec =
|
||||
"invsize[8,4;]"..
|
||||
"label[0,0;Geothermal Generator]"..
|
||||
"label[0,0;"..S("Geothermal Generator").."]"..
|
||||
"list[current_player;main;0,5;8,4;]"
|
||||
|
||||
|
||||
minetest.register_node("technic:geothermal", {
|
||||
description = "Geothermal Generator",
|
||||
description = S("Geothermal Generator"),
|
||||
tiles = {"technic_geothermal_top.png", "technic_machine_bottom.png", "technic_geothermal_side.png",
|
||||
"technic_geothermal_side.png", "technic_geothermal_side.png", "technic_geothermal_side.png"},
|
||||
paramtype2 = "facedir",
|
||||
@ -35,15 +36,14 @@ minetest.register_node("technic:geothermal", {
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", "Geothermal Generator")
|
||||
meta:set_float("technic_power_machine", 1)
|
||||
meta:set_string("infotext", S("Geothermal Generator"))
|
||||
meta:set_int("LV_EU_supply", 0)
|
||||
meta:set_string("formspec", geothermal_formspec)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("technic:geothermal_active", {
|
||||
description = "Geothermal Generator",
|
||||
description = S("Geothermal Generator"),
|
||||
tiles = {"technic_geothermal_top_active.png", "technic_machine_bottom.png", "technic_geothermal_side.png",
|
||||
"technic_geothermal_side.png", "technic_geothermal_side.png", "technic_geothermal_side.png"},
|
||||
paramtype2 = "facedir",
|
||||
@ -104,8 +104,8 @@ minetest.register_abm({
|
||||
|
||||
meta:set_string("formspec",
|
||||
"invsize[8,4;]"..
|
||||
"label[0,0;Geothermal Generator]"..
|
||||
"label[4,0;Production at "..tostring(production_level).."%]")
|
||||
"label[0,0;"..S("Geothermal Generator").."]"..
|
||||
"label[4,0;"..S("Production at %d%%"):format(production_level).."]")
|
||||
|
||||
if production_level > 0 and minetest.get_node(pos).name == "technic:geothermal" then
|
||||
hacky_swap_node (pos, "technic:geothermal_active")
|
||||
|
@ -1,6 +1,8 @@
|
||||
-- LV Music player.
|
||||
-- The player can play music. But it is high ampage!
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
minetest.register_alias("music_player", "technic:music_player")
|
||||
minetest.register_craft({
|
||||
output = 'technic:music_player',
|
||||
@ -13,7 +15,7 @@ minetest.register_craft({
|
||||
|
||||
local music_player_formspec =
|
||||
"invsize[8,9;]"..
|
||||
"label[0,0;Music Player]"..
|
||||
"label[0,0;"..S("Music Player").."]"..
|
||||
"button[4,1;1,1;track1;1]"..
|
||||
"button[5,1;1,1;track2;2]"..
|
||||
"button[6,1;1,1;track3;3]"..
|
||||
@ -28,14 +30,14 @@ local music_player_formspec =
|
||||
"label[4,0;Current track --]"
|
||||
|
||||
minetest.register_node("technic:music_player", {
|
||||
description = "Music Player",
|
||||
description = S("Music Player"),
|
||||
tiles = {"technic_music_player_top.png", "technic_machine_bottom.png", "technic_music_player_side.png",
|
||||
"technic_music_player_side.png", "technic_music_player_side.png", "technic_music_player_side.png"},
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", "Music Player")
|
||||
meta:set_string("infotext", S("Music Player"))
|
||||
meta:set_int("active", 0)
|
||||
meta:set_int("current_track", 1)
|
||||
meta:set_string("formspec", music_player_formspec)
|
||||
@ -56,7 +58,7 @@ minetest.register_node("technic:music_player", {
|
||||
meta:set_int("current_track", current_track)
|
||||
meta:set_string("formspec",
|
||||
"invsize[8,9;]"..
|
||||
"label[0,0;Music Player]"..
|
||||
"label[0,0;"..S("Music Player").."]"..
|
||||
"button[4,1;1,1;track1;1]"..
|
||||
"button[5,1;1,1;track2;2]"..
|
||||
"button[6,1;1,1;track3;3]"..
|
||||
@ -93,7 +95,7 @@ minetest.register_abm({
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local eu_input = meta:get_int("LV_EU_input")
|
||||
local machine_name = "Music Player"
|
||||
local machine_name = S("Music Player")
|
||||
local machine_node = "technic:music_player"
|
||||
local demand = 150
|
||||
|
||||
@ -111,7 +113,7 @@ minetest.register_abm({
|
||||
technic.switching_station_timeout_count(pos, "LV")
|
||||
|
||||
if meta:get_int("active") == 0 then
|
||||
meta:set_string("infotext", machine_name.." Idle")
|
||||
meta:set_string("infotext", S("%s Idle"):format(machine_name))
|
||||
meta:set_int("LV_EU_demand", 0)
|
||||
if music_handle then
|
||||
minetest.sound_stop(music_handle)
|
||||
@ -120,12 +122,12 @@ minetest.register_abm({
|
||||
end
|
||||
|
||||
if eu_input < demand then
|
||||
meta:set_string("infotext", machine_name.." Unpowered")
|
||||
meta:set_string("infotext", S("%s Unpowered"):format(machine_name))
|
||||
if music_handle then
|
||||
minetest.sound_stop(music_handle)
|
||||
end
|
||||
elseif eu_input >= demand then
|
||||
meta:set_string("infotext", machine_name.." Active")
|
||||
meta:set_string("infotext", S("%s Active"):format(machine_name))
|
||||
music_handle = minetest.sound_play("technic_track"..current_track,
|
||||
{pos = pos, gain = 1.0, loop = true, max_hear_distance = 72,})
|
||||
meta:set_int("music_handle", music_handle)
|
||||
|
@ -2,12 +2,14 @@
|
||||
-- They can however also be used separately but with reduced efficiency due to the missing transformer.
|
||||
-- Individual panels are less efficient than when the panels are combined into full arrays.
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
minetest.register_node("technic:solar_panel", {
|
||||
tiles = {"technic_solar_panel_top.png", "technic_solar_panel_bottom.png", "technic_solar_panel_side.png",
|
||||
"technic_solar_panel_side.png", "technic_solar_panel_side.png", "technic_solar_panel_side.png"},
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
description="Solar Panel",
|
||||
description = S("Solar Panel"),
|
||||
active = false,
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
@ -19,7 +21,7 @@ minetest.register_node("technic:solar_panel", {
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_int("LV_EU_supply", 0)
|
||||
meta:set_string("infotext", "LV Solar Panel")
|
||||
meta:set_string("infotext", S("Solar Panel"))
|
||||
end,
|
||||
})
|
||||
|
||||
@ -46,6 +48,7 @@ minetest.register_abm({
|
||||
-- To take care of some of it solar panels do not work outside daylight hours or if
|
||||
-- built below -10m
|
||||
local pos1 = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||
local machine_name = S("Solar Panel")
|
||||
|
||||
local light = minetest.get_node_light(pos1, nil)
|
||||
local time_of_day = minetest.get_timeofday()
|
||||
@ -57,10 +60,10 @@ minetest.register_abm({
|
||||
local charge_to_give = math.floor((light + pos1.y) * 3)
|
||||
charge_to_give = math.max(charge_to_give, 0)
|
||||
charge_to_give = math.min(charge_to_give, 200)
|
||||
meta:set_string("infotext", "Solar Panel is active ("..charge_to_give.."EU)")
|
||||
meta:set_string("infotext", S("%s Active"):format(machine_name).." ("..charge_to_give.."EU)")
|
||||
meta:set_int("LV_EU_supply", charge_to_give)
|
||||
else
|
||||
meta:set_string("infotext", "Solar Panel is inactive");
|
||||
meta:set_string("infotext", S("%s Idle"):format(machine_name))
|
||||
meta:set_int("LV_EU_supply", 0)
|
||||
end
|
||||
end,
|
||||
|
@ -1,6 +1,9 @@
|
||||
-- A water mill produces LV EUs by exploiting flowing water across it
|
||||
-- It is a LV EU supplyer and fairly low yield (max 120EUs)
|
||||
-- It is a little under half as good as the thermal generator.
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
minetest.register_alias("water_mill", "technic:water_mill")
|
||||
|
||||
minetest.register_craft({
|
||||
@ -13,7 +16,7 @@ minetest.register_craft({
|
||||
})
|
||||
|
||||
minetest.register_node("technic:water_mill", {
|
||||
description = "Water Mill",
|
||||
description = S("Water Mill"),
|
||||
tiles = {"technic_water_mill_top.png", "technic_machine_bottom.png",
|
||||
"technic_water_mill_side.png", "technic_water_mill_side.png",
|
||||
"technic_water_mill_side.png", "technic_water_mill_side.png"},
|
||||
@ -23,13 +26,13 @@ minetest.register_node("technic:water_mill", {
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", "Water Mill")
|
||||
meta:set_string("infotext", S("Water Mill"))
|
||||
meta:set_int("LV_EU_supply", 0)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("technic:water_mill_active", {
|
||||
description = "Water Mill",
|
||||
description = S("Water Mill"),
|
||||
tiles = {"technic_water_mill_top_active.png", "technic_machine_bottom.png",
|
||||
"technic_water_mill_side.png", "technic_water_mill_side.png",
|
||||
"technic_water_mill_side.png", "technic_water_mill_side.png"},
|
||||
@ -82,7 +85,7 @@ minetest.register_abm({
|
||||
end
|
||||
|
||||
meta:set_string("infotext",
|
||||
"Water Mill ("..production_level.."%)")
|
||||
S("Water Mill").." ("..production_level.."%)")
|
||||
|
||||
if production_level > 0 and
|
||||
minetest.get_node(pos).name == "technic:water_mill" then
|
||||
|
Reference in New Issue
Block a user