mirror of
https://github.com/minetest-mods/technic.git
synced 2024-09-12 08:18:30 +02:00
Add support for translations via intllib
This commit is contained in:
parent
d8e02eb2dd
commit
be2f30a1a2
@ -3,3 +3,4 @@ moreores
|
||||
pipeworks
|
||||
mesecons
|
||||
mesecons_mvps?
|
||||
intllib?
|
||||
|
@ -8,6 +8,13 @@ local load_start = os.clock()
|
||||
local modpath = minetest.get_modpath("technic")
|
||||
technic.modpath = modpath
|
||||
|
||||
-- Boilerplate to support intllib + S("%s", "foo") syntax
|
||||
if intllib then
|
||||
technic.getter = intllib.Getter()
|
||||
else
|
||||
technic.getter = function(s) return s end
|
||||
end
|
||||
local S = technic.getter
|
||||
|
||||
-- Read configuration file
|
||||
dofile(modpath.."/config.lua")
|
||||
@ -55,6 +62,6 @@ function hacky_swap_node(pos, name)
|
||||
end
|
||||
|
||||
if minetest.setting_get("log_mod") then
|
||||
print("[Technic] Loaded in "..tostring(os.clock() - load_start).."s")
|
||||
print(S("[Technic] Loaded in %f seconds"):format(os.clock() - load_start))
|
||||
end
|
||||
|
||||
|
@ -1,30 +1,33 @@
|
||||
minetest.register_craftitem( "technic:silicon_wafer", {
|
||||
description = "Silicon Wafer",
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
minetest.register_craftitem("technic:silicon_wafer", {
|
||||
description = S("Silicon Wafer"),
|
||||
inventory_image = "technic_silicon_wafer.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem( "technic:doped_silicon_wafer", {
|
||||
description = "Doped Silicon Wafer",
|
||||
description = S("Doped Silicon Wafer"),
|
||||
inventory_image = "technic_doped_silicon_wafer.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("technic:enriched_uranium", {
|
||||
description = "Enriched Uranium",
|
||||
description = S("Enriched Uranium"),
|
||||
inventory_image = "technic_enriched_uranium.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("technic:uranium_fuel", {
|
||||
description = "Uranium Fuel",
|
||||
description = S("Uranium Fuel"),
|
||||
inventory_image = "technic_uranium_fuel.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem( "technic:diamond_drill_head", {
|
||||
description = "Diamond Drill Head",
|
||||
description = S("Diamond Drill Head"),
|
||||
inventory_image = "technic_diamond_drill_head.png",
|
||||
})
|
||||
|
||||
minetest.register_tool("technic:blue_energy_crystal", {
|
||||
description = "Blue Energy Crystal",
|
||||
description = S("Blue Energy Crystal"),
|
||||
inventory_image = minetest.inventorycube(
|
||||
"technic_diamond_block_blue.png",
|
||||
"technic_diamond_block_blue.png",
|
||||
@ -38,7 +41,7 @@ minetest.register_tool("technic:blue_energy_crystal", {
|
||||
})
|
||||
|
||||
minetest.register_tool("technic:green_energy_crystal", {
|
||||
description = "Green Energy Crystal",
|
||||
description = S("Green Energy Crystal"),
|
||||
inventory_image = minetest.inventorycube(
|
||||
"technic_diamond_block_green.png",
|
||||
"technic_diamond_block_green.png",
|
||||
@ -52,7 +55,7 @@ minetest.register_tool("technic:green_energy_crystal", {
|
||||
})
|
||||
|
||||
minetest.register_tool("technic:red_energy_crystal", {
|
||||
description = "Red Energy Crystal",
|
||||
description = S("Red Energy Crystal"),
|
||||
inventory_image = minetest.inventorycube(
|
||||
"technic_diamond_block_red.png",
|
||||
"technic_diamond_block_red.png",
|
||||
@ -66,86 +69,72 @@ minetest.register_tool("technic:red_energy_crystal", {
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craftitem( "technic:fine_copper_wire", {
|
||||
description = "Fine Copper Wire",
|
||||
minetest.register_craftitem("technic:fine_copper_wire", {
|
||||
description = S("Fine Copper Wire"),
|
||||
inventory_image = "technic_fine_copper_wire.png",
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
})
|
||||
|
||||
minetest.register_craftitem( "technic:copper_coil", {
|
||||
description = "Copper Coil",
|
||||
minetest.register_craftitem("technic:copper_coil", {
|
||||
description = S("Copper Coil"),
|
||||
inventory_image = "technic_copper_coil.png",
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
})
|
||||
|
||||
minetest.register_craftitem( "technic:motor", {
|
||||
description = "Electric Motor",
|
||||
minetest.register_craftitem("technic:motor", {
|
||||
description = S("Electric Motor"),
|
||||
inventory_image = "technic_motor.png",
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
})
|
||||
|
||||
minetest.register_craftitem( "technic:lv_transformer", {
|
||||
description = "Low Voltage Transformer",
|
||||
minetest.register_craftitem("technic:lv_transformer", {
|
||||
description = S("Low Voltage Transformer"),
|
||||
inventory_image = "technic_lv_transformer.png",
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
})
|
||||
|
||||
minetest.register_craftitem( "technic:lv_transformer", {
|
||||
description = "Low Voltage Transformer",
|
||||
minetest.register_craftitem("technic:lv_transformer", {
|
||||
description = S("Low Voltage Transformer"),
|
||||
inventory_image = "technic_lv_transformer.png",
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
})
|
||||
minetest.register_craftitem( "technic:mv_transformer", {
|
||||
description = "Medium Voltage Transformer",
|
||||
minetest.register_craftitem("technic:mv_transformer", {
|
||||
description = S("Medium Voltage Transformer"),
|
||||
inventory_image = "technic_mv_transformer.png",
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
})
|
||||
|
||||
minetest.register_craftitem( "technic:hv_transformer", {
|
||||
description = "High Voltage Transformer",
|
||||
description = S("High Voltage Transformer"),
|
||||
inventory_image = "technic_hv_transformer.png",
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
})
|
||||
|
||||
minetest.register_craftitem( "technic:control_logic_unit", {
|
||||
description = "Control Logic Unit",
|
||||
description = S("Control Logic Unit"),
|
||||
inventory_image = "technic_control_logic_unit.png",
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("technic:mixed_metal_ingot", {
|
||||
description = "Mixed Metal Ingot",
|
||||
description = S("Mixed Metal Ingot"),
|
||||
inventory_image = "technic_mixed_metal_ingot.png",
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("technic:composite_plate", {
|
||||
description = "Composite Plate",
|
||||
description = S("Composite Plate"),
|
||||
inventory_image = "technic_composite_plate.png",
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("technic:copper_plate", {
|
||||
description = "Copper Plate",
|
||||
description = S("Copper Plate"),
|
||||
inventory_image = "technic_copper_plate.png",
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("technic:carbon_plate", {
|
||||
description = "Carbon Plate",
|
||||
description = S("Carbon Plate"),
|
||||
inventory_image = "technic_carbon_plate.png",
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("technic:graphite", {
|
||||
description = "Graphite",
|
||||
description = S("Graphite"),
|
||||
inventory_image = "technic_graphite.png",
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("technic:carbon_cloth", {
|
||||
description = "Carbon Cloth",
|
||||
description = S("Carbon Cloth"),
|
||||
inventory_image = "technic_carbon_cloth.png",
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
})
|
||||
|
||||
|
163
technic/locale/template.txt
Normal file
163
technic/locale/template.txt
Normal file
@ -0,0 +1,163 @@
|
||||
# template.txt
|
||||
# Template for translations of Technic
|
||||
|
||||
|
||||
## Misc
|
||||
[Technic] Loaded in %f seconds =
|
||||
|
||||
## Items
|
||||
Silicon Wafer =
|
||||
Doped Silicon Wafer =
|
||||
Enriched Uranium =
|
||||
Uranium Fuel =
|
||||
Diamond Drill Head =
|
||||
Blue Energy Crystal =
|
||||
Green Energy Crystal =
|
||||
Red Energy Crystal =
|
||||
Fine Copper Wire =
|
||||
Copper Coil =
|
||||
Electric Motor =
|
||||
Low Voltage Transformer =
|
||||
Medium Voltage Transformer =
|
||||
High Voltage Transformer =
|
||||
Control Logic Unit =
|
||||
Mixed Metal Ingot =
|
||||
Composite Plate =
|
||||
Copper Plate =
|
||||
Carbon Plate =
|
||||
Graphite =
|
||||
Carbon Cloth =
|
||||
Raw Latex =
|
||||
Rubber Fiber =
|
||||
|
||||
## Machine misc
|
||||
Machine cannot be removed because it is not empty =
|
||||
# $1: Machine name (Includes tier)
|
||||
%s Active =
|
||||
%s Disabled =
|
||||
%s Idle =
|
||||
%s Improperly Placed =
|
||||
%s Unpowered =
|
||||
%s Out Of Fuel =
|
||||
%s Has Bad Cabling =
|
||||
%s Has No Network =
|
||||
%s Finished =
|
||||
Enable/Disable =
|
||||
Range =
|
||||
|
||||
|
||||
## Machine names
|
||||
# $1: Tier
|
||||
%s Alloy Furnace =
|
||||
%s Battery Box =
|
||||
%s Cable =
|
||||
%s Electric Furnace =
|
||||
%s Grinder =
|
||||
%s Generator =
|
||||
%s Solar Array =
|
||||
Battery Box =
|
||||
Supply Converter =
|
||||
Switching Station =
|
||||
CNC Machine =
|
||||
Coal Alloy Furnace =
|
||||
Extractor =
|
||||
Compressor =
|
||||
Solar Panel =
|
||||
Geothermal Generator =
|
||||
Music Player =
|
||||
Water Mill =
|
||||
Tool WorkShop =
|
||||
Wind Mill =
|
||||
Wind Mill Frame =
|
||||
Forcefield Emitter =
|
||||
Forcefield =
|
||||
Nuclear Reactor Core =
|
||||
Nuclear Reactor Rod Compartment =
|
||||
Quarry =
|
||||
|
||||
## Machine-specific
|
||||
# $1: Pruduced EU
|
||||
Charge =
|
||||
Discharge =
|
||||
Power level =
|
||||
# $1: Tier $2: current_charge $3: max_charge
|
||||
%s Battery Box: %d/%d =
|
||||
# $1: Machine name $2: Supply $3: Demand
|
||||
%s. Supply: %d Demand: %d =
|
||||
Production at %d%% =
|
||||
|
||||
## CNC
|
||||
Cylinder =
|
||||
Element Cross =
|
||||
Element Cross Double =
|
||||
Element Edge =
|
||||
Element Edge Double =
|
||||
Element End =
|
||||
Element End Double =
|
||||
Element Straight =
|
||||
Element Straight Double =
|
||||
Element T =
|
||||
Element T Double =
|
||||
Horizontal Cylinder =
|
||||
One Curved Edge Block =
|
||||
Pyramid =
|
||||
Slope =
|
||||
Slope Edge =
|
||||
Slope Inner Edge =
|
||||
Slope Lying =
|
||||
Slope Upside Down =
|
||||
Slope Upside Down Edge =
|
||||
Slope Upside Down Inner Edge =
|
||||
Sphere =
|
||||
Spike =
|
||||
Stick =
|
||||
Two Curved Edge Block =
|
||||
Brick =
|
||||
Cobble =
|
||||
Dirt =
|
||||
Leaves =
|
||||
Sandstone =
|
||||
Steel =
|
||||
Stone =
|
||||
Tree =
|
||||
Wooden =
|
||||
|
||||
## Grinder Recipes
|
||||
# $1: Name
|
||||
%s Dust =
|
||||
Akalin =
|
||||
Alatro =
|
||||
Arol =
|
||||
Brass =
|
||||
Bronze =
|
||||
Chromium =
|
||||
Coal =
|
||||
Copper =
|
||||
Gold =
|
||||
Iron =
|
||||
Mithril =
|
||||
Silver =
|
||||
Stainless Steel =
|
||||
Talinite =
|
||||
Tin =
|
||||
Zinc =
|
||||
|
||||
## Tools
|
||||
Water Can =
|
||||
Lava Can =
|
||||
Chainsaw =
|
||||
Flashlight =
|
||||
3 nodes deep. =
|
||||
3 nodes tall. =
|
||||
3 nodes wide. =
|
||||
3x3 nodes. =
|
||||
Hold shift and use to change Mining Drill Mk%d modes. =
|
||||
Mining Drill Mk%d Mode %d =
|
||||
Mining Drill Mk1 =
|
||||
Mining Drill Mk2 =
|
||||
Mining Drill Mk3 =
|
||||
Single node. =
|
||||
Sonic Screwdriver =
|
||||
Tree Tap =
|
||||
|
||||
|
@ -9,6 +9,8 @@
|
||||
local forcefield_power_drain = 10
|
||||
local forcefield_step_interval = 1
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:forcefield_emitter_off',
|
||||
recipe = {
|
||||
@ -62,8 +64,8 @@ end
|
||||
|
||||
local get_forcefield_formspec = function(range)
|
||||
return "size[3,1.5]"..
|
||||
"field[1,0.5;2,1;range;Range;"..range.."]"..
|
||||
"button[0,1;3,1;toggle;Enable/Disable]"
|
||||
"field[1,0.5;2,1;range;"..S("Range")..";"..range.."]"..
|
||||
"button[0,1;3,1;toggle;"..S("Enable/Disable").."]"
|
||||
end
|
||||
|
||||
local forcefield_receive_fields = function(pos, formname, fields, sender)
|
||||
@ -103,7 +105,7 @@ local mesecons = {
|
||||
}
|
||||
|
||||
minetest.register_node("technic:forcefield_emitter_off", {
|
||||
description = "Forcefield emitter",
|
||||
description = S("Forcefield Emitter"),
|
||||
tiles = {"technic_forcefield_emitter_off.png"},
|
||||
groups = {cracky = 1},
|
||||
on_receive_fields = forcefield_receive_fields,
|
||||
@ -114,13 +116,13 @@ minetest.register_node("technic:forcefield_emitter_off", {
|
||||
meta:set_int("range", 10)
|
||||
meta:set_int("enabled", 0)
|
||||
meta:set_string("formspec", get_forcefield_formspec(10))
|
||||
meta:set_string("infotext", "Forcefield emitter");
|
||||
meta:set_string("infotext", S("Forcefield Emitter"))
|
||||
end,
|
||||
mesecons = mesecons
|
||||
})
|
||||
|
||||
minetest.register_node("technic:forcefield_emitter_on", {
|
||||
description = "Forcefield emitter on (you hacker you)",
|
||||
description = S("Forcefield Emitter"),
|
||||
tiles = {"technic_forcefield_emitter_on.png"},
|
||||
groups = {cracky = 1, not_in_creative_inventory=1},
|
||||
drop = "technic:forcefield_emitter_off",
|
||||
@ -138,7 +140,7 @@ minetest.register_node("technic:forcefield_emitter_on", {
|
||||
})
|
||||
|
||||
minetest.register_node("technic:forcefield", {
|
||||
description = "Forcefield (you hacker you)",
|
||||
description = S("Forcefield"),
|
||||
sunlight_propagates = true,
|
||||
drawtype = "glasslike",
|
||||
groups = {not_in_creative_inventory=1, unbreakable=1},
|
||||
@ -164,6 +166,7 @@ minetest.register_abm({
|
||||
local eu_input = meta:get_int("HV_EU_input")
|
||||
local eu_demand = meta:get_int("HV_EU_demand")
|
||||
local enabled = meta:get_int("enabled")
|
||||
local machine_name = S("Forcefield Emitter")
|
||||
-- Power off automatically if no longer connected to a switching station
|
||||
technic.switching_station_timeout_count(pos, "HV")
|
||||
|
||||
@ -176,11 +179,11 @@ minetest.register_abm({
|
||||
meta:set_int("HV_EU_demand", 0)
|
||||
update_forcefield(pos, meta:get_int("range"), false)
|
||||
hacky_swap_node(pos, "technic:forcefield_emitter_off")
|
||||
meta:set_string("infotext", "Forcefield Generator Disabled")
|
||||
meta:set_string("infotext", S("%s Disabled"):format(machine_name))
|
||||
return
|
||||
end
|
||||
elseif eu_input < power_requirement then
|
||||
meta:set_string("infotext", "Forcefield Generator Unpowered")
|
||||
meta:set_string("infotext", S("%s Unpowered"):format(machine_name))
|
||||
if node.name == "technic:forcefield_emitter_on" then
|
||||
update_forcefield(pos, meta:get_int("range"), false)
|
||||
hacky_swap_node(pos, "technic:forcefield_emitter_off")
|
||||
@ -188,7 +191,7 @@ minetest.register_abm({
|
||||
elseif eu_input >= power_requirement then
|
||||
if node.name == "technic:forcefield_emitter_off" then
|
||||
hacky_swap_node(pos, "technic:forcefield_emitter_on")
|
||||
meta:set_string("infotext", "Forcefield Generator Active")
|
||||
meta:set_string("infotext", S("%s Active"):format(machine_name))
|
||||
end
|
||||
update_forcefield(pos, meta:get_int("range"), true)
|
||||
end
|
||||
|
@ -10,6 +10,7 @@ local burn_ticks = 7 * 24 * 60 * 60 -- (seconds).
|
||||
local power_supply = 100000 -- EUs
|
||||
local fuel_type = "technic:uranium_fuel" -- The reactor burns this stuff
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
-- FIXME: recipe must make more sense like a rod recepticle, steam chamber, HV generator?
|
||||
minetest.register_craft({
|
||||
@ -23,7 +24,7 @@ minetest.register_craft({
|
||||
|
||||
local generator_formspec =
|
||||
"invsize[8,9;]"..
|
||||
"label[0,0;Nuclear Reactor Rod Compartment]"..
|
||||
"label[0,0;"..S("Nuclear Reactor Rod Compartment").."]"..
|
||||
"list[current_name;src;2,1;3,2;]"..
|
||||
"list[current_player;main;0,5;8,4;]"
|
||||
|
||||
@ -48,7 +49,7 @@ local nodebox = {
|
||||
}
|
||||
|
||||
minetest.register_node("technic:hv_nuclear_reactor_core", {
|
||||
description = "Nuclear Reactor",
|
||||
description = S("Nuclear Reactor Core"),
|
||||
tiles = {"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png",
|
||||
"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png",
|
||||
"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png"},
|
||||
@ -64,7 +65,7 @@ minetest.register_node("technic:hv_nuclear_reactor_core", {
|
||||
},
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", "Nuclear Reactor Core")
|
||||
meta:set_string("infotext", S("Nuclear Reactor Core"))
|
||||
meta:set_int("HV_EU_supply", 0)
|
||||
-- Signal to the switching station that this device burns some
|
||||
-- sort of fuel and needs special handling
|
||||
@ -74,12 +75,12 @@ minetest.register_node("technic:hv_nuclear_reactor_core", {
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("src", 6)
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
can_dig = function(pos, player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
if not inv:is_empty("src") 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
|
||||
@ -88,7 +89,6 @@ minetest.register_node("technic:hv_nuclear_reactor_core", {
|
||||
})
|
||||
|
||||
minetest.register_node("technic:hv_nuclear_reactor_core_active", {
|
||||
description = "HV Uranium Reactor",
|
||||
tiles = {"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png",
|
||||
"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png",
|
||||
"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png"},
|
||||
@ -103,12 +103,12 @@ minetest.register_node("technic:hv_nuclear_reactor_core_active", {
|
||||
type = "fixed",
|
||||
fixed = nodebox
|
||||
},
|
||||
can_dig = function(pos,player)
|
||||
can_dig = function(pos, player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
if not inv:is_empty("src") 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
|
||||
@ -208,6 +208,7 @@ minetest.register_abm({
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local machine_name = S("Nuclear Reactor Core")
|
||||
local burn_time = meta:get_int("burn_time") or 0
|
||||
|
||||
if burn_time >= burn_ticks or burn_time == 0 then
|
||||
@ -238,7 +239,7 @@ minetest.register_abm({
|
||||
end
|
||||
meta:set_int("HV_EU_supply", 0)
|
||||
meta:set_int("burn_time", 0)
|
||||
meta:set_string("infotext", "Nuclear Reactor Core (idle)")
|
||||
meta:set_string("infotext", S("%s Idle"):format(machine_name))
|
||||
hacky_swap_node(pos, "technic:hv_nuclear_reactor_core")
|
||||
elseif burn_time > 0 then
|
||||
damage_nearby_players(pos)
|
||||
@ -248,7 +249,7 @@ minetest.register_abm({
|
||||
burn_time = burn_time + 1
|
||||
meta:set_int("burn_time", burn_time)
|
||||
local percent = math.floor(burn_time / burn_ticks * 100)
|
||||
meta:set_string("infotext", "Nuclear Reactor Core ("..percent.."%)")
|
||||
meta:set_string("infotext", machine_name.." ("..percent.."%)")
|
||||
meta:set_int("HV_EU_supply", power_supply)
|
||||
end
|
||||
end
|
||||
|
@ -1,4 +1,6 @@
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
minetest.register_craft({
|
||||
recipe = {
|
||||
{"default:steelblock", "pipeworks:filter", "default:steelblock"},
|
||||
@ -13,7 +15,7 @@ local quarry_max_depth = 100
|
||||
local function get_quarry_formspec(size)
|
||||
return "size[3,1.5]"..
|
||||
"field[1,0.5;2,1;size;Radius;"..size.."]"..
|
||||
"button[0,1;3,1;toggle;Enable/Disable]"
|
||||
"button[0,1;3,1;toggle;"..S("Enable/Disable").."]"
|
||||
end
|
||||
|
||||
local function quarry_receive_fields(pos, formname, fields, sender)
|
||||
@ -134,7 +136,7 @@ local function send_items(items, pos, node)
|
||||
end
|
||||
|
||||
minetest.register_node("technic:quarry", {
|
||||
description = "Quarry",
|
||||
description = S("Quarry"),
|
||||
tiles = {"default_steel_block.png", "default_steel_block.png",
|
||||
"default_steel_block.png", "default_steel_block.png",
|
||||
"default_steel_block.png^default_tool_mesepick.png", "default_steel_block.png"},
|
||||
@ -146,7 +148,7 @@ minetest.register_node("technic:quarry", {
|
||||
on_construct = function(pos)
|
||||
local size = 4
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", "Quarry")
|
||||
meta:set_string("infotext", S("Quarry"))
|
||||
meta:set_string("formspec", get_quarry_formspec(4))
|
||||
meta:set_int("size", size)
|
||||
meta:set_int("dig_y", pos.y)
|
||||
@ -171,25 +173,26 @@ minetest.register_abm({
|
||||
local demand = 10000
|
||||
local center = get_quarry_center(pos, size)
|
||||
local dig_y = meta:get_int("dig_y")
|
||||
local machine_name = S("Quarry")
|
||||
|
||||
technic.switching_station_timeout_count(pos, "HV")
|
||||
|
||||
if meta:get_int("enabled") == 0 then
|
||||
meta:set_string("infotext", "Quarry Disabled")
|
||||
meta:set_string("infotext", S("%s Disabled"):format(machine_name))
|
||||
meta:set_int("HV_EU_demand", 0)
|
||||
return
|
||||
end
|
||||
|
||||
if eu_input < demand then
|
||||
meta:set_string("infotext", "Quarry Unpowered")
|
||||
meta:set_string("infotext", S("%s Unpowered"):format(machine_name))
|
||||
elseif eu_input >= demand then
|
||||
meta:set_string("infotext", "Quarry Active")
|
||||
meta:set_string("infotext", S("%s Active"):format(machine_name))
|
||||
|
||||
local items = quarry_dig(pos, center, size)
|
||||
send_items(items, pos, node)
|
||||
|
||||
if dig_y < pos.y - quarry_max_depth then
|
||||
meta:set_string("infotext", "Quarry Finished")
|
||||
meta:set_string("infotext", S("%s Finished"):format(machine_name))
|
||||
end
|
||||
end
|
||||
meta:set_int("HV_EU_demand", demand)
|
||||
|
@ -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
|
||||
|
@ -1,7 +1,10 @@
|
||||
-- LV Tool workshop
|
||||
-- Tool workshop
|
||||
-- This machine repairs tools.
|
||||
|
||||
minetest.register_alias("tool_workshop", "technic:tool_workshop")
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:tool_workshop',
|
||||
recipe = {
|
||||
@ -14,19 +17,18 @@ minetest.register_craft({
|
||||
local workshop_formspec =
|
||||
"invsize[8,9;]"..
|
||||
"list[current_name;src;3,1;1,1;]"..
|
||||
"label[0,0;Tool Workshop]"..
|
||||
"label[0,0;"..S("Tool Workshop").."]"..
|
||||
"list[current_player;main;0,5;8,4;]"
|
||||
|
||||
minetest.register_node("technic:tool_workshop", {
|
||||
description = "Tool Workshop",
|
||||
description = S("Tool Workshop"),
|
||||
tiles = {"technic_workshop_top.png", "technic_machine_bottom.png", "technic_workshop_side.png",
|
||||
"technic_workshop_side.png", "technic_workshop_side.png", "technic_workshop_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", "Tool Workshop")
|
||||
meta:set_float("technic_power_machine", 1)
|
||||
meta:set_string("infotext", S("Tool Workshop"))
|
||||
meta:set_string("formspec", workshop_formspec)
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("src", 1)
|
||||
@ -36,7 +38,7 @@ minetest.register_node("technic:tool_workshop", {
|
||||
local inv = meta:get_inventory()
|
||||
if not inv:is_empty("src") 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
|
||||
end
|
||||
return true
|
||||
@ -51,7 +53,7 @@ minetest.register_abm({
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local eu_input = meta:get_int("MV_EU_input")
|
||||
local machine_name = "Tool Workshop"
|
||||
local machine_name = S("Tool Workshop")
|
||||
local machine_node = "technic:tool_workshop"
|
||||
local demand = 5000
|
||||
|
||||
@ -70,15 +72,15 @@ minetest.register_abm({
|
||||
srcstack:get_wear() == 0 or
|
||||
srcstack:get_name() == "technic:water_can" or
|
||||
srcstack:get_name() == "technic:lava_can" then
|
||||
meta:set_string("infotext", machine_name.." Idle")
|
||||
meta:set_string("infotext", S("%s Idle"):format(machine_name))
|
||||
meta:set_int("MV_EU_demand", 0)
|
||||
return
|
||||
end
|
||||
|
||||
if eu_input < demand then
|
||||
meta:set_string("infotext", machine_name.." Unpowered")
|
||||
meta:set_string("infotext", S("%s Unpowered"):format(machine_name))
|
||||
elseif eu_input >= demand then
|
||||
meta:set_string("infotext", machine_name.." Active")
|
||||
meta:set_string("infotext", S("%s Active"):format(machine_name))
|
||||
srcstack:add_wear(-1000)
|
||||
inv:set_stack("src", 1, srcstack)
|
||||
end
|
||||
|
@ -1,4 +1,6 @@
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:wind_mill_frame 5',
|
||||
recipe = {
|
||||
@ -18,7 +20,7 @@ minetest.register_craft({
|
||||
})
|
||||
|
||||
minetest.register_node("technic:wind_mill_frame", {
|
||||
description = "Wind Mill Frame",
|
||||
description = S("Wind Mill Frame"),
|
||||
drawtype = "glasslike_framed",
|
||||
tiles = {"default_steel_block.png", "default_glass.png"},
|
||||
sunlight_propagates = true,
|
||||
@ -28,7 +30,7 @@ minetest.register_node("technic:wind_mill_frame", {
|
||||
})
|
||||
|
||||
minetest.register_node("technic:wind_mill", {
|
||||
description = "Wind Mill",
|
||||
description = S("Wind Mill"),
|
||||
tiles = {"default_steel_block.png"},
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=1},
|
||||
@ -46,7 +48,7 @@ minetest.register_node("technic:wind_mill", {
|
||||
},
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", "Wind Mill")
|
||||
meta:set_string("infotext", S("Wind Mill"))
|
||||
meta:set_int("MV_EU_supply", 0)
|
||||
end,
|
||||
})
|
||||
@ -70,17 +72,18 @@ minetest.register_abm({
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local machine_name = S("Wind Mill")
|
||||
local power = math.min(pos.y * 100, 5000)
|
||||
|
||||
if not check_wind_mill(pos) then
|
||||
meta:set_int("MV_EU_supply", 0)
|
||||
meta:set_string("infotext", "Wind Mill Inproperly Placed")
|
||||
meta:set_string("infotext", S("%s Improperly Placed"):format(machine_name))
|
||||
return
|
||||
else
|
||||
meta:set_int("MV_EU_supply", power)
|
||||
end
|
||||
|
||||
meta:set_string("infotext", "Wind Mill ("..power.."EU)")
|
||||
meta:set_string("infotext", machine_name.." ("..power.."EU)")
|
||||
end
|
||||
})
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
-- Register alloy recipes
|
||||
technic.alloy_recipes = {}
|
||||
|
||||
@ -79,7 +82,7 @@ function technic.register_alloy_furnace(data)
|
||||
|
||||
local formspec =
|
||||
"invsize[8,10;]"..
|
||||
"label[0,0;"..tier.." Alloy Furnace]"..
|
||||
"label[0,0;"..S("%s Alloy Furnace"):format(tier).."]"..
|
||||
"list[current_name;src;3,1;1,2;]"..
|
||||
"list[current_name;dst;5,1;2,2;]"..
|
||||
"list[current_player;main;0,6;8,4;]"
|
||||
@ -107,7 +110,7 @@ function technic.register_alloy_furnace(data)
|
||||
}
|
||||
|
||||
minetest.register_node("technic:"..ltier.."_alloy_furnace", {
|
||||
description = tier.." Alloy Furnace",
|
||||
description = S("%s Alloy Furnace"):format(tier),
|
||||
tiles = {"technic_"..ltier.."_alloy_furnace_top.png",
|
||||
"technic_"..ltier.."_alloy_furnace_bottom.png",
|
||||
tube_side_texture,
|
||||
@ -126,7 +129,7 @@ function technic.register_alloy_furnace(data)
|
||||
local data = minetest.registered_nodes[name].technic
|
||||
|
||||
|
||||
meta:set_string("infotext", data.tier.." Alloy furnace")
|
||||
meta:set_string("infotext", S("%s Alloy Furnace"):format(data.tier))
|
||||
meta:set_string("formspec", data.formspec)
|
||||
meta:set_int("tube_time", 0)
|
||||
local inv = meta:get_inventory()
|
||||
@ -141,7 +144,7 @@ function technic.register_alloy_furnace(data)
|
||||
if not inv:is_empty("src") or not inv:is_empty("dst") or
|
||||
not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") 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
|
||||
@ -150,7 +153,7 @@ function technic.register_alloy_furnace(data)
|
||||
})
|
||||
|
||||
minetest.register_node("technic:"..ltier.."_alloy_furnace_active",{
|
||||
description = tier.." Alloy Furnace",
|
||||
description = S(tier.." Alloy Furnace"),
|
||||
tiles = {"technic_"..ltier.."_alloy_furnace_top.png",
|
||||
"technic_"..ltier.."_alloy_furnace_bottom.png",
|
||||
tube_side_texture,
|
||||
@ -171,7 +174,7 @@ function technic.register_alloy_furnace(data)
|
||||
if not inv:is_empty("src") or not inv:is_empty("dst") or
|
||||
not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") 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
|
||||
@ -208,7 +211,7 @@ function technic.register_alloy_furnace(data)
|
||||
local eu_input = meta:get_int(data.tier.."_EU_input")
|
||||
|
||||
-- Machine information
|
||||
local machine_name = data.tier.." Alloy Furnace"
|
||||
local machine_name = S("%s Alloy Furnace"):format(data.tier)
|
||||
local machine_node = "technic:"..string.lower(data.tier).."_alloy_furnace"
|
||||
local machine_demand = data.demand
|
||||
|
||||
@ -243,7 +246,7 @@ function technic.register_alloy_furnace(data)
|
||||
if 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(data.tier.."_EU_demand", 0)
|
||||
return
|
||||
end
|
||||
@ -251,11 +254,11 @@ function technic.register_alloy_furnace(data)
|
||||
if eu_input < machine_demand[EU_upgrade+1] 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 >= machine_demand[EU_upgrade+1] 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") == data.cook_time then
|
||||
meta:set_int("src_time", 0)
|
||||
|
@ -1,27 +1,29 @@
|
||||
|
||||
technic.battery_box_formspec =
|
||||
local S = technic.getter
|
||||
|
||||
function technic.register_battery_box(data)
|
||||
local tier = data.tier
|
||||
local ltier = string.lower(tier)
|
||||
|
||||
data.formspec =
|
||||
"invsize[8,9;]"..
|
||||
"image[1,1;1,2;technic_power_meter_bg.png]"..
|
||||
"list[current_name;src;3,1;1,1;]"..
|
||||
"image[4,1;1,1;technic_battery_reload.png]"..
|
||||
"list[current_name;dst;5,1;1,1;]"..
|
||||
"label[0,0;Battery Box]"..
|
||||
"label[3,0;Charge]"..
|
||||
"label[5,0;Discharge]"..
|
||||
"label[1,3;Power level]"..
|
||||
"label[0,0;"..S("%s Battery Box"):format(tier).."]"..
|
||||
"label[3,0;"..S("Charge").."]"..
|
||||
"label[5,0;"..S("Discharge").."]"..
|
||||
"label[1,3;"..S("Power level").."]"..
|
||||
"list[current_player;main;0,5;8,4;]"
|
||||
|
||||
function technic.register_battery_box(data)
|
||||
local tier = data.tier
|
||||
local ltier = string.lower(tier)
|
||||
|
||||
for i = 0, 8 do
|
||||
local groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2}
|
||||
if i ~= 0 then
|
||||
groups.not_in_creative_inventory = 1
|
||||
end
|
||||
minetest.register_node("technic:"..ltier.."_battery_box"..i, {
|
||||
description = tier.." Battery Box",
|
||||
description = S("%s Battery Box"):format(tier),
|
||||
tiles = {"technic_"..ltier.."_battery_box_top.png",
|
||||
"technic_"..ltier.."_battery_box_bottom.png",
|
||||
"technic_"..ltier.."_battery_box_side.png^technic_power_meter"..i..".png",
|
||||
@ -38,8 +40,8 @@ function technic.register_battery_box(data)
|
||||
local node = minetest.get_node(pos)
|
||||
local data = minetest.registered_nodes[node.name].technic
|
||||
|
||||
meta:set_string("infotext", data.tier.." Battery Box")
|
||||
meta:set_string("formspec", battery_box_formspec)
|
||||
meta:set_string("infotext", S("%s Battery Box"):format(data.tier))
|
||||
meta:set_string("formspec", data.formspec)
|
||||
meta:set_int(data.tier.."_EU_demand", 0)
|
||||
meta:set_int(data.tier.."_EU_supply", 0)
|
||||
meta:set_int(data.tier.."_EU_input", 0)
|
||||
@ -47,12 +49,12 @@ function technic.register_battery_box(data)
|
||||
inv:set_size("src", 1)
|
||||
inv:set_size("dst", 1)
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
can_dig = function(pos, player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
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
|
||||
@ -115,14 +117,14 @@ function technic.register_battery_box(data)
|
||||
|
||||
local charge_percent = math.floor(current_charge / max_charge * 100)
|
||||
meta:set_string("formspec",
|
||||
technic.battery_box_formspec..
|
||||
"image[1,1;1,2;technic_power_meter_bg.png^[lowpart:"
|
||||
..charge_percent..":technic_power_meter_fg.png]")
|
||||
data.formspec..
|
||||
"image[1,1;1,2;technic_power_meter_bg.png"
|
||||
.."^[lowpart:"..charge_percent
|
||||
..":technic_power_meter_fg.png]")
|
||||
|
||||
local infotext = data.tier.." battery box: "
|
||||
..current_charge.."/"..max_charge
|
||||
local infotext = S("%s Battery Box: %d/%d"):format(data.tier, current_charge, max_charge)
|
||||
if eu_input == 0 then
|
||||
infotext = infotext.." (idle)"
|
||||
infotext = S("%s Idle"):format(infotext)
|
||||
end
|
||||
meta:set_string("infotext", infotext)
|
||||
end
|
||||
|
@ -1,7 +1,8 @@
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
technic.cables = {}
|
||||
|
||||
|
||||
function technic.register_cable(tier, size)
|
||||
local ltier = string.lower(tier)
|
||||
|
||||
@ -21,7 +22,7 @@ function technic.register_cable(tier, size)
|
||||
end
|
||||
|
||||
minetest.register_node("technic:"..ltier.."_cable"..id, {
|
||||
description = tier.." Cable",
|
||||
description = S("%s Cable"):format(tier),
|
||||
tiles = {"technic_"..ltier.."_cable.png"},
|
||||
inventory_image = "technic_"..ltier.."_cable_wield.png",
|
||||
wield_image = "technic_"..ltier.."_cable_wield.png",
|
||||
|
@ -1,4 +1,6 @@
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
function technic.register_electric_furnace(data)
|
||||
local tier = data.tier
|
||||
local ltier = string.lower(tier)
|
||||
@ -25,7 +27,7 @@ function technic.register_electric_furnace(data)
|
||||
"list[current_name;src;3,1;1,1;]"..
|
||||
"list[current_name;dst;5,1;2,2;]"..
|
||||
"list[current_player;main;0,6;8,4;]"..
|
||||
"label[0,0;"..tier.." Electric Furnace]"
|
||||
"label[0,0;"..S("%s Electric Furnace"):format(tier).."]"
|
||||
if data.upgrade then
|
||||
formspec = formspec..
|
||||
"list[current_name;upgrade1;1,4;1,1;]"..
|
||||
@ -36,7 +38,7 @@ function technic.register_electric_furnace(data)
|
||||
data.formspec = formspec
|
||||
|
||||
minetest.register_node("technic:"..ltier.."_electric_furnace", {
|
||||
description = tier.." Electric furnace",
|
||||
description = S("%s Electric furnace"):format(tier),
|
||||
tiles = {"technic_"..ltier.."_electric_furnace_top.png",
|
||||
"technic_"..ltier.."_electric_furnace_bottom.png",
|
||||
tube_side_texture,
|
||||
@ -53,7 +55,7 @@ function technic.register_electric_furnace(data)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local name = minetest.get_node(pos).name
|
||||
local data = minetest.registered_nodes[name].technic
|
||||
meta:set_string("infotext", data.tier.." Electric furnace")
|
||||
meta:set_string("infotext", S("%s Electric furnace"):format(data.tier))
|
||||
meta:set_int("tube_time", 0)
|
||||
meta:set_string("formspec", data.formspec)
|
||||
local inv = meta:get_inventory()
|
||||
@ -62,13 +64,13 @@ function technic.register_electric_furnace(data)
|
||||
inv:set_size("upgrade1", 1)
|
||||
inv:set_size("upgrade2", 1)
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
can_dig = function(pos, player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
if not inv:is_empty("src") or not inv:is_empty("dst") or
|
||||
not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") 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
|
||||
@ -95,7 +97,7 @@ function technic.register_electric_furnace(data)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local name = minetest.get_node(pos).name
|
||||
local data = minetest.registered_nodes[name].technic
|
||||
meta:set_string("infotext", data.tier.." Electric furnace")
|
||||
meta:set_string("infotext", S("%s Electric furnace", data.tier))
|
||||
meta:set_int("tube_time", 0)
|
||||
meta:set_string("formspec", data.formspec)
|
||||
local inv = meta:get_inventory()
|
||||
@ -104,13 +106,13 @@ function technic.register_electric_furnace(data)
|
||||
inv:set_size("upgrade1", 1)
|
||||
inv:set_size("upgrade2", 1)
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
can_dig = function(pos, player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
if not inv:is_empty("src") or not inv:is_empty("dst") or
|
||||
not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") 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
|
||||
@ -148,7 +150,7 @@ function technic.register_electric_furnace(data)
|
||||
local eu_input = meta:get_int(data.tier.."_EU_input")
|
||||
|
||||
-- Machine information
|
||||
local machine_name = data.tier.." Electric Furnace"
|
||||
local machine_name = S("%s Electric Furnace"):format(data.tier)
|
||||
local machine_node = "technic:"..string.lower(data.tier).."_electric_furnace"
|
||||
local machine_demand = data.demand
|
||||
|
||||
@ -172,18 +174,18 @@ function technic.register_electric_furnace(data)
|
||||
not inv:room_for_item("dst", result.item) then
|
||||
meta:set_int(data.tier.."_EU_demand", 0)
|
||||
hacky_swap_node(pos, machine_node)
|
||||
meta:set_string("infotext", machine_name.." Idle")
|
||||
meta:set_string("infotext", S("%s Idle"):format(machine_name))
|
||||
return
|
||||
end
|
||||
|
||||
if eu_input < machine_demand[EU_upgrade+1] 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 >= machine_demand[EU_upgrade+1] 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))
|
||||
technic.smelt_item(meta, result, data.speed)
|
||||
|
||||
end
|
||||
|
@ -1,16 +1,18 @@
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
function technic.register_generator(data)
|
||||
local tier = data.tier
|
||||
local ltier = string.lower(tier)
|
||||
|
||||
local generator_formspec =
|
||||
"invsize[8,9;]"..
|
||||
"label[0,0;Generator]"..
|
||||
"label[0,0;"..S("%s Generator"):format(tier).."]"..
|
||||
"list[current_name;src;3,1;1,1;]"..
|
||||
"image[4,1;1,1;default_furnace_fire_bg.png]"..
|
||||
"list[current_player;main;0,5;8,4;]"
|
||||
|
||||
local desc = tier.." Generator"
|
||||
local desc = S("%s Generator"):format(tier)
|
||||
minetest.register_node("technic:"..ltier.."_generator", {
|
||||
description = desc,
|
||||
tiles = {"technic_"..ltier.."_generator_top.png", "technic_machine_bottom.png",
|
||||
@ -34,7 +36,7 @@ function technic.register_generator(data)
|
||||
local inv = meta:get_inventory()
|
||||
if not inv:is_empty("src") 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
|
||||
@ -57,7 +59,7 @@ function technic.register_generator(data)
|
||||
local inv = meta:get_inventory()
|
||||
if not inv:is_empty("src") 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 +87,7 @@ function technic.register_generator(data)
|
||||
local fuellist = inv:get_list("src")
|
||||
fuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
|
||||
if not fuel or fuel.time == 0 then
|
||||
meta:set_string("infotext", "Generator out of fuel")
|
||||
meta:set_string("infotext", S("%s Out Of Fuel"):format(desc))
|
||||
hacky_swap_node(pos, "technic:"..ltier.."_generator")
|
||||
return
|
||||
end
|
||||
@ -116,3 +118,4 @@ function technic.register_generator(data)
|
||||
technic.register_machine(data.tier, "technic:"..ltier.."_generator", technic.producer)
|
||||
technic.register_machine(data.tier, "technic:"..ltier.."_generator", technic.producer)
|
||||
end
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
function technic.register_grinder(data)
|
||||
local tier = data.tier
|
||||
local ltier = string.lower(tier)
|
||||
@ -31,7 +33,7 @@ function technic.register_grinder(data)
|
||||
data.formspec = formspec
|
||||
|
||||
minetest.register_node("technic:"..ltier.."_grinder", {
|
||||
description = tier.." Grinder",
|
||||
description = S("%s Grinder"):format(tier),
|
||||
tiles = {"technic_"..ltier.."_grinder_top.png", "technic_"..ltier.."_grinder_bottom.png",
|
||||
"technic_"..ltier.."_grinder_side.png", "technic_"..ltier.."_grinder_side.png",
|
||||
"technic_"..ltier.."_grinder_side.png", "technic_"..ltier.."_grinder_front.png"},
|
||||
@ -45,7 +47,7 @@ function technic.register_grinder(data)
|
||||
local node = minetest.get_node(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local data = minetest.registered_nodes[node.name].technic
|
||||
meta:set_string("infotext", data.tier.." Grinder")
|
||||
meta:set_string("infotext", S("%s Grinder"):format(data.tier))
|
||||
meta:set_int("tube_time", 0)
|
||||
meta:set_string("formspec", data.formspec)
|
||||
local inv = meta:get_inventory()
|
||||
@ -55,12 +57,12 @@ function technic.register_grinder(data)
|
||||
inv:set_size("upgrade2", 1)
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
if not inv:is_empty("src") or not inv:is_empty("dst") or
|
||||
not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") 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
|
||||
@ -69,7 +71,7 @@ function technic.register_grinder(data)
|
||||
})
|
||||
|
||||
minetest.register_node("technic:"..ltier.."_grinder_active",{
|
||||
description = tier.." Grinder",
|
||||
description = S("%s Grinder"):format(tier),
|
||||
tiles = {"technic_"..ltier.."_grinder_top.png", "technic_"..ltier.."_grinder_bottom.png",
|
||||
"technic_"..ltier.."_grinder_side.png", "technic_"..ltier.."_grinder_side.png",
|
||||
"technic_"..ltier.."_grinder_side.png", "technic_"..ltier.."_grinder_front_active.png"},
|
||||
@ -85,7 +87,7 @@ function technic.register_grinder(data)
|
||||
if not inv:is_empty("src") or not inv:is_empty("dst") or
|
||||
not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") 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
|
||||
@ -121,7 +123,7 @@ function technic.register_grinder(data)
|
||||
local inv = meta:get_inventory()
|
||||
local eu_input = meta:get_int(data.tier.."_EU_input")
|
||||
|
||||
local machine_name = data.tier.." Grinder"
|
||||
local machine_name = S("%s Grinder"):format(data.tier)
|
||||
local machine_node = "technic:"..string.lower(data.tier).."_grinder"
|
||||
local machine_demand = data.demand
|
||||
|
||||
@ -147,7 +149,7 @@ function technic.register_grinder(data)
|
||||
|
||||
if not 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(data.tier.."_EU_demand", 0)
|
||||
return
|
||||
end
|
||||
@ -155,11 +157,11 @@ function technic.register_grinder(data)
|
||||
if eu_input < machine_demand[EU_upgrade+1] 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 >= machine_demand[EU_upgrade+1] 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") >= result.time / data.speed then
|
||||
|
@ -1,4 +1,6 @@
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
technic.grinder_recipes = {}
|
||||
|
||||
function technic.register_grinder_recipe(data)
|
||||
@ -63,7 +65,7 @@ local function register_dust(name, ingot)
|
||||
local lname = string.lower(name)
|
||||
lname = string.gsub(lname, ' ', '_')
|
||||
minetest.register_craftitem("technic:"..lname.."_dust", {
|
||||
description = name.." Dust",
|
||||
description = S("%s Dust"):format(name),
|
||||
inventory_image = "technic_"..lname.."_dust.png",
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
})
|
||||
@ -77,24 +79,26 @@ local function register_dust(name, ingot)
|
||||
end
|
||||
|
||||
-- Sorted alphibeticaly
|
||||
register_dust("Akalin", "glooptest:akalin_ingot")
|
||||
register_dust("Alatro", "glooptest:alatro_ingot")
|
||||
register_dust("Arol", "glooptest:arol_ingot")
|
||||
register_dust("Brass", "technic:brass_ingot")
|
||||
register_dust("Bronze", "default:bronze_ingot")
|
||||
register_dust("Chromium", "technic:chromium_ingot")
|
||||
register_dust("Coal", nil)
|
||||
register_dust("Copper", "default:copper_ingot")
|
||||
register_dust("Gold", "default:gold_ingot")
|
||||
register_dust("Iron", "default:steel_ingot")
|
||||
register_dust("Mithril", "moreores:mithril_ingot")
|
||||
register_dust("Silver", "moreores:silver_ingot")
|
||||
register_dust("Stainless Steel", "technic:stainless_steel_ingot")
|
||||
register_dust("Talinite", "glooptest:talinite_ingot")
|
||||
register_dust("Tin", "moreores:tin_ingot")
|
||||
register_dust("Zinc", "technic:zinc_ingot")
|
||||
register_dust(S("Akalin"), "glooptest:akalin_ingot")
|
||||
register_dust(S("Alatro"), "glooptest:alatro_ingot")
|
||||
register_dust(S("Arol"), "glooptest:arol_ingot")
|
||||
register_dust(S("Brass"), "technic:brass_ingot")
|
||||
register_dust(S("Bronze"), "default:bronze_ingot")
|
||||
register_dust(S("Chromium"), "technic:chromium_ingot")
|
||||
register_dust(S("Coal"), nil)
|
||||
register_dust(S("Copper"), "default:copper_ingot")
|
||||
register_dust(S("Gold"), "default:gold_ingot")
|
||||
register_dust(S("Iron"), "default:steel_ingot")
|
||||
register_dust(S("Mithril"), "moreores:mithril_ingot")
|
||||
register_dust(S("Silver"), "moreores:silver_ingot")
|
||||
register_dust(S("Stainless Steel"), "technic:stainless_steel_ingot")
|
||||
register_dust(S("Talinite"), "glooptest:talinite_ingot")
|
||||
register_dust(S("Tin"), "moreores:tin_ingot")
|
||||
register_dust(S("Zinc"), "technic:zinc_ingot")
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "technic:coal_dust",
|
||||
burntime = 50,
|
||||
})
|
||||
|
||||
|
@ -1,14 +1,17 @@
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
function technic.register_solar_array(data)
|
||||
local tier = data.tier
|
||||
local ltier = string.lower(tier)
|
||||
|
||||
minetest.register_node("technic:solar_array_"..ltier, {
|
||||
tiles = {"technic_"..ltier.."_solar_array_top.png", "technic_"..ltier.."_solar_array_bottom.png",
|
||||
"technic_"..ltier.."_solar_array_side.png", "technic_"..ltier.."_solar_array_side.png",
|
||||
"technic_"..ltier.."_solar_array_side.png", "technic_"..ltier.."_solar_array_side.png"},
|
||||
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
description = tier.." Solar Array",
|
||||
description = S("%s Solar Array"):format(tier),
|
||||
active = false,
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
@ -39,6 +42,8 @@ function technic.register_solar_array(data)
|
||||
-- To take care of some of it solar panels do not work outside daylight hours or if
|
||||
-- built below -10m
|
||||
local pos1 = {}
|
||||
local data = minetest.registered_nodes[node.name].technic
|
||||
local machine_name = S("%s Solar Array"):format(data.tier)
|
||||
pos1.y = pos.y + 1
|
||||
pos1.x = pos.x
|
||||
pos1.z = pos.z
|
||||
@ -46,7 +51,6 @@ function technic.register_solar_array(data)
|
||||
local time_of_day = minetest.get_timeofday()
|
||||
local meta = minetest.get_meta(pos)
|
||||
light = light or 0
|
||||
local data = minetest.registered_nodes[node.name].technic
|
||||
|
||||
|
||||
-- turn on array only during day time and if sufficient light
|
||||
@ -55,10 +59,10 @@ function technic.register_solar_array(data)
|
||||
local charge_to_give = math.floor((light + pos.y) * data.power)
|
||||
charge_to_give = math.max(charge_to_give, 0)
|
||||
charge_to_give = math.min(charge_to_give, data.power * 50)
|
||||
meta:set_string("infotext", "Solar Array is active ("..charge_to_give.."EU)")
|
||||
meta:set_string("infotext", S("%s Active"):format(machine_name).." ("..charge_to_give.."EU)")
|
||||
meta:set_int(data.tier.."_EU_supply", charge_to_give)
|
||||
else
|
||||
meta:set_string("infotext", "Solar Array is inactive");
|
||||
meta:set_string("infotext", S("%s Idle"):format(machine_name))
|
||||
meta:set_int(data.tier.."_EU_supply", 0)
|
||||
end
|
||||
end,
|
||||
|
@ -7,8 +7,10 @@
|
||||
-- Once the receiver side is powered it will deliver power to the other side.
|
||||
-- Unused power is wasted just like any other producer!
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
minetest.register_node("technic:supply_converter", {
|
||||
description = "Supply Converter",
|
||||
description = S("Supply Converter"),
|
||||
tiles = {"technic_supply_converter_top.png", "technic_supply_converter_bottom.png",
|
||||
"technic_supply_converter_side.png", "technic_supply_converter_side.png",
|
||||
"technic_supply_converter_side.png", "technic_supply_converter_side.png"},
|
||||
@ -22,7 +24,7 @@ minetest.register_node("technic:supply_converter", {
|
||||
},
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
meta:set_string("infotext", "Supply Converter")
|
||||
meta:set_string("infotext", S("Supply Converter"))
|
||||
meta:set_float("active", false)
|
||||
end,
|
||||
})
|
||||
@ -44,7 +46,7 @@ minetest.register_abm({
|
||||
local demand = 10000
|
||||
local remain = 0.9
|
||||
-- Machine information
|
||||
local machine_name = "Supply Converter"
|
||||
local machine_name = S("Supply Converter")
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
||||
local pos_up = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||
@ -66,7 +68,7 @@ minetest.register_abm({
|
||||
.." ("..input.." "..from.." -> "
|
||||
..input * remain.." "..to..")")
|
||||
else
|
||||
meta:set_string("infotext", machine_name.." has bad cabling")
|
||||
meta:set_string("infotext", S("%s Has Bad Cabling"):format(machine_name))
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -27,11 +27,11 @@
|
||||
--
|
||||
-- The reason the LV|MV|HV type is prepended toe meta data is because some machine could require several supplies to work.
|
||||
-- This way the supplies are separated per network.
|
||||
technic.DBG = 1
|
||||
local dprint = technic.dprint
|
||||
|
||||
technic.networks = {}
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
minetest.register_craft({
|
||||
output = "technic:switching_station",
|
||||
recipe = {
|
||||
@ -42,7 +42,7 @@ minetest.register_craft({
|
||||
})
|
||||
|
||||
minetest.register_node("technic:switching_station",{
|
||||
description = "Switching Station",
|
||||
description = S("Switching Station"),
|
||||
tiles = {"technic_water_mill_top_active.png", "technic_water_mill_top_active.png",
|
||||
"technic_water_mill_top_active.png", "technic_water_mill_top_active.png",
|
||||
"technic_water_mill_top_active.png", "technic_water_mill_top_active.png"},
|
||||
@ -56,7 +56,7 @@ minetest.register_node("technic:switching_station",{
|
||||
},
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", "Switching Station")
|
||||
meta:set_string("infotext", S("Switching Station"))
|
||||
end,
|
||||
})
|
||||
|
||||
@ -179,6 +179,7 @@ minetest.register_abm({
|
||||
local PR_nodes
|
||||
local BA_nodes
|
||||
local RE_nodes
|
||||
local machine_name = S("Switching Station")
|
||||
|
||||
-- Which kind of network are we on:
|
||||
pos1 = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
@ -189,7 +190,7 @@ minetest.register_abm({
|
||||
PR_nodes, BA_nodes, RE_nodes = get_network(pos1, tier)
|
||||
else
|
||||
--dprint("Not connected to a network")
|
||||
meta:set_string("infotext", "Switching Station - no network")
|
||||
meta:set_string("infotext", S("%s Has No Network"):format(machine_name))
|
||||
return
|
||||
end
|
||||
--dprint("nodes="..table.getn(all_nodes)
|
||||
@ -235,8 +236,8 @@ minetest.register_abm({
|
||||
--dprint("Total BA demand:"..BA_eu_demand)
|
||||
|
||||
meta:set_string("infotext",
|
||||
"Switching Station. Supply: "..PR_eu_supply
|
||||
.." Demand: "..RE_eu_demand)
|
||||
S("%s. Supply: %d Demand: %d"):format(
|
||||
machine_name, PR_eu_supply, RE_eu_demand))
|
||||
|
||||
-- If the PR supply is enough for the RE demand supply them all
|
||||
if PR_eu_supply >= RE_eu_demand then
|
||||
|
@ -1,6 +1,8 @@
|
||||
local water_can_max_load = 16
|
||||
local lava_can_max_load = 8
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:water_can 1',
|
||||
recipe = {
|
||||
@ -21,7 +23,7 @@ minetest.register_craft({
|
||||
|
||||
|
||||
minetest.register_tool("technic:water_can", {
|
||||
description = "Water Can",
|
||||
description = S("Water Can"),
|
||||
inventory_image = "technic_water_can.png",
|
||||
stack_max = 1,
|
||||
liquids_pointable = true,
|
||||
@ -70,7 +72,7 @@ minetest.register_tool("technic:water_can", {
|
||||
})
|
||||
|
||||
minetest.register_tool("technic:lava_can", {
|
||||
description = "Lava Can",
|
||||
description = S("Lava Can"),
|
||||
inventory_image = "technic_lava_can.png",
|
||||
stack_max = 1,
|
||||
liquids_pointable = true,
|
||||
@ -117,3 +119,4 @@ minetest.register_tool("technic:lava_can", {
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -3,10 +3,12 @@ local chainsaw_max_charge = 30000 -- 30000 - Maximum charge of the saw
|
||||
local chainsaw_charge_per_node = 12 -- 12 - Gives 2500 nodes on a single charge (about 50 complete normal trees)
|
||||
local chainsaw_leaves = true -- true - Cut down entire trees, leaves and all
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
technic.register_power_tool("technic:chainsaw", chainsaw_max_charge)
|
||||
|
||||
minetest.register_tool("technic:chainsaw", {
|
||||
description = "Chainsaw",
|
||||
description = S("Chainsaw"),
|
||||
inventory_image = "technic_chainsaw.png",
|
||||
stack_max = 1,
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
|
@ -1,15 +1,18 @@
|
||||
-- original code comes from walkin_light mod by Echo http://minetest.net/forum/viewtopic.php?id=2621
|
||||
|
||||
local flashlight_max_charge = 30000
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
technic.register_power_tool("technic:flashlight", flashlight_max_charge)
|
||||
|
||||
minetest.register_tool("technic:flashlight", {
|
||||
description = "Flashlight",
|
||||
description = S("Flashlight"),
|
||||
inventory_image = "technic_flashlight.png",
|
||||
stack_max = 1,
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
end,
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "technic:flashlight",
|
||||
@ -163,3 +166,4 @@ function check_for_flashlight(player)
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
|
@ -5,6 +5,8 @@ local mining_drill_power_usage = 200
|
||||
local mining_drill_mk2_power_usage = 600
|
||||
local mining_drill_mk3_power_usage = 1800
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:mining_drill',
|
||||
recipe = {
|
||||
@ -220,7 +222,7 @@ end
|
||||
|
||||
technic.register_power_tool("technic:mining_drill", mining_drill_max_charge)
|
||||
minetest.register_tool("technic:mining_drill", {
|
||||
description = "Mining Drill Mk1",
|
||||
description = S("Mining Drill Mk1"),
|
||||
inventory_image = "technic_mining_drill.png",
|
||||
stack_max = 1,
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
@ -243,7 +245,7 @@ minetest.register_tool("technic:mining_drill", {
|
||||
})
|
||||
|
||||
minetest.register_tool("technic:mining_drill_mk2", {
|
||||
description = "Mining Drill Mk2",
|
||||
description = S("Mining Drill Mk2"),
|
||||
inventory_image = "technic_mining_drill_mk2.png",
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
mining_drill_mk2_handler(itemstack, user, pointed_thing)
|
||||
@ -256,7 +258,7 @@ technic.register_power_tool("technic:mining_drill_mk2", mining_drill_mk2_max_cha
|
||||
for i = 1, 4 do
|
||||
technic.register_power_tool("technic:mining_drill_mk2_"..i, mining_drill_mk2_max_charge)
|
||||
minetest.register_tool("technic:mining_drill_mk2_"..i, {
|
||||
description = "Mining Drill Mk2 in Mode "..i,
|
||||
description = S("Mining Drill Mk%d Mode %d"):format(2, i),
|
||||
inventory_image = "technic_mining_drill_mk2.png^technic_tool_mode"..i..".png",
|
||||
wield_image = "technic_mining_drill_mk2.png",
|
||||
groups = {not_in_creative_inventory=1},
|
||||
@ -268,7 +270,7 @@ for i = 1, 4 do
|
||||
end
|
||||
|
||||
minetest.register_tool("technic:mining_drill_mk3", {
|
||||
description = "Mining Drill Mk3",
|
||||
description = S("Mining Drill Mk3"),
|
||||
inventory_image = "technic_mining_drill_mk3.png",
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
mining_drill_mk3_handler(itemstack,user,pointed_thing)
|
||||
@ -281,7 +283,7 @@ technic.register_power_tool("technic:mining_drill_mk3", mining_drill_mk3_max_cha
|
||||
for i=1,5,1 do
|
||||
technic.register_power_tool("technic:mining_drill_mk3_"..i, mining_drill_mk3_max_charge)
|
||||
minetest.register_tool("technic:mining_drill_mk3_"..i, {
|
||||
description = "Mining Drill Mk3 in Mode "..i,
|
||||
description = S("Mining Drill Mk%d Mode %d"):format(3, i),
|
||||
inventory_image = "technic_mining_drill_mk3.png^technic_tool_mode"..i..".png",
|
||||
wield_image = "technic_mining_drill_mk3.png",
|
||||
groups = {not_in_creative_inventory=1},
|
||||
@ -335,11 +337,11 @@ function mining_drill_mk3_handler(itemstack, user, pointed_thing)
|
||||
end
|
||||
|
||||
mining_drill_mode_text = {
|
||||
{"Single node."},
|
||||
{"3 nodes deep."},
|
||||
{"3 modes wide."},
|
||||
{"3 modes tall."},
|
||||
{"3x3 nodes."},
|
||||
{S("Single node.")},
|
||||
{S("3 nodes deep.")},
|
||||
{S("3 nodes wide.")},
|
||||
{S("3 nodes tall.")},
|
||||
{S("3x3 nodes.")},
|
||||
}
|
||||
|
||||
function mining_drill_mk2_setmode(user,itemstack)
|
||||
@ -351,14 +353,14 @@ function mining_drill_mk2_setmode(user,itemstack)
|
||||
mode=0
|
||||
end
|
||||
if meta["mode"]==nil then
|
||||
minetest.chat_send_player(player_name,"Hold shift and use to change Mining Drill Mk2 modes.")
|
||||
minetest.chat_send_player(player_name, S("Hold shift and use to change Mining Drill Mk%d modes."):format(2))
|
||||
meta["mode"]=0
|
||||
mode=0
|
||||
end
|
||||
mode=(meta["mode"])
|
||||
mode=mode+1
|
||||
if mode>=5 then mode=1 end
|
||||
minetest.chat_send_player(player_name, "Mining Drill Mk2 mode : "..mode.." - "..mining_drill_mode_text[mode][1] )
|
||||
minetest.chat_send_player(player_name, S("Mining Drill Mk%d Mode %d"):format(2, mode)..": "..mining_drill_mode_text[mode][1])
|
||||
item["name"]="technic:mining_drill_mk2_"..mode
|
||||
meta["mode"]=mode
|
||||
item["metadata"]=set_item_meta(meta)
|
||||
@ -375,14 +377,14 @@ function mining_drill_mk3_setmode(user,itemstack)
|
||||
mode=0
|
||||
end
|
||||
if meta["mode"]==nil then
|
||||
minetest.chat_send_player(player_name,"Hold shift and use to change Mining Drill Mk3 modes.")
|
||||
minetest.chat_send_player(player_name, S("Hold shift and use to change Mining Drill Mk%d modes."):format(3))
|
||||
meta["mode"]=0
|
||||
mode=0
|
||||
end
|
||||
mode=(meta["mode"])
|
||||
mode=mode+1
|
||||
if mode>=6 then mode=1 end
|
||||
minetest.chat_send_player(player_name, "Mining Drill Mk3 mode : "..mode.." - "..mining_drill_mode_text[mode][1] )
|
||||
minetest.chat_send_player(player_name, S("Mining Drill Mk%d Mode %d"):format(3, mode)..": "..mining_drill_mode_text[mode][1])
|
||||
item["name"]="technic:mining_drill_mk3_"..mode
|
||||
meta["mode"]=mode
|
||||
item["metadata"]=set_item_meta(meta)
|
||||
|
@ -1,8 +1,11 @@
|
||||
local sonic_screwdriver_max_charge = 15000
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
technic.register_power_tool("technic:sonic_screwdriver", sonic_screwdriver_max_charge)
|
||||
|
||||
minetest.register_tool("technic:sonic_screwdriver", {
|
||||
description = "Sonic Screwdriver",
|
||||
description = S("Sonic Screwdriver"),
|
||||
inventory_image = "technic_sonic_screwdriver.png",
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
-- Must be pointing to facedir applicable node
|
||||
|
@ -1,5 +1,8 @@
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
minetest.register_tool("technic:treetap", {
|
||||
description = "Tree Tap",
|
||||
description = S("Tree Tap"),
|
||||
inventory_image = "technic_tree_tap.png",
|
||||
on_use = function(itemstack,user,pointed_thing)
|
||||
if pointed_thing.type ~= "node" then
|
||||
@ -41,7 +44,7 @@ minetest.register_craft({
|
||||
})
|
||||
|
||||
minetest.register_craftitem("technic:raw_latex", {
|
||||
description = "Raw Latex",
|
||||
description = S("Raw Latex"),
|
||||
inventory_image = "technic_raw_latex.png",
|
||||
})
|
||||
|
||||
@ -52,7 +55,7 @@ minetest.register_craft({
|
||||
})
|
||||
|
||||
minetest.register_craftitem("technic:rubber", {
|
||||
description = "Rubber Fiber",
|
||||
description = S("Rubber Fiber"),
|
||||
inventory_image = "technic_rubber.png",
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user