mirror of
https://github.com/minetest-mods/technic.git
synced 2024-12-22 13:52:31 +01:00
Add support for translations via intllib
This commit is contained in:
parent
d8e02eb2dd
commit
be2f30a1a2
@ -3,3 +3,4 @@ moreores
|
|||||||
pipeworks
|
pipeworks
|
||||||
mesecons
|
mesecons
|
||||||
mesecons_mvps?
|
mesecons_mvps?
|
||||||
|
intllib?
|
||||||
|
@ -8,6 +8,13 @@ local load_start = os.clock()
|
|||||||
local modpath = minetest.get_modpath("technic")
|
local modpath = minetest.get_modpath("technic")
|
||||||
technic.modpath = modpath
|
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
|
-- Read configuration file
|
||||||
dofile(modpath.."/config.lua")
|
dofile(modpath.."/config.lua")
|
||||||
@ -55,6 +62,6 @@ function hacky_swap_node(pos, name)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if minetest.setting_get("log_mod") then
|
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
|
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",
|
inventory_image = "technic_silicon_wafer.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem( "technic:doped_silicon_wafer", {
|
minetest.register_craftitem( "technic:doped_silicon_wafer", {
|
||||||
description = "Doped Silicon Wafer",
|
description = S("Doped Silicon Wafer"),
|
||||||
inventory_image = "technic_doped_silicon_wafer.png",
|
inventory_image = "technic_doped_silicon_wafer.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("technic:enriched_uranium", {
|
minetest.register_craftitem("technic:enriched_uranium", {
|
||||||
description = "Enriched Uranium",
|
description = S("Enriched Uranium"),
|
||||||
inventory_image = "technic_enriched_uranium.png",
|
inventory_image = "technic_enriched_uranium.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("technic:uranium_fuel", {
|
minetest.register_craftitem("technic:uranium_fuel", {
|
||||||
description = "Uranium Fuel",
|
description = S("Uranium Fuel"),
|
||||||
inventory_image = "technic_uranium_fuel.png",
|
inventory_image = "technic_uranium_fuel.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem( "technic:diamond_drill_head", {
|
minetest.register_craftitem( "technic:diamond_drill_head", {
|
||||||
description = "Diamond Drill Head",
|
description = S("Diamond Drill Head"),
|
||||||
inventory_image = "technic_diamond_drill_head.png",
|
inventory_image = "technic_diamond_drill_head.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_tool("technic:blue_energy_crystal", {
|
minetest.register_tool("technic:blue_energy_crystal", {
|
||||||
description = "Blue Energy Crystal",
|
description = S("Blue Energy Crystal"),
|
||||||
inventory_image = minetest.inventorycube(
|
inventory_image = minetest.inventorycube(
|
||||||
"technic_diamond_block_blue.png",
|
"technic_diamond_block_blue.png",
|
||||||
"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", {
|
minetest.register_tool("technic:green_energy_crystal", {
|
||||||
description = "Green Energy Crystal",
|
description = S("Green Energy Crystal"),
|
||||||
inventory_image = minetest.inventorycube(
|
inventory_image = minetest.inventorycube(
|
||||||
"technic_diamond_block_green.png",
|
"technic_diamond_block_green.png",
|
||||||
"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", {
|
minetest.register_tool("technic:red_energy_crystal", {
|
||||||
description = "Red Energy Crystal",
|
description = S("Red Energy Crystal"),
|
||||||
inventory_image = minetest.inventorycube(
|
inventory_image = minetest.inventorycube(
|
||||||
"technic_diamond_block_red.png",
|
"technic_diamond_block_red.png",
|
||||||
"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", {
|
minetest.register_craftitem("technic:fine_copper_wire", {
|
||||||
description = "Fine Copper Wire",
|
description = S("Fine Copper Wire"),
|
||||||
inventory_image = "technic_fine_copper_wire.png",
|
inventory_image = "technic_fine_copper_wire.png",
|
||||||
on_place_on_ground = minetest.craftitem_place_item,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem( "technic:copper_coil", {
|
minetest.register_craftitem("technic:copper_coil", {
|
||||||
description = "Copper Coil",
|
description = S("Copper Coil"),
|
||||||
inventory_image = "technic_copper_coil.png",
|
inventory_image = "technic_copper_coil.png",
|
||||||
on_place_on_ground = minetest.craftitem_place_item,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem( "technic:motor", {
|
minetest.register_craftitem("technic:motor", {
|
||||||
description = "Electric Motor",
|
description = S("Electric Motor"),
|
||||||
inventory_image = "technic_motor.png",
|
inventory_image = "technic_motor.png",
|
||||||
on_place_on_ground = minetest.craftitem_place_item,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem( "technic:lv_transformer", {
|
minetest.register_craftitem("technic:lv_transformer", {
|
||||||
description = "Low Voltage Transformer",
|
description = S("Low Voltage Transformer"),
|
||||||
inventory_image = "technic_lv_transformer.png",
|
inventory_image = "technic_lv_transformer.png",
|
||||||
on_place_on_ground = minetest.craftitem_place_item,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem( "technic:lv_transformer", {
|
minetest.register_craftitem("technic:lv_transformer", {
|
||||||
description = "Low Voltage Transformer",
|
description = S("Low Voltage Transformer"),
|
||||||
inventory_image = "technic_lv_transformer.png",
|
inventory_image = "technic_lv_transformer.png",
|
||||||
on_place_on_ground = minetest.craftitem_place_item,
|
|
||||||
})
|
})
|
||||||
minetest.register_craftitem( "technic:mv_transformer", {
|
minetest.register_craftitem("technic:mv_transformer", {
|
||||||
description = "Medium Voltage Transformer",
|
description = S("Medium Voltage Transformer"),
|
||||||
inventory_image = "technic_mv_transformer.png",
|
inventory_image = "technic_mv_transformer.png",
|
||||||
on_place_on_ground = minetest.craftitem_place_item,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem( "technic:hv_transformer", {
|
minetest.register_craftitem( "technic:hv_transformer", {
|
||||||
description = "High Voltage Transformer",
|
description = S("High Voltage Transformer"),
|
||||||
inventory_image = "technic_hv_transformer.png",
|
inventory_image = "technic_hv_transformer.png",
|
||||||
on_place_on_ground = minetest.craftitem_place_item,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem( "technic:control_logic_unit", {
|
minetest.register_craftitem( "technic:control_logic_unit", {
|
||||||
description = "Control Logic Unit",
|
description = S("Control Logic Unit"),
|
||||||
inventory_image = "technic_control_logic_unit.png",
|
inventory_image = "technic_control_logic_unit.png",
|
||||||
on_place_on_ground = minetest.craftitem_place_item,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("technic:mixed_metal_ingot", {
|
minetest.register_craftitem("technic:mixed_metal_ingot", {
|
||||||
description = "Mixed Metal Ingot",
|
description = S("Mixed Metal Ingot"),
|
||||||
inventory_image = "technic_mixed_metal_ingot.png",
|
inventory_image = "technic_mixed_metal_ingot.png",
|
||||||
on_place_on_ground = minetest.craftitem_place_item,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("technic:composite_plate", {
|
minetest.register_craftitem("technic:composite_plate", {
|
||||||
description = "Composite Plate",
|
description = S("Composite Plate"),
|
||||||
inventory_image = "technic_composite_plate.png",
|
inventory_image = "technic_composite_plate.png",
|
||||||
on_place_on_ground = minetest.craftitem_place_item,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("technic:copper_plate", {
|
minetest.register_craftitem("technic:copper_plate", {
|
||||||
description = "Copper Plate",
|
description = S("Copper Plate"),
|
||||||
inventory_image = "technic_copper_plate.png",
|
inventory_image = "technic_copper_plate.png",
|
||||||
on_place_on_ground = minetest.craftitem_place_item,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("technic:carbon_plate", {
|
minetest.register_craftitem("technic:carbon_plate", {
|
||||||
description = "Carbon Plate",
|
description = S("Carbon Plate"),
|
||||||
inventory_image = "technic_carbon_plate.png",
|
inventory_image = "technic_carbon_plate.png",
|
||||||
on_place_on_ground = minetest.craftitem_place_item,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("technic:graphite", {
|
minetest.register_craftitem("technic:graphite", {
|
||||||
description = "Graphite",
|
description = S("Graphite"),
|
||||||
inventory_image = "technic_graphite.png",
|
inventory_image = "technic_graphite.png",
|
||||||
on_place_on_ground = minetest.craftitem_place_item,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("technic:carbon_cloth", {
|
minetest.register_craftitem("technic:carbon_cloth", {
|
||||||
description = "Carbon Cloth",
|
description = S("Carbon Cloth"),
|
||||||
inventory_image = "technic_carbon_cloth.png",
|
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_power_drain = 10
|
||||||
local forcefield_step_interval = 1
|
local forcefield_step_interval = 1
|
||||||
|
|
||||||
|
local S = technic.getter
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'technic:forcefield_emitter_off',
|
output = 'technic:forcefield_emitter_off',
|
||||||
recipe = {
|
recipe = {
|
||||||
@ -62,8 +64,8 @@ end
|
|||||||
|
|
||||||
local get_forcefield_formspec = function(range)
|
local get_forcefield_formspec = function(range)
|
||||||
return "size[3,1.5]"..
|
return "size[3,1.5]"..
|
||||||
"field[1,0.5;2,1;range;Range;"..range.."]"..
|
"field[1,0.5;2,1;range;"..S("Range")..";"..range.."]"..
|
||||||
"button[0,1;3,1;toggle;Enable/Disable]"
|
"button[0,1;3,1;toggle;"..S("Enable/Disable").."]"
|
||||||
end
|
end
|
||||||
|
|
||||||
local forcefield_receive_fields = function(pos, formname, fields, sender)
|
local forcefield_receive_fields = function(pos, formname, fields, sender)
|
||||||
@ -103,7 +105,7 @@ local mesecons = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
minetest.register_node("technic:forcefield_emitter_off", {
|
minetest.register_node("technic:forcefield_emitter_off", {
|
||||||
description = "Forcefield emitter",
|
description = S("Forcefield Emitter"),
|
||||||
tiles = {"technic_forcefield_emitter_off.png"},
|
tiles = {"technic_forcefield_emitter_off.png"},
|
||||||
groups = {cracky = 1},
|
groups = {cracky = 1},
|
||||||
on_receive_fields = forcefield_receive_fields,
|
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("range", 10)
|
||||||
meta:set_int("enabled", 0)
|
meta:set_int("enabled", 0)
|
||||||
meta:set_string("formspec", get_forcefield_formspec(10))
|
meta:set_string("formspec", get_forcefield_formspec(10))
|
||||||
meta:set_string("infotext", "Forcefield emitter");
|
meta:set_string("infotext", S("Forcefield Emitter"))
|
||||||
end,
|
end,
|
||||||
mesecons = mesecons
|
mesecons = mesecons
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("technic:forcefield_emitter_on", {
|
minetest.register_node("technic:forcefield_emitter_on", {
|
||||||
description = "Forcefield emitter on (you hacker you)",
|
description = S("Forcefield Emitter"),
|
||||||
tiles = {"technic_forcefield_emitter_on.png"},
|
tiles = {"technic_forcefield_emitter_on.png"},
|
||||||
groups = {cracky = 1, not_in_creative_inventory=1},
|
groups = {cracky = 1, not_in_creative_inventory=1},
|
||||||
drop = "technic:forcefield_emitter_off",
|
drop = "technic:forcefield_emitter_off",
|
||||||
@ -138,7 +140,7 @@ minetest.register_node("technic:forcefield_emitter_on", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("technic:forcefield", {
|
minetest.register_node("technic:forcefield", {
|
||||||
description = "Forcefield (you hacker you)",
|
description = S("Forcefield"),
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
drawtype = "glasslike",
|
drawtype = "glasslike",
|
||||||
groups = {not_in_creative_inventory=1, unbreakable=1},
|
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_input = meta:get_int("HV_EU_input")
|
||||||
local eu_demand = meta:get_int("HV_EU_demand")
|
local eu_demand = meta:get_int("HV_EU_demand")
|
||||||
local enabled = meta:get_int("enabled")
|
local enabled = meta:get_int("enabled")
|
||||||
|
local machine_name = S("Forcefield Emitter")
|
||||||
-- Power off automatically if no longer connected to a switching station
|
-- Power off automatically if no longer connected to a switching station
|
||||||
technic.switching_station_timeout_count(pos, "HV")
|
technic.switching_station_timeout_count(pos, "HV")
|
||||||
|
|
||||||
@ -176,11 +179,11 @@ minetest.register_abm({
|
|||||||
meta:set_int("HV_EU_demand", 0)
|
meta:set_int("HV_EU_demand", 0)
|
||||||
update_forcefield(pos, meta:get_int("range"), false)
|
update_forcefield(pos, meta:get_int("range"), false)
|
||||||
hacky_swap_node(pos, "technic:forcefield_emitter_off")
|
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
|
return
|
||||||
end
|
end
|
||||||
elseif eu_input < power_requirement then
|
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
|
if node.name == "technic:forcefield_emitter_on" then
|
||||||
update_forcefield(pos, meta:get_int("range"), false)
|
update_forcefield(pos, meta:get_int("range"), false)
|
||||||
hacky_swap_node(pos, "technic:forcefield_emitter_off")
|
hacky_swap_node(pos, "technic:forcefield_emitter_off")
|
||||||
@ -188,7 +191,7 @@ minetest.register_abm({
|
|||||||
elseif eu_input >= power_requirement then
|
elseif eu_input >= power_requirement then
|
||||||
if node.name == "technic:forcefield_emitter_off" then
|
if node.name == "technic:forcefield_emitter_off" then
|
||||||
hacky_swap_node(pos, "technic:forcefield_emitter_on")
|
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
|
end
|
||||||
update_forcefield(pos, meta:get_int("range"), true)
|
update_forcefield(pos, meta:get_int("range"), true)
|
||||||
end
|
end
|
||||||
|
@ -10,6 +10,7 @@ local burn_ticks = 7 * 24 * 60 * 60 -- (seconds).
|
|||||||
local power_supply = 100000 -- EUs
|
local power_supply = 100000 -- EUs
|
||||||
local fuel_type = "technic:uranium_fuel" -- The reactor burns this stuff
|
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?
|
-- FIXME: recipe must make more sense like a rod recepticle, steam chamber, HV generator?
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
@ -23,7 +24,7 @@ minetest.register_craft({
|
|||||||
|
|
||||||
local generator_formspec =
|
local generator_formspec =
|
||||||
"invsize[8,9;]"..
|
"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_name;src;2,1;3,2;]"..
|
||||||
"list[current_player;main;0,5;8,4;]"
|
"list[current_player;main;0,5;8,4;]"
|
||||||
|
|
||||||
@ -48,7 +49,7 @@ local nodebox = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
minetest.register_node("technic:hv_nuclear_reactor_core", {
|
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",
|
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",
|
||||||
"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)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(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)
|
meta:set_int("HV_EU_supply", 0)
|
||||||
-- Signal to the switching station that this device burns some
|
-- Signal to the switching station that this device burns some
|
||||||
-- sort of fuel and needs special handling
|
-- sort of fuel and needs special handling
|
||||||
@ -74,12 +75,12 @@ minetest.register_node("technic:hv_nuclear_reactor_core", {
|
|||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size("src", 6)
|
inv:set_size("src", 6)
|
||||||
end,
|
end,
|
||||||
can_dig = function(pos,player)
|
can_dig = function(pos, player)
|
||||||
local meta = minetest.get_meta(pos);
|
local meta = minetest.get_meta(pos);
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
if not inv:is_empty("src") then
|
if not inv:is_empty("src") then
|
||||||
minetest.chat_send_player(player:get_player_name(),
|
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
|
return false
|
||||||
else
|
else
|
||||||
return true
|
return true
|
||||||
@ -88,7 +89,6 @@ minetest.register_node("technic:hv_nuclear_reactor_core", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("technic:hv_nuclear_reactor_core_active", {
|
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",
|
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",
|
||||||
"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",
|
type = "fixed",
|
||||||
fixed = nodebox
|
fixed = nodebox
|
||||||
},
|
},
|
||||||
can_dig = function(pos,player)
|
can_dig = function(pos, player)
|
||||||
local meta = minetest.get_meta(pos);
|
local meta = minetest.get_meta(pos);
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
if not inv:is_empty("src") then
|
if not inv:is_empty("src") then
|
||||||
minetest.chat_send_player(player:get_player_name(),
|
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
|
return false
|
||||||
else
|
else
|
||||||
return true
|
return true
|
||||||
@ -208,6 +208,7 @@ minetest.register_abm({
|
|||||||
chance = 1,
|
chance = 1,
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
local machine_name = S("Nuclear Reactor Core")
|
||||||
local burn_time = meta:get_int("burn_time") or 0
|
local burn_time = meta:get_int("burn_time") or 0
|
||||||
|
|
||||||
if burn_time >= burn_ticks or burn_time == 0 then
|
if burn_time >= burn_ticks or burn_time == 0 then
|
||||||
@ -238,7 +239,7 @@ minetest.register_abm({
|
|||||||
end
|
end
|
||||||
meta:set_int("HV_EU_supply", 0)
|
meta:set_int("HV_EU_supply", 0)
|
||||||
meta:set_int("burn_time", 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")
|
hacky_swap_node(pos, "technic:hv_nuclear_reactor_core")
|
||||||
elseif burn_time > 0 then
|
elseif burn_time > 0 then
|
||||||
damage_nearby_players(pos)
|
damage_nearby_players(pos)
|
||||||
@ -248,7 +249,7 @@ minetest.register_abm({
|
|||||||
burn_time = burn_time + 1
|
burn_time = burn_time + 1
|
||||||
meta:set_int("burn_time", burn_time)
|
meta:set_int("burn_time", burn_time)
|
||||||
local percent = math.floor(burn_time / burn_ticks * 100)
|
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)
|
meta:set_int("HV_EU_supply", power_supply)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
|
local S = technic.getter
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
recipe = {
|
recipe = {
|
||||||
{"default:steelblock", "pipeworks:filter", "default:steelblock"},
|
{"default:steelblock", "pipeworks:filter", "default:steelblock"},
|
||||||
@ -13,7 +15,7 @@ local quarry_max_depth = 100
|
|||||||
local function get_quarry_formspec(size)
|
local function get_quarry_formspec(size)
|
||||||
return "size[3,1.5]"..
|
return "size[3,1.5]"..
|
||||||
"field[1,0.5;2,1;size;Radius;"..size.."]"..
|
"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
|
end
|
||||||
|
|
||||||
local function quarry_receive_fields(pos, formname, fields, sender)
|
local function quarry_receive_fields(pos, formname, fields, sender)
|
||||||
@ -134,7 +136,7 @@ local function send_items(items, pos, node)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("technic:quarry", {
|
minetest.register_node("technic:quarry", {
|
||||||
description = "Quarry",
|
description = S("Quarry"),
|
||||||
tiles = {"default_steel_block.png", "default_steel_block.png",
|
tiles = {"default_steel_block.png", "default_steel_block.png",
|
||||||
"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"},
|
"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)
|
on_construct = function(pos)
|
||||||
local size = 4
|
local size = 4
|
||||||
local meta = minetest.get_meta(pos)
|
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_string("formspec", get_quarry_formspec(4))
|
||||||
meta:set_int("size", size)
|
meta:set_int("size", size)
|
||||||
meta:set_int("dig_y", pos.y)
|
meta:set_int("dig_y", pos.y)
|
||||||
@ -171,25 +173,26 @@ minetest.register_abm({
|
|||||||
local demand = 10000
|
local demand = 10000
|
||||||
local center = get_quarry_center(pos, size)
|
local center = get_quarry_center(pos, size)
|
||||||
local dig_y = meta:get_int("dig_y")
|
local dig_y = meta:get_int("dig_y")
|
||||||
|
local machine_name = S("Quarry")
|
||||||
|
|
||||||
technic.switching_station_timeout_count(pos, "HV")
|
technic.switching_station_timeout_count(pos, "HV")
|
||||||
|
|
||||||
if meta:get_int("enabled") == 0 then
|
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)
|
meta:set_int("HV_EU_demand", 0)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if eu_input < demand then
|
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
|
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)
|
local items = quarry_dig(pos, center, size)
|
||||||
send_items(items, pos, node)
|
send_items(items, pos, node)
|
||||||
|
|
||||||
if dig_y < pos.y - quarry_max_depth then
|
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
|
||||||
end
|
end
|
||||||
meta:set_int("HV_EU_demand", demand)
|
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
|
-- 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.
|
-- box definitions and easily stuff it in the this machine for production.
|
||||||
|
|
||||||
|
local S = technic.getter
|
||||||
|
|
||||||
local shape = {}
|
local shape = {}
|
||||||
local onesize_products = {
|
local onesize_products = {
|
||||||
@ -126,7 +127,7 @@ end
|
|||||||
|
|
||||||
-- The actual block inactive state
|
-- The actual block inactive state
|
||||||
minetest.register_node("technic:cnc", {
|
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",
|
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"},
|
"technic_cnc_side.png", "technic_cnc_side.png", "technic_cnc_front.png"},
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
@ -142,7 +143,7 @@ minetest.register_node("technic:cnc", {
|
|||||||
legacy_facedir_simple = true,
|
legacy_facedir_simple = true,
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(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_float("technic_power_machine", 1)
|
||||||
meta:set_string("formspec", cnc_formspec)
|
meta:set_string("formspec", cnc_formspec)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
@ -154,7 +155,7 @@ minetest.register_node("technic:cnc", {
|
|||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
if not inv:is_empty("src") or not inv:is_empty("dst") then
|
if not inv:is_empty("src") or not inv:is_empty("dst") then
|
||||||
minetest.chat_send_player(player:get_player_name(),
|
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
|
return false
|
||||||
else
|
else
|
||||||
return true
|
return true
|
||||||
@ -165,7 +166,7 @@ minetest.register_node("technic:cnc", {
|
|||||||
|
|
||||||
-- Active state block
|
-- Active state block
|
||||||
minetest.register_node("technic:cnc_active", {
|
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",
|
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"},
|
"technic_cnc_side.png", "technic_cnc_side.png", "technic_cnc_front_active.png"},
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
@ -176,7 +177,7 @@ minetest.register_node("technic:cnc_active", {
|
|||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
if not inv:is_empty("src") or not inv:is_empty("dst") then
|
if not inv:is_empty("src") or not inv:is_empty("dst") then
|
||||||
minetest.chat_send_player(player:get_player_name(),
|
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
|
return false
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
@ -193,7 +194,7 @@ minetest.register_abm({
|
|||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
local eu_input = meta:get_int("LV_EU_input")
|
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 machine_node = "technic:cnc"
|
||||||
local demand = 450
|
local demand = 450
|
||||||
|
|
||||||
@ -213,17 +214,17 @@ minetest.register_abm({
|
|||||||
(not minetest.registered_nodes[result]) or
|
(not minetest.registered_nodes[result]) or
|
||||||
(not inv:room_for_item("dst", result)) then
|
(not inv:room_for_item("dst", result)) then
|
||||||
hacky_swap_node(pos, machine_node)
|
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", "")
|
meta:set_string("cnc_product", "")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if eu_input < demand then
|
if eu_input < demand then
|
||||||
hacky_swap_node(pos, machine_node)
|
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
|
elseif eu_input >= demand then
|
||||||
hacky_swap_node(pos, machine_node.."_active")
|
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)
|
meta:set_int("src_time", meta:get_int("src_time") + 1)
|
||||||
if meta:get_int("src_time") >= 3 then -- 3 ticks per output
|
if meta:get_int("src_time") >= 3 then -- 3 ticks per output
|
||||||
meta:set_int("src_time", 0)
|
meta:set_int("src_time", 0)
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
-- API for the technic CNC machine
|
-- API for the technic CNC machine
|
||||||
-- Again code is adapted from the NonCubic Blocks MOD v1.4 by yves_de_beck
|
-- 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
|
technic.cnc.detail_level = 16
|
||||||
|
|
||||||
@ -151,119 +153,119 @@ end
|
|||||||
technic.cnc.programs = {
|
technic.cnc.programs = {
|
||||||
{suffix = "technic_cnc_stick",
|
{suffix = "technic_cnc_stick",
|
||||||
nodebox = {-0.15, -0.5, -0.15, 0.15, 0.5, 0.15},
|
nodebox = {-0.15, -0.5, -0.15, 0.15, 0.5, 0.15},
|
||||||
desc = "Stick"},
|
desc = S("Stick")},
|
||||||
|
|
||||||
{suffix = "technic_cnc_element_end_double",
|
{suffix = "technic_cnc_element_end_double",
|
||||||
nodebox = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.5},
|
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",
|
{suffix = "technic_cnc_element_cross_double",
|
||||||
nodebox = {
|
nodebox = {
|
||||||
{0.3, -0.5, -0.3, 0.5, 0.5, 0.3},
|
{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.3, -0.5, -0.5, 0.3, 0.5, 0.5},
|
||||||
{-0.5, -0.5, -0.3, -0.3, 0.5, 0.3}},
|
{-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",
|
{suffix = "technic_cnc_element_t_double",
|
||||||
nodebox = {
|
nodebox = {
|
||||||
{-0.3, -0.5, -0.5, 0.3, 0.5, 0.3},
|
{-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.5, -0.5, -0.3, -0.3, 0.5, 0.3},
|
||||||
{0.3, -0.5, -0.3, 0.5, 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",
|
{suffix = "technic_cnc_element_edge_double",
|
||||||
nodebox = {
|
nodebox = {
|
||||||
{-0.3, -0.5, -0.5, 0.3, 0.5, 0.3},
|
{-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.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",
|
{suffix = "technic_cnc_element_straight_double",
|
||||||
nodebox = {-0.3, -0.5, -0.5, 0.3, 0.5, 0.5},
|
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",
|
{suffix = "technic_cnc_element_end",
|
||||||
nodebox = {-0.3, -0.5, -0.3, 0.3, 0, 0.5},
|
nodebox = {-0.3, -0.5, -0.3, 0.3, 0, 0.5},
|
||||||
desc = "Element End"},
|
desc = S("Element End")},
|
||||||
|
|
||||||
{suffix = "technic_cnc_element_cross",
|
{suffix = "technic_cnc_element_cross",
|
||||||
nodebox = {
|
nodebox = {
|
||||||
{0.3, -0.5, -0.3, 0.5, 0, 0.3},
|
{0.3, -0.5, -0.3, 0.5, 0, 0.3},
|
||||||
{-0.3, -0.5, -0.5, 0.3, 0, 0.5},
|
{-0.3, -0.5, -0.5, 0.3, 0, 0.5},
|
||||||
{-0.5, -0.5, -0.3, -0.3, 0, 0.3}},
|
{-0.5, -0.5, -0.3, -0.3, 0, 0.3}},
|
||||||
desc = "Element Cross"},
|
desc = S("Element Cross")},
|
||||||
|
|
||||||
{suffix = "technic_cnc_element_t",
|
{suffix = "technic_cnc_element_t",
|
||||||
nodebox = {
|
nodebox = {
|
||||||
{-0.3, -0.5, -0.5, 0.3, 0, 0.3},
|
{-0.3, -0.5, -0.5, 0.3, 0, 0.3},
|
||||||
{-0.5, -0.5, -0.3, -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}},
|
{0.3, -0.5, -0.3, 0.5, 0, 0.3}},
|
||||||
desc = "Element T"},
|
desc = S("Element T")},
|
||||||
|
|
||||||
{suffix = "technic_cnc_element_edge",
|
{suffix = "technic_cnc_element_edge",
|
||||||
nodebox = {
|
nodebox = {
|
||||||
{-0.3, -0.5, -0.5, 0.3, 0, 0.3},
|
{-0.3, -0.5, -0.5, 0.3, 0, 0.3},
|
||||||
{-0.5, -0.5, -0.3, -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",
|
{suffix = "technic_cnc_element_straight",
|
||||||
nodebox = {-0.3, -0.5, -0.5, 0.3, 0, 0.5},
|
nodebox = {-0.3, -0.5, -0.5, 0.3, 0, 0.5},
|
||||||
desc = "Element Straight"},
|
desc = S("Element Straight")},
|
||||||
|
|
||||||
{suffix = "technic_cnc_sphere",
|
{suffix = "technic_cnc_sphere",
|
||||||
nodebox = cnc_sphere(),
|
nodebox = cnc_sphere(),
|
||||||
desc = "Sphere"},
|
desc = S("Sphere")},
|
||||||
|
|
||||||
{suffix = "technic_cnc_cylinder_horizontal",
|
{suffix = "technic_cnc_cylinder_horizontal",
|
||||||
nodebox = cnc_cylinder_horizontal(),
|
nodebox = cnc_cylinder_horizontal(),
|
||||||
desc = "Cylinder Horizontal"},
|
desc = S("Horizontal Cylinder")},
|
||||||
|
|
||||||
{suffix = "technic_cnc_cylinder",
|
{suffix = "technic_cnc_cylinder",
|
||||||
nodebox = cnc_cylinder(),
|
nodebox = cnc_cylinder(),
|
||||||
desc = ""},
|
desc = S("Cylinder")},
|
||||||
|
|
||||||
{suffix = "technic_cnc_twocurvededge",
|
{suffix = "technic_cnc_twocurvededge",
|
||||||
nodebox = cnc_twocurvededge(),
|
nodebox = cnc_twocurvededge(),
|
||||||
desc = "One Curved Edge Block"},
|
desc = S("Two Curved Edge Block")},
|
||||||
|
|
||||||
{suffix = "technic_cnc_onecurvededge",
|
{suffix = "technic_cnc_onecurvededge",
|
||||||
nodebox = cnc_onecurvededge(),
|
nodebox = cnc_onecurvededge(),
|
||||||
desc = "Two Curved Edge Block"},
|
desc = S("One Curved Edge Block")},
|
||||||
|
|
||||||
{suffix = "technic_cnc_spike",
|
{suffix = "technic_cnc_spike",
|
||||||
nodebox = cnc_spike(),
|
nodebox = cnc_spike(),
|
||||||
desc = "Spike"},
|
desc = S("Spike")},
|
||||||
|
|
||||||
{suffix = "technic_cnc_pyramid",
|
{suffix = "technic_cnc_pyramid",
|
||||||
nodebox = cnc_pyramid(),
|
nodebox = cnc_pyramid(),
|
||||||
desc = "Pyramid"},
|
desc = S("Pyramid")},
|
||||||
|
|
||||||
{suffix = "technic_cnc_slope_inner_edge_upsdown",
|
{suffix = "technic_cnc_slope_inner_edge_upsdown",
|
||||||
nodebox = 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",
|
{suffix = "technic_cnc_slope_edge_upsdown",
|
||||||
nodebox = 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",
|
{suffix = "technic_cnc_slope_inner_edge",
|
||||||
nodebox = cnc_slope_inner_edge(),
|
nodebox = cnc_slope_inner_edge(),
|
||||||
desc = "Slope Inner Edge"},
|
desc = S("Slope Inner Edge")},
|
||||||
|
|
||||||
{suffix = "technic_cnc_slope_edge",
|
{suffix = "technic_cnc_slope_edge",
|
||||||
nodebox = cnc_slope_edge(),
|
nodebox = cnc_slope_edge(),
|
||||||
desc = "Slope Edge"},
|
desc = S("Slope Edge")},
|
||||||
|
|
||||||
{suffix = "technic_cnc_slope_upsdown",
|
{suffix = "technic_cnc_slope_upsdown",
|
||||||
nodebox = cnc_slope_upsdown(),
|
nodebox = cnc_slope_upsdown(),
|
||||||
desc = "Slope Upside Down"},
|
desc = S("Slope Upside Down")},
|
||||||
|
|
||||||
{suffix = "technic_cnc_slope_lying",
|
{suffix = "technic_cnc_slope_lying",
|
||||||
nodebox = cnc_slope_lying(),
|
nodebox = cnc_slope_lying(),
|
||||||
desc = "Slope Lying"},
|
desc = S("Slope Lying")},
|
||||||
|
|
||||||
{suffix = "technic_cnc_slope",
|
{suffix = "technic_cnc_slope",
|
||||||
nodebox = 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
|
-- 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:
|
-- REGISTER MATERIALS AND PROPERTIES FOR NONCUBIC ELEMENTS:
|
||||||
-----------------------------------------------------------
|
-----------------------------------------------------------
|
||||||
|
|
||||||
|
local S = technic.getter
|
||||||
|
|
||||||
-- DIRT
|
-- DIRT
|
||||||
-------
|
-------
|
||||||
technic.cnc.register_all("default:dirt",
|
technic.cnc.register_all("default:dirt",
|
||||||
{snappy=2,choppy=2,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
|
{snappy=2,choppy=2,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
|
||||||
{"default_grass.png", "default_dirt.png", "default_grass.png"},
|
{"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.programs_disable["default:dirt"] = {"technic_cnc_sphere", "technic_cnc_slope_upsdown",
|
||||||
"technic_cnc_edge", "technic_cnc_inner_edge",
|
"technic_cnc_edge", "technic_cnc_inner_edge",
|
||||||
"technic_cnc_slope_edge_upsdown", "technic_cnc_slope_inner_edge_upsdown",
|
"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",
|
technic.cnc.register_all("default:tree",
|
||||||
{snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1},
|
{snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1},
|
||||||
{"default_tree.png"},
|
{"default_tree.png"},
|
||||||
"Wooden")
|
S("Wooden"))
|
||||||
|
|
||||||
-- WOOD
|
-- WOOD
|
||||||
-------
|
-------
|
||||||
technic.cnc.register_all("default:wood",
|
technic.cnc.register_all("default:wood",
|
||||||
{snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1},
|
{snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1},
|
||||||
{"default_wood.png"},
|
{"default_wood.png"},
|
||||||
"Wooden")
|
S("Wooden"))
|
||||||
-- STONE
|
-- STONE
|
||||||
--------
|
--------
|
||||||
technic.cnc.register_all("default:stone",
|
technic.cnc.register_all("default:stone",
|
||||||
{cracky=3, not_in_creative_inventory=1},
|
{cracky=3, not_in_creative_inventory=1},
|
||||||
{"default_stone.png"},
|
{"default_stone.png"},
|
||||||
"Stone")
|
S("Stone"))
|
||||||
-- COBBLE
|
-- COBBLE
|
||||||
---------
|
---------
|
||||||
technic.cnc.register_all("default:cobble",
|
technic.cnc.register_all("default:cobble",
|
||||||
{cracky=3, not_in_creative_inventory=1},
|
{cracky=3, not_in_creative_inventory=1},
|
||||||
{"default_cobble.png"},
|
{"default_cobble.png"},
|
||||||
"Cobble")
|
S("Cobble"))
|
||||||
-- BRICK
|
-- BRICK
|
||||||
--------
|
--------
|
||||||
technic.cnc.register_all("default:brick",
|
technic.cnc.register_all("default:brick",
|
||||||
{cracky=3, not_in_creative_inventory=1},
|
{cracky=3, not_in_creative_inventory=1},
|
||||||
{"default_brick.png"},
|
{"default_brick.png"},
|
||||||
"Brick")
|
S("Brick"))
|
||||||
|
|
||||||
-- SANDSTONE
|
-- SANDSTONE
|
||||||
------------
|
------------
|
||||||
technic.cnc.register_all("default:sandstone",
|
technic.cnc.register_all("default:sandstone",
|
||||||
{crumbly=2, cracky=2, not_in_creative_inventory=1},
|
{crumbly=2, cracky=2, not_in_creative_inventory=1},
|
||||||
{"default_sandstone.png"},
|
{"default_sandstone.png"},
|
||||||
"Sandstone")
|
S("Sandstone"))
|
||||||
|
|
||||||
-- LEAVES
|
-- LEAVES
|
||||||
---------
|
---------
|
||||||
technic.cnc.register_all("default:leaves",
|
technic.cnc.register_all("default:leaves",
|
||||||
{snappy=2, choppy=2, oddly_breakable_by_hand=3, not_in_creative_inventory=1},
|
{snappy=2, choppy=2, oddly_breakable_by_hand=3, not_in_creative_inventory=1},
|
||||||
{"default_leaves.png"},
|
{"default_leaves.png"},
|
||||||
"Leaves")
|
S("Leaves"))
|
||||||
-- TREE
|
-- TREE
|
||||||
-------
|
-------
|
||||||
technic.cnc.register_all("default: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},
|
{snappy=1, choppy=2, oddly_breakable_by_hand=2, flammable=3, wood=1, not_in_creative_inventory=1},
|
||||||
{"default_tree.png"},
|
{"default_tree.png"},
|
||||||
"Tree")
|
S("Tree"))
|
||||||
-- STEEL
|
-- STEEL
|
||||||
--------
|
--------
|
||||||
technic.cnc.register_all("default:steel",
|
technic.cnc.register_all("default:steel",
|
||||||
{snappy=1, bendy=2, cracky=1, melty=2, level=2, not_in_creative_inventory=1},
|
{snappy=1, bendy=2, cracky=1, melty=2, level=2, not_in_creative_inventory=1},
|
||||||
{"default_steel_block.png"},
|
{"default_steel_block.png"},
|
||||||
"Steel")
|
S("Steel"))
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
-- Coal driven alloy furnace. This uses no EUs:
|
-- Coal driven alloy furnace. This uses no EUs:
|
||||||
|
|
||||||
|
local S = technic.getter
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'technic:coal_alloy_furnace',
|
output = 'technic:coal_alloy_furnace',
|
||||||
@ -12,7 +13,7 @@ minetest.register_craft({
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("technic:coal_alloy_furnace", {
|
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",
|
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"},
|
"technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_front.png"},
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
@ -22,7 +23,7 @@ minetest.register_node("technic:coal_alloy_furnace", {
|
|||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.env:get_meta(pos)
|
local meta = minetest.env:get_meta(pos)
|
||||||
meta:set_string("formspec", coal_alloy_furnace_formspec)
|
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()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size("fuel", 1)
|
inv:set_size("fuel", 1)
|
||||||
inv:set_size("src", 1)
|
inv:set_size("src", 1)
|
||||||
@ -68,9 +69,10 @@ minetest.register_abm({
|
|||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
local recipe = nil
|
local recipe = nil
|
||||||
|
local machine_name = S("Coal Alloy Furnace")
|
||||||
local formspec =
|
local formspec =
|
||||||
"size[8,9]"..
|
"size[8,9]"..
|
||||||
"label[0,0;Alloy Furnace]"..
|
"label[0,0;"..machine_name.."]"..
|
||||||
"image[2,2;1,1;default_furnace_fire_bg.png]"..
|
"image[2,2;1,1;default_furnace_fire_bg.png]"..
|
||||||
"list[current_name;fuel;2,3;1,1;]"..
|
"list[current_name;fuel;2,3;1,1;]"..
|
||||||
"list[current_name;src;2,1;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
|
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
|
||||||
local percent = math.floor(meta:get_float("fuel_time") /
|
local percent = math.floor(meta:get_float("fuel_time") /
|
||||||
meta:get_float("fuel_totaltime") * 100)
|
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")
|
hacky_swap_node(pos, "technic:coal_alloy_furnace_active")
|
||||||
meta:set_string("formspec",
|
meta:set_string("formspec",
|
||||||
"size[8,9]"..
|
"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:"..
|
"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;fuel;2,3;1,1;]"..
|
||||||
"list[current_name;src;2,1;1,1;]"..
|
"list[current_name;src;2,1;1,1;]"..
|
||||||
"list[current_name;src2;3,1;1,1;]"..
|
"list[current_name;src2;3,1;1,1;]"..
|
||||||
@ -164,7 +166,7 @@ minetest.register_abm({
|
|||||||
end
|
end
|
||||||
|
|
||||||
if fuel.time <= 0 then
|
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")
|
hacky_swap_node(pos, "technic:coal_alloy_furnace")
|
||||||
meta:set_string("formspec", formspec)
|
meta:set_string("formspec", formspec)
|
||||||
return
|
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.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}
|
technic.compressor_recipes[src] = {src_count = src_count, dst_name = dst, dst_count = dst_count}
|
||||||
if unified_inventory then
|
if unified_inventory then
|
||||||
unified_inventory.register_craft(
|
unified_inventory.register_craft({
|
||||||
{
|
|
||||||
type = "compressing",
|
type = "compressing",
|
||||||
output = dst.." "..dst_count,
|
output = dst.." "..dst_count,
|
||||||
items = {src.." "..src_count},
|
items = {src.." "..src_count},
|
||||||
@ -44,13 +46,13 @@ minetest.register_craft({
|
|||||||
|
|
||||||
local compressor_formspec =
|
local compressor_formspec =
|
||||||
"invsize[8,9;]"..
|
"invsize[8,9;]"..
|
||||||
"label[0,0;Compressor]"..
|
"label[0,0;"..S("Compressor").."]"..
|
||||||
"list[current_name;src;3,1;1,1;]"..
|
"list[current_name;src;3,1;1,1;]"..
|
||||||
"list[current_name;dst;5,1;2,2;]"..
|
"list[current_name;dst;5,1;2,2;]"..
|
||||||
"list[current_player;main;0,5;8,4;]"
|
"list[current_player;main;0,5;8,4;]"
|
||||||
|
|
||||||
minetest.register_node("technic:compressor", {
|
minetest.register_node("technic:compressor", {
|
||||||
description = "Compressor",
|
description = S("Compressor"),
|
||||||
tiles = {"technic_compressor_top.png", "technic_compressor_bottom.png",
|
tiles = {"technic_compressor_top.png", "technic_compressor_bottom.png",
|
||||||
"technic_compressor_side.png", "technic_compressor_side.png",
|
"technic_compressor_side.png", "technic_compressor_side.png",
|
||||||
"technic_compressor_back.png", "technic_compressor_front.png"},
|
"technic_compressor_back.png", "technic_compressor_front.png"},
|
||||||
@ -60,8 +62,7 @@ minetest.register_node("technic:compressor", {
|
|||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("infotext", "Compressor")
|
meta:set_string("infotext", S("Compressor"))
|
||||||
meta:set_float("technic_power_machine", 1)
|
|
||||||
meta:set_string("formspec", compressor_formspec)
|
meta:set_string("formspec", compressor_formspec)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size("src", 1)
|
inv:set_size("src", 1)
|
||||||
@ -72,7 +73,7 @@ minetest.register_node("technic:compressor", {
|
|||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
if not inv:is_empty("src") or not inv:is_empty("dst") then
|
if not inv:is_empty("src") or not inv:is_empty("dst") then
|
||||||
minetest.chat_send_player(player:get_player_name(),
|
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
|
return false
|
||||||
else
|
else
|
||||||
return true
|
return true
|
||||||
@ -81,7 +82,7 @@ minetest.register_node("technic:compressor", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("technic:compressor_active", {
|
minetest.register_node("technic:compressor_active", {
|
||||||
description = "Compressor",
|
description = S("Compressor"),
|
||||||
tiles = {"technic_compressor_top.png", "technic_compressor_bottom.png",
|
tiles = {"technic_compressor_top.png", "technic_compressor_bottom.png",
|
||||||
"technic_compressor_side.png", "technic_compressor_side.png",
|
"technic_compressor_side.png", "technic_compressor_side.png",
|
||||||
"technic_compressor_back.png", "technic_compressor_front_active.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()
|
local inv = meta:get_inventory()
|
||||||
if not inv:is_empty("src") or not inv:is_empty("dst") then
|
if not inv:is_empty("src") or not inv:is_empty("dst") then
|
||||||
minetest.chat_send_player(player:get_player_name(),
|
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
|
return false
|
||||||
else
|
else
|
||||||
return true
|
return true
|
||||||
@ -109,7 +110,7 @@ minetest.register_abm({
|
|||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local eu_input = meta:get_int("LV_EU_input")
|
local eu_input = meta:get_int("LV_EU_input")
|
||||||
local machine_name = "Compressor"
|
local machine_name = S("Compressor")
|
||||||
local machine_node = "technic:compressor"
|
local machine_node = "technic:compressor"
|
||||||
local demand = 300
|
local demand = 300
|
||||||
|
|
||||||
@ -139,7 +140,7 @@ minetest.register_abm({
|
|||||||
if empty or (not result) or
|
if empty or (not result) or
|
||||||
(not inv:room_for_item("dst", result)) then
|
(not inv:room_for_item("dst", result)) then
|
||||||
hacky_swap_node(pos, machine_node)
|
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("LV_EU_demand", 0)
|
||||||
meta:set_int("src_time", 0)
|
meta:set_int("src_time", 0)
|
||||||
return
|
return
|
||||||
@ -147,10 +148,10 @@ minetest.register_abm({
|
|||||||
|
|
||||||
if eu_input < demand then
|
if eu_input < demand then
|
||||||
hacky_swap_node(pos, machine_node)
|
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
|
elseif eu_input >= demand then
|
||||||
hacky_swap_node(pos, machine_node.."_active")
|
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)
|
meta:set_int("src_time", meta:get_int("src_time") + 1)
|
||||||
if meta:get_int("src_time") >= 4 then
|
if meta:get_int("src_time") >= 4 then
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
|
|
||||||
technic.extractor_recipes ={}
|
technic.extractor_recipes ={}
|
||||||
|
|
||||||
|
local S = technic.getter
|
||||||
|
|
||||||
technic.register_extractor_recipe = function(src, src_count, dst, dst_count)
|
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}
|
technic.extractor_recipes[src] = {src_count = src_count, dst_name = dst, dst_count = dst_count}
|
||||||
if unified_inventory then
|
if unified_inventory then
|
||||||
@ -50,13 +53,13 @@ minetest.register_craft({
|
|||||||
|
|
||||||
local extractor_formspec =
|
local extractor_formspec =
|
||||||
"invsize[8,9;]"..
|
"invsize[8,9;]"..
|
||||||
"label[0,0;Extractor]"..
|
"label[0,0;"..S("Extractor").."]"..
|
||||||
"list[current_name;src;3,1;1,1;]"..
|
"list[current_name;src;3,1;1,1;]"..
|
||||||
"list[current_name;dst;5,1;2,2;]"..
|
"list[current_name;dst;5,1;2,2;]"..
|
||||||
"list[current_player;main;0,5;8,4;]"
|
"list[current_player;main;0,5;8,4;]"
|
||||||
|
|
||||||
minetest.register_node("technic:extractor", {
|
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",
|
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"},
|
"technic_lv_grinder_side.png", "technic_lv_grinder_side.png", "technic_lv_grinder_front.png"},
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
@ -65,7 +68,7 @@ minetest.register_node("technic:extractor", {
|
|||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("infotext", "Extractor")
|
meta:set_string("infotext", S("Extractor"))
|
||||||
meta:set_string("formspec", extractor_formspec)
|
meta:set_string("formspec", extractor_formspec)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size("src", 1)
|
inv:set_size("src", 1)
|
||||||
@ -76,7 +79,7 @@ minetest.register_node("technic:extractor", {
|
|||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
if not inv:is_empty("src") or not inv:is_empty("dst") then
|
if not inv:is_empty("src") or not inv:is_empty("dst") then
|
||||||
minetest.chat_send_player(player:get_player_name(),
|
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
|
return false
|
||||||
else
|
else
|
||||||
return true
|
return true
|
||||||
@ -85,7 +88,7 @@ minetest.register_node("technic:extractor", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("technic:extractor_active", {
|
minetest.register_node("technic:extractor_active", {
|
||||||
description = "Extractor",
|
description = S("Extractor"),
|
||||||
tiles = {"technic_lv_grinder_top.png", "technic_lv_grinder_bottom.png",
|
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_side.png",
|
||||||
"technic_lv_grinder_side.png", "technic_lv_grinder_front_active.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()
|
local inv = meta:get_inventory()
|
||||||
if not inv:is_empty("src") or not inv:is_empty("dst") then
|
if not inv:is_empty("src") or not inv:is_empty("dst") then
|
||||||
minetest.chat_send_player(player:get_player_name(),
|
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
|
return false
|
||||||
else
|
else
|
||||||
return true
|
return true
|
||||||
@ -118,7 +121,7 @@ minetest.register_abm({
|
|||||||
local eu_input = meta:get_int("LV_EU_input")
|
local eu_input = meta:get_int("LV_EU_input")
|
||||||
|
|
||||||
-- Machine information
|
-- Machine information
|
||||||
local machine_name = "Extractor"
|
local machine_name = S("Extractor")
|
||||||
local machine_node = "technic:extractor"
|
local machine_node = "technic:extractor"
|
||||||
local demand = 300
|
local demand = 300
|
||||||
|
|
||||||
@ -144,7 +147,7 @@ minetest.register_abm({
|
|||||||
if inv:is_empty("src") or (not recipe) or (not result) or
|
if inv:is_empty("src") or (not recipe) or (not result) or
|
||||||
(not inv:room_for_item("dst", result)) then
|
(not inv:room_for_item("dst", result)) then
|
||||||
hacky_swap_node(pos, machine_node)
|
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("LV_EU_demand", 0)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -152,11 +155,11 @@ minetest.register_abm({
|
|||||||
if eu_input < demand then
|
if eu_input < demand then
|
||||||
-- unpowered - go idle
|
-- unpowered - go idle
|
||||||
hacky_swap_node(pos, machine_node)
|
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
|
elseif eu_input >= demand then
|
||||||
-- Powered
|
-- Powered
|
||||||
hacky_swap_node(pos, machine_node.."_active")
|
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)
|
meta:set_int("src_time", meta:get_int("src_time") + 1)
|
||||||
if meta:get_int("src_time") >= 4 then -- 4 ticks per output
|
if meta:get_int("src_time") >= 4 then -- 4 ticks per output
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
minetest.register_alias("geothermal", "technic:geothermal")
|
minetest.register_alias("geothermal", "technic:geothermal")
|
||||||
|
|
||||||
|
local S = technic.getter
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'technic:geothermal',
|
output = 'technic:geothermal',
|
||||||
recipe = {
|
recipe = {
|
||||||
@ -15,18 +17,17 @@ minetest.register_craft({
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("technic:geothermal", {
|
minetest.register_craftitem("technic:geothermal", {
|
||||||
description = "Geothermal Generator",
|
description = S("Geothermal Generator"),
|
||||||
stack_max = 99,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
local geothermal_formspec =
|
local geothermal_formspec =
|
||||||
"invsize[8,4;]"..
|
"invsize[8,4;]"..
|
||||||
"label[0,0;Geothermal Generator]"..
|
"label[0,0;"..S("Geothermal Generator").."]"..
|
||||||
"list[current_player;main;0,5;8,4;]"
|
"list[current_player;main;0,5;8,4;]"
|
||||||
|
|
||||||
|
|
||||||
minetest.register_node("technic:geothermal", {
|
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",
|
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"},
|
"technic_geothermal_side.png", "technic_geothermal_side.png", "technic_geothermal_side.png"},
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
@ -35,15 +36,14 @@ minetest.register_node("technic:geothermal", {
|
|||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("infotext", "Geothermal Generator")
|
meta:set_string("infotext", S("Geothermal Generator"))
|
||||||
meta:set_float("technic_power_machine", 1)
|
|
||||||
meta:set_int("LV_EU_supply", 0)
|
meta:set_int("LV_EU_supply", 0)
|
||||||
meta:set_string("formspec", geothermal_formspec)
|
meta:set_string("formspec", geothermal_formspec)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("technic:geothermal_active", {
|
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",
|
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"},
|
"technic_geothermal_side.png", "technic_geothermal_side.png", "technic_geothermal_side.png"},
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
@ -104,8 +104,8 @@ minetest.register_abm({
|
|||||||
|
|
||||||
meta:set_string("formspec",
|
meta:set_string("formspec",
|
||||||
"invsize[8,4;]"..
|
"invsize[8,4;]"..
|
||||||
"label[0,0;Geothermal Generator]"..
|
"label[0,0;"..S("Geothermal Generator").."]"..
|
||||||
"label[4,0;Production at "..tostring(production_level).."%]")
|
"label[4,0;"..S("Production at %d%%"):format(production_level).."]")
|
||||||
|
|
||||||
if production_level > 0 and minetest.get_node(pos).name == "technic:geothermal" then
|
if production_level > 0 and minetest.get_node(pos).name == "technic:geothermal" then
|
||||||
hacky_swap_node (pos, "technic:geothermal_active")
|
hacky_swap_node (pos, "technic:geothermal_active")
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
-- LV Music player.
|
-- LV Music player.
|
||||||
-- The player can play music. But it is high ampage!
|
-- The player can play music. But it is high ampage!
|
||||||
|
|
||||||
|
local S = technic.getter
|
||||||
|
|
||||||
minetest.register_alias("music_player", "technic:music_player")
|
minetest.register_alias("music_player", "technic:music_player")
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'technic:music_player',
|
output = 'technic:music_player',
|
||||||
@ -13,7 +15,7 @@ minetest.register_craft({
|
|||||||
|
|
||||||
local music_player_formspec =
|
local music_player_formspec =
|
||||||
"invsize[8,9;]"..
|
"invsize[8,9;]"..
|
||||||
"label[0,0;Music Player]"..
|
"label[0,0;"..S("Music Player").."]"..
|
||||||
"button[4,1;1,1;track1;1]"..
|
"button[4,1;1,1;track1;1]"..
|
||||||
"button[5,1;1,1;track2;2]"..
|
"button[5,1;1,1;track2;2]"..
|
||||||
"button[6,1;1,1;track3;3]"..
|
"button[6,1;1,1;track3;3]"..
|
||||||
@ -28,14 +30,14 @@ local music_player_formspec =
|
|||||||
"label[4,0;Current track --]"
|
"label[4,0;Current track --]"
|
||||||
|
|
||||||
minetest.register_node("technic:music_player", {
|
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",
|
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"},
|
"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},
|
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(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("active", 0)
|
||||||
meta:set_int("current_track", 1)
|
meta:set_int("current_track", 1)
|
||||||
meta:set_string("formspec", music_player_formspec)
|
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_int("current_track", current_track)
|
||||||
meta:set_string("formspec",
|
meta:set_string("formspec",
|
||||||
"invsize[8,9;]"..
|
"invsize[8,9;]"..
|
||||||
"label[0,0;Music Player]"..
|
"label[0,0;"..S("Music Player").."]"..
|
||||||
"button[4,1;1,1;track1;1]"..
|
"button[4,1;1,1;track1;1]"..
|
||||||
"button[5,1;1,1;track2;2]"..
|
"button[5,1;1,1;track2;2]"..
|
||||||
"button[6,1;1,1;track3;3]"..
|
"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)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local eu_input = meta:get_int("LV_EU_input")
|
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 machine_node = "technic:music_player"
|
||||||
local demand = 150
|
local demand = 150
|
||||||
|
|
||||||
@ -111,7 +113,7 @@ minetest.register_abm({
|
|||||||
technic.switching_station_timeout_count(pos, "LV")
|
technic.switching_station_timeout_count(pos, "LV")
|
||||||
|
|
||||||
if meta:get_int("active") == 0 then
|
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)
|
meta:set_int("LV_EU_demand", 0)
|
||||||
if music_handle then
|
if music_handle then
|
||||||
minetest.sound_stop(music_handle)
|
minetest.sound_stop(music_handle)
|
||||||
@ -120,12 +122,12 @@ minetest.register_abm({
|
|||||||
end
|
end
|
||||||
|
|
||||||
if eu_input < demand then
|
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
|
if music_handle then
|
||||||
minetest.sound_stop(music_handle)
|
minetest.sound_stop(music_handle)
|
||||||
end
|
end
|
||||||
elseif eu_input >= demand then
|
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,
|
music_handle = minetest.sound_play("technic_track"..current_track,
|
||||||
{pos = pos, gain = 1.0, loop = true, max_hear_distance = 72,})
|
{pos = pos, gain = 1.0, loop = true, max_hear_distance = 72,})
|
||||||
meta:set_int("music_handle", music_handle)
|
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.
|
-- 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.
|
-- Individual panels are less efficient than when the panels are combined into full arrays.
|
||||||
|
|
||||||
|
local S = technic.getter
|
||||||
|
|
||||||
minetest.register_node("technic:solar_panel", {
|
minetest.register_node("technic:solar_panel", {
|
||||||
tiles = {"technic_solar_panel_top.png", "technic_solar_panel_bottom.png", "technic_solar_panel_side.png",
|
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"},
|
"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},
|
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
description="Solar Panel",
|
description = S("Solar Panel"),
|
||||||
active = false,
|
active = false,
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
@ -19,7 +21,7 @@ minetest.register_node("technic:solar_panel", {
|
|||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_int("LV_EU_supply", 0)
|
meta:set_int("LV_EU_supply", 0)
|
||||||
meta:set_string("infotext", "LV Solar Panel")
|
meta:set_string("infotext", S("Solar Panel"))
|
||||||
end,
|
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
|
-- To take care of some of it solar panels do not work outside daylight hours or if
|
||||||
-- built below -10m
|
-- built below -10m
|
||||||
local pos1 = {x=pos.x, y=pos.y+1, z=pos.z}
|
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 light = minetest.get_node_light(pos1, nil)
|
||||||
local time_of_day = minetest.get_timeofday()
|
local time_of_day = minetest.get_timeofday()
|
||||||
@ -57,10 +60,10 @@ minetest.register_abm({
|
|||||||
local charge_to_give = math.floor((light + pos1.y) * 3)
|
local charge_to_give = math.floor((light + pos1.y) * 3)
|
||||||
charge_to_give = math.max(charge_to_give, 0)
|
charge_to_give = math.max(charge_to_give, 0)
|
||||||
charge_to_give = math.min(charge_to_give, 200)
|
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)
|
meta:set_int("LV_EU_supply", charge_to_give)
|
||||||
else
|
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)
|
meta:set_int("LV_EU_supply", 0)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
-- A water mill produces LV EUs by exploiting flowing water across it
|
-- 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 LV EU supplyer and fairly low yield (max 120EUs)
|
||||||
-- It is a little under half as good as the thermal generator.
|
-- 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_alias("water_mill", "technic:water_mill")
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
@ -13,7 +16,7 @@ minetest.register_craft({
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("technic:water_mill", {
|
minetest.register_node("technic:water_mill", {
|
||||||
description = "Water Mill",
|
description = S("Water Mill"),
|
||||||
tiles = {"technic_water_mill_top.png", "technic_machine_bottom.png",
|
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",
|
||||||
"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(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(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)
|
meta:set_int("LV_EU_supply", 0)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("technic:water_mill_active", {
|
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",
|
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",
|
||||||
"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
|
end
|
||||||
|
|
||||||
meta:set_string("infotext",
|
meta:set_string("infotext",
|
||||||
"Water Mill ("..production_level.."%)")
|
S("Water Mill").." ("..production_level.."%)")
|
||||||
|
|
||||||
if production_level > 0 and
|
if production_level > 0 and
|
||||||
minetest.get_node(pos).name == "technic:water_mill" then
|
minetest.get_node(pos).name == "technic:water_mill" then
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
-- LV Tool workshop
|
-- Tool workshop
|
||||||
-- This machine repairs tools.
|
-- This machine repairs tools.
|
||||||
|
|
||||||
minetest.register_alias("tool_workshop", "technic:tool_workshop")
|
minetest.register_alias("tool_workshop", "technic:tool_workshop")
|
||||||
|
|
||||||
|
local S = technic.getter
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'technic:tool_workshop',
|
output = 'technic:tool_workshop',
|
||||||
recipe = {
|
recipe = {
|
||||||
@ -14,19 +17,18 @@ minetest.register_craft({
|
|||||||
local workshop_formspec =
|
local workshop_formspec =
|
||||||
"invsize[8,9;]"..
|
"invsize[8,9;]"..
|
||||||
"list[current_name;src;3,1;1,1;]"..
|
"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;]"
|
"list[current_player;main;0,5;8,4;]"
|
||||||
|
|
||||||
minetest.register_node("technic:tool_workshop", {
|
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",
|
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"},
|
"technic_workshop_side.png", "technic_workshop_side.png", "technic_workshop_side.png"},
|
||||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("infotext", "Tool Workshop")
|
meta:set_string("infotext", S("Tool Workshop"))
|
||||||
meta:set_float("technic_power_machine", 1)
|
|
||||||
meta:set_string("formspec", workshop_formspec)
|
meta:set_string("formspec", workshop_formspec)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size("src", 1)
|
inv:set_size("src", 1)
|
||||||
@ -36,7 +38,7 @@ minetest.register_node("technic:tool_workshop", {
|
|||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
if not inv:is_empty("src") then
|
if not inv:is_empty("src") then
|
||||||
minetest.chat_send_player(player:get_player_name(),
|
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
|
return false
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
@ -51,7 +53,7 @@ minetest.register_abm({
|
|||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
local eu_input = meta:get_int("MV_EU_input")
|
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 machine_node = "technic:tool_workshop"
|
||||||
local demand = 5000
|
local demand = 5000
|
||||||
|
|
||||||
@ -70,15 +72,15 @@ minetest.register_abm({
|
|||||||
srcstack:get_wear() == 0 or
|
srcstack:get_wear() == 0 or
|
||||||
srcstack:get_name() == "technic:water_can" or
|
srcstack:get_name() == "technic:water_can" or
|
||||||
srcstack:get_name() == "technic:lava_can" then
|
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)
|
meta:set_int("MV_EU_demand", 0)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if eu_input < demand then
|
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
|
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)
|
srcstack:add_wear(-1000)
|
||||||
inv:set_stack("src", 1, srcstack)
|
inv:set_stack("src", 1, srcstack)
|
||||||
end
|
end
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
|
local S = technic.getter
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'technic:wind_mill_frame 5',
|
output = 'technic:wind_mill_frame 5',
|
||||||
recipe = {
|
recipe = {
|
||||||
@ -18,7 +20,7 @@ minetest.register_craft({
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("technic:wind_mill_frame", {
|
minetest.register_node("technic:wind_mill_frame", {
|
||||||
description = "Wind Mill Frame",
|
description = S("Wind Mill Frame"),
|
||||||
drawtype = "glasslike_framed",
|
drawtype = "glasslike_framed",
|
||||||
tiles = {"default_steel_block.png", "default_glass.png"},
|
tiles = {"default_steel_block.png", "default_glass.png"},
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
@ -28,7 +30,7 @@ minetest.register_node("technic:wind_mill_frame", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("technic:wind_mill", {
|
minetest.register_node("technic:wind_mill", {
|
||||||
description = "Wind Mill",
|
description = S("Wind Mill"),
|
||||||
tiles = {"default_steel_block.png"},
|
tiles = {"default_steel_block.png"},
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {cracky=1},
|
groups = {cracky=1},
|
||||||
@ -46,7 +48,7 @@ minetest.register_node("technic:wind_mill", {
|
|||||||
},
|
},
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(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)
|
meta:set_int("MV_EU_supply", 0)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
@ -70,17 +72,18 @@ minetest.register_abm({
|
|||||||
chance = 1,
|
chance = 1,
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
local machine_name = S("Wind Mill")
|
||||||
local power = math.min(pos.y * 100, 5000)
|
local power = math.min(pos.y * 100, 5000)
|
||||||
|
|
||||||
if not check_wind_mill(pos) then
|
if not check_wind_mill(pos) then
|
||||||
meta:set_int("MV_EU_supply", 0)
|
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
|
return
|
||||||
else
|
else
|
||||||
meta:set_int("MV_EU_supply", power)
|
meta:set_int("MV_EU_supply", power)
|
||||||
end
|
end
|
||||||
|
|
||||||
meta:set_string("infotext", "Wind Mill ("..power.."EU)")
|
meta:set_string("infotext", machine_name.." ("..power.."EU)")
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
|
||||||
|
local S = technic.getter
|
||||||
|
|
||||||
-- Register alloy recipes
|
-- Register alloy recipes
|
||||||
technic.alloy_recipes = {}
|
technic.alloy_recipes = {}
|
||||||
|
|
||||||
@ -79,7 +82,7 @@ function technic.register_alloy_furnace(data)
|
|||||||
|
|
||||||
local formspec =
|
local formspec =
|
||||||
"invsize[8,10;]"..
|
"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;src;3,1;1,2;]"..
|
||||||
"list[current_name;dst;5,1;2,2;]"..
|
"list[current_name;dst;5,1;2,2;]"..
|
||||||
"list[current_player;main;0,6;8,4;]"
|
"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", {
|
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",
|
tiles = {"technic_"..ltier.."_alloy_furnace_top.png",
|
||||||
"technic_"..ltier.."_alloy_furnace_bottom.png",
|
"technic_"..ltier.."_alloy_furnace_bottom.png",
|
||||||
tube_side_texture,
|
tube_side_texture,
|
||||||
@ -126,7 +129,7 @@ function technic.register_alloy_furnace(data)
|
|||||||
local data = minetest.registered_nodes[name].technic
|
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_string("formspec", data.formspec)
|
||||||
meta:set_int("tube_time", 0)
|
meta:set_int("tube_time", 0)
|
||||||
local inv = meta:get_inventory()
|
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
|
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
|
not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") then
|
||||||
minetest.chat_send_player(player:get_player_name(),
|
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
|
return false
|
||||||
else
|
else
|
||||||
return true
|
return true
|
||||||
@ -150,7 +153,7 @@ function technic.register_alloy_furnace(data)
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("technic:"..ltier.."_alloy_furnace_active",{
|
minetest.register_node("technic:"..ltier.."_alloy_furnace_active",{
|
||||||
description = tier.." Alloy Furnace",
|
description = S(tier.." Alloy Furnace"),
|
||||||
tiles = {"technic_"..ltier.."_alloy_furnace_top.png",
|
tiles = {"technic_"..ltier.."_alloy_furnace_top.png",
|
||||||
"technic_"..ltier.."_alloy_furnace_bottom.png",
|
"technic_"..ltier.."_alloy_furnace_bottom.png",
|
||||||
tube_side_texture,
|
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
|
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
|
not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") then
|
||||||
minetest.chat_send_player(player:get_player_name(),
|
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
|
return false
|
||||||
else
|
else
|
||||||
return true
|
return true
|
||||||
@ -208,7 +211,7 @@ function technic.register_alloy_furnace(data)
|
|||||||
local eu_input = meta:get_int(data.tier.."_EU_input")
|
local eu_input = meta:get_int(data.tier.."_EU_input")
|
||||||
|
|
||||||
-- Machine information
|
-- 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_node = "technic:"..string.lower(data.tier).."_alloy_furnace"
|
||||||
local machine_demand = data.demand
|
local machine_demand = data.demand
|
||||||
|
|
||||||
@ -243,7 +246,7 @@ function technic.register_alloy_furnace(data)
|
|||||||
if not result or
|
if not result or
|
||||||
not inv:room_for_item("dst", result) then
|
not inv:room_for_item("dst", result) then
|
||||||
hacky_swap_node(pos, machine_node)
|
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)
|
meta:set_int(data.tier.."_EU_demand", 0)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -251,11 +254,11 @@ function technic.register_alloy_furnace(data)
|
|||||||
if eu_input < machine_demand[EU_upgrade+1] then
|
if eu_input < machine_demand[EU_upgrade+1] then
|
||||||
-- Unpowered - go idle
|
-- Unpowered - go idle
|
||||||
hacky_swap_node(pos, machine_node)
|
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
|
elseif eu_input >= machine_demand[EU_upgrade+1] then
|
||||||
-- Powered
|
-- Powered
|
||||||
hacky_swap_node(pos, machine_node.."_active")
|
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)
|
meta:set_int("src_time", meta:get_int("src_time") + 1)
|
||||||
if meta:get_int("src_time") == data.cook_time then
|
if meta:get_int("src_time") == data.cook_time then
|
||||||
meta:set_int("src_time", 0)
|
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;]"..
|
"invsize[8,9;]"..
|
||||||
"image[1,1;1,2;technic_power_meter_bg.png]"..
|
"image[1,1;1,2;technic_power_meter_bg.png]"..
|
||||||
"list[current_name;src;3,1;1,1;]"..
|
"list[current_name;src;3,1;1,1;]"..
|
||||||
"image[4,1;1,1;technic_battery_reload.png]"..
|
"image[4,1;1,1;technic_battery_reload.png]"..
|
||||||
"list[current_name;dst;5,1;1,1;]"..
|
"list[current_name;dst;5,1;1,1;]"..
|
||||||
"label[0,0;Battery Box]"..
|
"label[0,0;"..S("%s Battery Box"):format(tier).."]"..
|
||||||
"label[3,0;Charge]"..
|
"label[3,0;"..S("Charge").."]"..
|
||||||
"label[5,0;Discharge]"..
|
"label[5,0;"..S("Discharge").."]"..
|
||||||
"label[1,3;Power level]"..
|
"label[1,3;"..S("Power level").."]"..
|
||||||
"list[current_player;main;0,5;8,4;]"
|
"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
|
for i = 0, 8 do
|
||||||
local groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2}
|
local groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2}
|
||||||
if i ~= 0 then
|
if i ~= 0 then
|
||||||
groups.not_in_creative_inventory = 1
|
groups.not_in_creative_inventory = 1
|
||||||
end
|
end
|
||||||
minetest.register_node("technic:"..ltier.."_battery_box"..i, {
|
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",
|
tiles = {"technic_"..ltier.."_battery_box_top.png",
|
||||||
"technic_"..ltier.."_battery_box_bottom.png",
|
"technic_"..ltier.."_battery_box_bottom.png",
|
||||||
"technic_"..ltier.."_battery_box_side.png^technic_power_meter"..i..".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 node = minetest.get_node(pos)
|
||||||
local data = minetest.registered_nodes[node.name].technic
|
local data = minetest.registered_nodes[node.name].technic
|
||||||
|
|
||||||
meta:set_string("infotext", data.tier.." Battery Box")
|
meta:set_string("infotext", S("%s Battery Box"):format(data.tier))
|
||||||
meta:set_string("formspec", battery_box_formspec)
|
meta:set_string("formspec", data.formspec)
|
||||||
meta:set_int(data.tier.."_EU_demand", 0)
|
meta:set_int(data.tier.."_EU_demand", 0)
|
||||||
meta:set_int(data.tier.."_EU_supply", 0)
|
meta:set_int(data.tier.."_EU_supply", 0)
|
||||||
meta:set_int(data.tier.."_EU_input", 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("src", 1)
|
||||||
inv:set_size("dst", 1)
|
inv:set_size("dst", 1)
|
||||||
end,
|
end,
|
||||||
can_dig = function(pos,player)
|
can_dig = function(pos, player)
|
||||||
local meta = minetest.get_meta(pos);
|
local meta = minetest.get_meta(pos);
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
if not inv:is_empty("src") or not inv:is_empty("dst") then
|
if not inv:is_empty("src") or not inv:is_empty("dst") then
|
||||||
minetest.chat_send_player(player:get_player_name(),
|
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
|
return false
|
||||||
else
|
else
|
||||||
return true
|
return true
|
||||||
@ -115,14 +117,14 @@ function technic.register_battery_box(data)
|
|||||||
|
|
||||||
local charge_percent = math.floor(current_charge / max_charge * 100)
|
local charge_percent = math.floor(current_charge / max_charge * 100)
|
||||||
meta:set_string("formspec",
|
meta:set_string("formspec",
|
||||||
technic.battery_box_formspec..
|
data.formspec..
|
||||||
"image[1,1;1,2;technic_power_meter_bg.png^[lowpart:"
|
"image[1,1;1,2;technic_power_meter_bg.png"
|
||||||
..charge_percent..":technic_power_meter_fg.png]")
|
.."^[lowpart:"..charge_percent
|
||||||
|
..":technic_power_meter_fg.png]")
|
||||||
|
|
||||||
local infotext = data.tier.." battery box: "
|
local infotext = S("%s Battery Box: %d/%d"):format(data.tier, current_charge, max_charge)
|
||||||
..current_charge.."/"..max_charge
|
|
||||||
if eu_input == 0 then
|
if eu_input == 0 then
|
||||||
infotext = infotext.." (idle)"
|
infotext = S("%s Idle"):format(infotext)
|
||||||
end
|
end
|
||||||
meta:set_string("infotext", infotext)
|
meta:set_string("infotext", infotext)
|
||||||
end
|
end
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
|
|
||||||
|
local S = technic.getter
|
||||||
|
|
||||||
technic.cables = {}
|
technic.cables = {}
|
||||||
|
|
||||||
|
|
||||||
function technic.register_cable(tier, size)
|
function technic.register_cable(tier, size)
|
||||||
local ltier = string.lower(tier)
|
local ltier = string.lower(tier)
|
||||||
|
|
||||||
@ -21,7 +22,7 @@ function technic.register_cable(tier, size)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("technic:"..ltier.."_cable"..id, {
|
minetest.register_node("technic:"..ltier.."_cable"..id, {
|
||||||
description = tier.." Cable",
|
description = S("%s Cable"):format(tier),
|
||||||
tiles = {"technic_"..ltier.."_cable.png"},
|
tiles = {"technic_"..ltier.."_cable.png"},
|
||||||
inventory_image = "technic_"..ltier.."_cable_wield.png",
|
inventory_image = "technic_"..ltier.."_cable_wield.png",
|
||||||
wield_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)
|
function technic.register_electric_furnace(data)
|
||||||
local tier = data.tier
|
local tier = data.tier
|
||||||
local ltier = string.lower(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;src;3,1;1,1;]"..
|
||||||
"list[current_name;dst;5,1;2,2;]"..
|
"list[current_name;dst;5,1;2,2;]"..
|
||||||
"list[current_player;main;0,6;8,4;]"..
|
"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
|
if data.upgrade then
|
||||||
formspec = formspec..
|
formspec = formspec..
|
||||||
"list[current_name;upgrade1;1,4;1,1;]"..
|
"list[current_name;upgrade1;1,4;1,1;]"..
|
||||||
@ -36,7 +38,7 @@ function technic.register_electric_furnace(data)
|
|||||||
data.formspec = formspec
|
data.formspec = formspec
|
||||||
|
|
||||||
minetest.register_node("technic:"..ltier.."_electric_furnace", {
|
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",
|
tiles = {"technic_"..ltier.."_electric_furnace_top.png",
|
||||||
"technic_"..ltier.."_electric_furnace_bottom.png",
|
"technic_"..ltier.."_electric_furnace_bottom.png",
|
||||||
tube_side_texture,
|
tube_side_texture,
|
||||||
@ -53,7 +55,7 @@ function technic.register_electric_furnace(data)
|
|||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local name = minetest.get_node(pos).name
|
local name = minetest.get_node(pos).name
|
||||||
local data = minetest.registered_nodes[name].technic
|
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_int("tube_time", 0)
|
||||||
meta:set_string("formspec", data.formspec)
|
meta:set_string("formspec", data.formspec)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
@ -62,13 +64,13 @@ function technic.register_electric_furnace(data)
|
|||||||
inv:set_size("upgrade1", 1)
|
inv:set_size("upgrade1", 1)
|
||||||
inv:set_size("upgrade2", 1)
|
inv:set_size("upgrade2", 1)
|
||||||
end,
|
end,
|
||||||
can_dig = function(pos,player)
|
can_dig = function(pos, player)
|
||||||
local meta = minetest.get_meta(pos);
|
local meta = minetest.get_meta(pos);
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
if not inv:is_empty("src") or not inv:is_empty("dst") or
|
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
|
not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") then
|
||||||
minetest.chat_send_player(player:get_player_name(),
|
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
|
return false
|
||||||
else
|
else
|
||||||
return true
|
return true
|
||||||
@ -95,7 +97,7 @@ function technic.register_electric_furnace(data)
|
|||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local name = minetest.get_node(pos).name
|
local name = minetest.get_node(pos).name
|
||||||
local data = minetest.registered_nodes[name].technic
|
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_int("tube_time", 0)
|
||||||
meta:set_string("formspec", data.formspec)
|
meta:set_string("formspec", data.formspec)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
@ -104,13 +106,13 @@ function technic.register_electric_furnace(data)
|
|||||||
inv:set_size("upgrade1", 1)
|
inv:set_size("upgrade1", 1)
|
||||||
inv:set_size("upgrade2", 1)
|
inv:set_size("upgrade2", 1)
|
||||||
end,
|
end,
|
||||||
can_dig = function(pos,player)
|
can_dig = function(pos, player)
|
||||||
local meta = minetest.get_meta(pos);
|
local meta = minetest.get_meta(pos);
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
if not inv:is_empty("src") or not inv:is_empty("dst") or
|
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
|
not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") then
|
||||||
minetest.chat_send_player(player:get_player_name(),
|
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
|
return false
|
||||||
else
|
else
|
||||||
return true
|
return true
|
||||||
@ -148,7 +150,7 @@ function technic.register_electric_furnace(data)
|
|||||||
local eu_input = meta:get_int(data.tier.."_EU_input")
|
local eu_input = meta:get_int(data.tier.."_EU_input")
|
||||||
|
|
||||||
-- Machine information
|
-- 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_node = "technic:"..string.lower(data.tier).."_electric_furnace"
|
||||||
local machine_demand = data.demand
|
local machine_demand = data.demand
|
||||||
|
|
||||||
@ -172,18 +174,18 @@ function technic.register_electric_furnace(data)
|
|||||||
not inv:room_for_item("dst", result.item) then
|
not inv:room_for_item("dst", result.item) then
|
||||||
meta:set_int(data.tier.."_EU_demand", 0)
|
meta:set_int(data.tier.."_EU_demand", 0)
|
||||||
hacky_swap_node(pos, machine_node)
|
hacky_swap_node(pos, machine_node)
|
||||||
meta:set_string("infotext", machine_name.." Idle")
|
meta:set_string("infotext", S("%s Idle"):format(machine_name))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if eu_input < machine_demand[EU_upgrade+1] then
|
if eu_input < machine_demand[EU_upgrade+1] then
|
||||||
-- Unpowered - go idle
|
-- Unpowered - go idle
|
||||||
hacky_swap_node(pos, machine_node)
|
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
|
elseif eu_input >= machine_demand[EU_upgrade+1] then
|
||||||
-- Powered
|
-- Powered
|
||||||
hacky_swap_node(pos, machine_node.."_active")
|
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)
|
technic.smelt_item(meta, result, data.speed)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -1,16 +1,18 @@
|
|||||||
|
|
||||||
|
local S = technic.getter
|
||||||
|
|
||||||
function technic.register_generator(data)
|
function technic.register_generator(data)
|
||||||
local tier = data.tier
|
local tier = data.tier
|
||||||
local ltier = string.lower(tier)
|
local ltier = string.lower(tier)
|
||||||
|
|
||||||
local generator_formspec =
|
local generator_formspec =
|
||||||
"invsize[8,9;]"..
|
"invsize[8,9;]"..
|
||||||
"label[0,0;Generator]"..
|
"label[0,0;"..S("%s Generator"):format(tier).."]"..
|
||||||
"list[current_name;src;3,1;1,1;]"..
|
"list[current_name;src;3,1;1,1;]"..
|
||||||
"image[4,1;1,1;default_furnace_fire_bg.png]"..
|
"image[4,1;1,1;default_furnace_fire_bg.png]"..
|
||||||
"list[current_player;main;0,5;8,4;]"
|
"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", {
|
minetest.register_node("technic:"..ltier.."_generator", {
|
||||||
description = desc,
|
description = desc,
|
||||||
tiles = {"technic_"..ltier.."_generator_top.png", "technic_machine_bottom.png",
|
tiles = {"technic_"..ltier.."_generator_top.png", "technic_machine_bottom.png",
|
||||||
@ -34,7 +36,7 @@ function technic.register_generator(data)
|
|||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
if not inv:is_empty("src") then
|
if not inv:is_empty("src") then
|
||||||
minetest.chat_send_player(player:get_player_name(),
|
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
|
return false
|
||||||
else
|
else
|
||||||
return true
|
return true
|
||||||
@ -57,7 +59,7 @@ function technic.register_generator(data)
|
|||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
if not inv:is_empty("src") then
|
if not inv:is_empty("src") then
|
||||||
minetest.chat_send_player(player:get_player_name(),
|
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
|
return false
|
||||||
else
|
else
|
||||||
return true
|
return true
|
||||||
@ -85,7 +87,7 @@ function technic.register_generator(data)
|
|||||||
local fuellist = inv:get_list("src")
|
local fuellist = inv:get_list("src")
|
||||||
fuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
|
fuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
|
||||||
if not fuel or fuel.time == 0 then
|
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")
|
hacky_swap_node(pos, "technic:"..ltier.."_generator")
|
||||||
return
|
return
|
||||||
end
|
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)
|
||||||
technic.register_machine(data.tier, "technic:"..ltier.."_generator", technic.producer)
|
technic.register_machine(data.tier, "technic:"..ltier.."_generator", technic.producer)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
|
local S = technic.getter
|
||||||
|
|
||||||
function technic.register_grinder(data)
|
function technic.register_grinder(data)
|
||||||
local tier = data.tier
|
local tier = data.tier
|
||||||
local ltier = string.lower(tier)
|
local ltier = string.lower(tier)
|
||||||
@ -31,7 +33,7 @@ function technic.register_grinder(data)
|
|||||||
data.formspec = formspec
|
data.formspec = formspec
|
||||||
|
|
||||||
minetest.register_node("technic:"..ltier.."_grinder", {
|
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",
|
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_side.png",
|
||||||
"technic_"..ltier.."_grinder_side.png", "technic_"..ltier.."_grinder_front.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 node = minetest.get_node(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local data = minetest.registered_nodes[node.name].technic
|
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_int("tube_time", 0)
|
||||||
meta:set_string("formspec", data.formspec)
|
meta:set_string("formspec", data.formspec)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
@ -55,12 +57,12 @@ function technic.register_grinder(data)
|
|||||||
inv:set_size("upgrade2", 1)
|
inv:set_size("upgrade2", 1)
|
||||||
end,
|
end,
|
||||||
can_dig = function(pos,player)
|
can_dig = function(pos,player)
|
||||||
local meta = minetest.get_meta(pos);
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
if not inv:is_empty("src") or not inv:is_empty("dst") or
|
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
|
not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") then
|
||||||
minetest.chat_send_player(player:get_player_name(),
|
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
|
return false
|
||||||
else
|
else
|
||||||
return true
|
return true
|
||||||
@ -69,7 +71,7 @@ function technic.register_grinder(data)
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("technic:"..ltier.."_grinder_active",{
|
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",
|
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_side.png",
|
||||||
"technic_"..ltier.."_grinder_side.png", "technic_"..ltier.."_grinder_front_active.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
|
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
|
not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") then
|
||||||
minetest.chat_send_player(player:get_player_name(),
|
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
|
return false
|
||||||
else
|
else
|
||||||
return true
|
return true
|
||||||
@ -121,7 +123,7 @@ function technic.register_grinder(data)
|
|||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
local eu_input = meta:get_int(data.tier.."_EU_input")
|
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_node = "technic:"..string.lower(data.tier).."_grinder"
|
||||||
local machine_demand = data.demand
|
local machine_demand = data.demand
|
||||||
|
|
||||||
@ -147,7 +149,7 @@ function technic.register_grinder(data)
|
|||||||
|
|
||||||
if not result then
|
if not result then
|
||||||
hacky_swap_node(pos, machine_node)
|
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)
|
meta:set_int(data.tier.."_EU_demand", 0)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -155,11 +157,11 @@ function technic.register_grinder(data)
|
|||||||
if eu_input < machine_demand[EU_upgrade+1] then
|
if eu_input < machine_demand[EU_upgrade+1] then
|
||||||
-- Unpowered - go idle
|
-- Unpowered - go idle
|
||||||
hacky_swap_node(pos, machine_node)
|
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
|
elseif eu_input >= machine_demand[EU_upgrade+1] then
|
||||||
-- Powered
|
-- Powered
|
||||||
hacky_swap_node(pos, machine_node.."_active")
|
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)
|
meta:set_int("src_time", meta:get_int("src_time") + 1)
|
||||||
if meta:get_int("src_time") >= result.time / data.speed then
|
if meta:get_int("src_time") >= result.time / data.speed then
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
|
local S = technic.getter
|
||||||
|
|
||||||
technic.grinder_recipes = {}
|
technic.grinder_recipes = {}
|
||||||
|
|
||||||
function technic.register_grinder_recipe(data)
|
function technic.register_grinder_recipe(data)
|
||||||
@ -63,7 +65,7 @@ local function register_dust(name, ingot)
|
|||||||
local lname = string.lower(name)
|
local lname = string.lower(name)
|
||||||
lname = string.gsub(lname, ' ', '_')
|
lname = string.gsub(lname, ' ', '_')
|
||||||
minetest.register_craftitem("technic:"..lname.."_dust", {
|
minetest.register_craftitem("technic:"..lname.."_dust", {
|
||||||
description = name.." Dust",
|
description = S("%s Dust"):format(name),
|
||||||
inventory_image = "technic_"..lname.."_dust.png",
|
inventory_image = "technic_"..lname.."_dust.png",
|
||||||
on_place_on_ground = minetest.craftitem_place_item,
|
on_place_on_ground = minetest.craftitem_place_item,
|
||||||
})
|
})
|
||||||
@ -77,24 +79,26 @@ local function register_dust(name, ingot)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Sorted alphibeticaly
|
-- Sorted alphibeticaly
|
||||||
register_dust("Akalin", "glooptest:akalin_ingot")
|
register_dust(S("Akalin"), "glooptest:akalin_ingot")
|
||||||
register_dust("Alatro", "glooptest:alatro_ingot")
|
register_dust(S("Alatro"), "glooptest:alatro_ingot")
|
||||||
register_dust("Arol", "glooptest:arol_ingot")
|
register_dust(S("Arol"), "glooptest:arol_ingot")
|
||||||
register_dust("Brass", "technic:brass_ingot")
|
register_dust(S("Brass"), "technic:brass_ingot")
|
||||||
register_dust("Bronze", "default:bronze_ingot")
|
register_dust(S("Bronze"), "default:bronze_ingot")
|
||||||
register_dust("Chromium", "technic:chromium_ingot")
|
register_dust(S("Chromium"), "technic:chromium_ingot")
|
||||||
register_dust("Coal", nil)
|
register_dust(S("Coal"), nil)
|
||||||
register_dust("Copper", "default:copper_ingot")
|
register_dust(S("Copper"), "default:copper_ingot")
|
||||||
register_dust("Gold", "default:gold_ingot")
|
register_dust(S("Gold"), "default:gold_ingot")
|
||||||
register_dust("Iron", "default:steel_ingot")
|
register_dust(S("Iron"), "default:steel_ingot")
|
||||||
register_dust("Mithril", "moreores:mithril_ingot")
|
register_dust(S("Mithril"), "moreores:mithril_ingot")
|
||||||
register_dust("Silver", "moreores:silver_ingot")
|
register_dust(S("Silver"), "moreores:silver_ingot")
|
||||||
register_dust("Stainless Steel", "technic:stainless_steel_ingot")
|
register_dust(S("Stainless Steel"), "technic:stainless_steel_ingot")
|
||||||
register_dust("Talinite", "glooptest:talinite_ingot")
|
register_dust(S("Talinite"), "glooptest:talinite_ingot")
|
||||||
register_dust("Tin", "moreores:tin_ingot")
|
register_dust(S("Tin"), "moreores:tin_ingot")
|
||||||
register_dust("Zinc", "technic:zinc_ingot")
|
register_dust(S("Zinc"), "technic:zinc_ingot")
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "technic:coal_dust",
|
recipe = "technic:coal_dust",
|
||||||
burntime = 50,
|
burntime = 50,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1,14 +1,17 @@
|
|||||||
|
|
||||||
|
local S = technic.getter
|
||||||
|
|
||||||
function technic.register_solar_array(data)
|
function technic.register_solar_array(data)
|
||||||
local tier = data.tier
|
local tier = data.tier
|
||||||
local ltier = string.lower(tier)
|
local ltier = string.lower(tier)
|
||||||
|
|
||||||
minetest.register_node("technic:solar_array_"..ltier, {
|
minetest.register_node("technic:solar_array_"..ltier, {
|
||||||
tiles = {"technic_"..ltier.."_solar_array_top.png", "technic_"..ltier.."_solar_array_bottom.png",
|
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",
|
||||||
"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},
|
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
description = tier.." Solar Array",
|
description = S("%s Solar Array"):format(tier),
|
||||||
active = false,
|
active = false,
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
paramtype = "light",
|
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
|
-- To take care of some of it solar panels do not work outside daylight hours or if
|
||||||
-- built below -10m
|
-- built below -10m
|
||||||
local pos1 = {}
|
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.y = pos.y + 1
|
||||||
pos1.x = pos.x
|
pos1.x = pos.x
|
||||||
pos1.z = pos.z
|
pos1.z = pos.z
|
||||||
@ -46,7 +51,6 @@ function technic.register_solar_array(data)
|
|||||||
local time_of_day = minetest.get_timeofday()
|
local time_of_day = minetest.get_timeofday()
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
light = light or 0
|
light = light or 0
|
||||||
local data = minetest.registered_nodes[node.name].technic
|
|
||||||
|
|
||||||
|
|
||||||
-- turn on array only during day time and if sufficient light
|
-- 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)
|
local charge_to_give = math.floor((light + pos.y) * data.power)
|
||||||
charge_to_give = math.max(charge_to_give, 0)
|
charge_to_give = math.max(charge_to_give, 0)
|
||||||
charge_to_give = math.min(charge_to_give, data.power * 50)
|
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)
|
meta:set_int(data.tier.."_EU_supply", charge_to_give)
|
||||||
else
|
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)
|
meta:set_int(data.tier.."_EU_supply", 0)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
@ -7,8 +7,10 @@
|
|||||||
-- Once the receiver side is powered it will deliver power to the other side.
|
-- Once the receiver side is powered it will deliver power to the other side.
|
||||||
-- Unused power is wasted just like any other producer!
|
-- Unused power is wasted just like any other producer!
|
||||||
|
|
||||||
|
local S = technic.getter
|
||||||
|
|
||||||
minetest.register_node("technic:supply_converter", {
|
minetest.register_node("technic:supply_converter", {
|
||||||
description = "Supply Converter",
|
description = S("Supply Converter"),
|
||||||
tiles = {"technic_supply_converter_top.png", "technic_supply_converter_bottom.png",
|
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",
|
||||||
"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)
|
on_construct = function(pos)
|
||||||
local meta = minetest.env:get_meta(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)
|
meta:set_float("active", false)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
@ -44,7 +46,7 @@ minetest.register_abm({
|
|||||||
local demand = 10000
|
local demand = 10000
|
||||||
local remain = 0.9
|
local remain = 0.9
|
||||||
-- Machine information
|
-- Machine information
|
||||||
local machine_name = "Supply Converter"
|
local machine_name = S("Supply Converter")
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
|
||||||
local pos_up = {x=pos.x, y=pos.y+1, z=pos.z}
|
local pos_up = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||||
@ -66,7 +68,7 @@ minetest.register_abm({
|
|||||||
.." ("..input.." "..from.." -> "
|
.." ("..input.." "..from.." -> "
|
||||||
..input * remain.." "..to..")")
|
..input * remain.." "..to..")")
|
||||||
else
|
else
|
||||||
meta:set_string("infotext", machine_name.." has bad cabling")
|
meta:set_string("infotext", S("%s Has Bad Cabling"):format(machine_name))
|
||||||
return
|
return
|
||||||
end
|
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.
|
-- 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.
|
-- This way the supplies are separated per network.
|
||||||
technic.DBG = 1
|
|
||||||
local dprint = technic.dprint
|
|
||||||
|
|
||||||
technic.networks = {}
|
technic.networks = {}
|
||||||
|
|
||||||
|
local S = technic.getter
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "technic:switching_station",
|
output = "technic:switching_station",
|
||||||
recipe = {
|
recipe = {
|
||||||
@ -42,7 +42,7 @@ minetest.register_craft({
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("technic:switching_station",{
|
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",
|
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",
|
||||||
"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)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("infotext", "Switching Station")
|
meta:set_string("infotext", S("Switching Station"))
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -179,6 +179,7 @@ minetest.register_abm({
|
|||||||
local PR_nodes
|
local PR_nodes
|
||||||
local BA_nodes
|
local BA_nodes
|
||||||
local RE_nodes
|
local RE_nodes
|
||||||
|
local machine_name = S("Switching Station")
|
||||||
|
|
||||||
-- Which kind of network are we on:
|
-- Which kind of network are we on:
|
||||||
pos1 = {x=pos.x, y=pos.y-1, z=pos.z}
|
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)
|
PR_nodes, BA_nodes, RE_nodes = get_network(pos1, tier)
|
||||||
else
|
else
|
||||||
--dprint("Not connected to a network")
|
--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
|
return
|
||||||
end
|
end
|
||||||
--dprint("nodes="..table.getn(all_nodes)
|
--dprint("nodes="..table.getn(all_nodes)
|
||||||
@ -235,8 +236,8 @@ minetest.register_abm({
|
|||||||
--dprint("Total BA demand:"..BA_eu_demand)
|
--dprint("Total BA demand:"..BA_eu_demand)
|
||||||
|
|
||||||
meta:set_string("infotext",
|
meta:set_string("infotext",
|
||||||
"Switching Station. Supply: "..PR_eu_supply
|
S("%s. Supply: %d Demand: %d"):format(
|
||||||
.." Demand: "..RE_eu_demand)
|
machine_name, PR_eu_supply, RE_eu_demand))
|
||||||
|
|
||||||
-- If the PR supply is enough for the RE demand supply them all
|
-- If the PR supply is enough for the RE demand supply them all
|
||||||
if PR_eu_supply >= RE_eu_demand then
|
if PR_eu_supply >= RE_eu_demand then
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
local water_can_max_load = 16
|
local water_can_max_load = 16
|
||||||
local lava_can_max_load = 8
|
local lava_can_max_load = 8
|
||||||
|
|
||||||
|
local S = technic.getter
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'technic:water_can 1',
|
output = 'technic:water_can 1',
|
||||||
recipe = {
|
recipe = {
|
||||||
@ -21,7 +23,7 @@ minetest.register_craft({
|
|||||||
|
|
||||||
|
|
||||||
minetest.register_tool("technic:water_can", {
|
minetest.register_tool("technic:water_can", {
|
||||||
description = "Water Can",
|
description = S("Water Can"),
|
||||||
inventory_image = "technic_water_can.png",
|
inventory_image = "technic_water_can.png",
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
liquids_pointable = true,
|
liquids_pointable = true,
|
||||||
@ -70,7 +72,7 @@ minetest.register_tool("technic:water_can", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_tool("technic:lava_can", {
|
minetest.register_tool("technic:lava_can", {
|
||||||
description = "Lava Can",
|
description = S("Lava Can"),
|
||||||
inventory_image = "technic_lava_can.png",
|
inventory_image = "technic_lava_can.png",
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
liquids_pointable = true,
|
liquids_pointable = true,
|
||||||
@ -117,3 +119,4 @@ minetest.register_tool("technic:lava_can", {
|
|||||||
end
|
end
|
||||||
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_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 chainsaw_leaves = true -- true - Cut down entire trees, leaves and all
|
||||||
|
|
||||||
|
local S = technic.getter
|
||||||
|
|
||||||
technic.register_power_tool("technic:chainsaw", chainsaw_max_charge)
|
technic.register_power_tool("technic:chainsaw", chainsaw_max_charge)
|
||||||
|
|
||||||
minetest.register_tool("technic:chainsaw", {
|
minetest.register_tool("technic:chainsaw", {
|
||||||
description = "Chainsaw",
|
description = S("Chainsaw"),
|
||||||
inventory_image = "technic_chainsaw.png",
|
inventory_image = "technic_chainsaw.png",
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
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
|
-- original code comes from walkin_light mod by Echo http://minetest.net/forum/viewtopic.php?id=2621
|
||||||
|
|
||||||
local flashlight_max_charge = 30000
|
local flashlight_max_charge = 30000
|
||||||
|
|
||||||
|
local S = technic.getter
|
||||||
|
|
||||||
technic.register_power_tool("technic:flashlight", flashlight_max_charge)
|
technic.register_power_tool("technic:flashlight", flashlight_max_charge)
|
||||||
|
|
||||||
minetest.register_tool("technic:flashlight", {
|
minetest.register_tool("technic:flashlight", {
|
||||||
description = "Flashlight",
|
description = S("Flashlight"),
|
||||||
inventory_image = "technic_flashlight.png",
|
inventory_image = "technic_flashlight.png",
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "technic:flashlight",
|
output = "technic:flashlight",
|
||||||
@ -163,3 +166,4 @@ function check_for_flashlight(player)
|
|||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -5,6 +5,8 @@ local mining_drill_power_usage = 200
|
|||||||
local mining_drill_mk2_power_usage = 600
|
local mining_drill_mk2_power_usage = 600
|
||||||
local mining_drill_mk3_power_usage = 1800
|
local mining_drill_mk3_power_usage = 1800
|
||||||
|
|
||||||
|
local S = technic.getter
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'technic:mining_drill',
|
output = 'technic:mining_drill',
|
||||||
recipe = {
|
recipe = {
|
||||||
@ -220,7 +222,7 @@ end
|
|||||||
|
|
||||||
technic.register_power_tool("technic:mining_drill", mining_drill_max_charge)
|
technic.register_power_tool("technic:mining_drill", mining_drill_max_charge)
|
||||||
minetest.register_tool("technic:mining_drill", {
|
minetest.register_tool("technic:mining_drill", {
|
||||||
description = "Mining Drill Mk1",
|
description = S("Mining Drill Mk1"),
|
||||||
inventory_image = "technic_mining_drill.png",
|
inventory_image = "technic_mining_drill.png",
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
@ -243,7 +245,7 @@ minetest.register_tool("technic:mining_drill", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_tool("technic:mining_drill_mk2", {
|
minetest.register_tool("technic:mining_drill_mk2", {
|
||||||
description = "Mining Drill Mk2",
|
description = S("Mining Drill Mk2"),
|
||||||
inventory_image = "technic_mining_drill_mk2.png",
|
inventory_image = "technic_mining_drill_mk2.png",
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
mining_drill_mk2_handler(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
|
for i = 1, 4 do
|
||||||
technic.register_power_tool("technic:mining_drill_mk2_"..i, mining_drill_mk2_max_charge)
|
technic.register_power_tool("technic:mining_drill_mk2_"..i, mining_drill_mk2_max_charge)
|
||||||
minetest.register_tool("technic:mining_drill_mk2_"..i, {
|
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",
|
inventory_image = "technic_mining_drill_mk2.png^technic_tool_mode"..i..".png",
|
||||||
wield_image = "technic_mining_drill_mk2.png",
|
wield_image = "technic_mining_drill_mk2.png",
|
||||||
groups = {not_in_creative_inventory=1},
|
groups = {not_in_creative_inventory=1},
|
||||||
@ -268,7 +270,7 @@ for i = 1, 4 do
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_tool("technic:mining_drill_mk3", {
|
minetest.register_tool("technic:mining_drill_mk3", {
|
||||||
description = "Mining Drill Mk3",
|
description = S("Mining Drill Mk3"),
|
||||||
inventory_image = "technic_mining_drill_mk3.png",
|
inventory_image = "technic_mining_drill_mk3.png",
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
mining_drill_mk3_handler(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
|
for i=1,5,1 do
|
||||||
technic.register_power_tool("technic:mining_drill_mk3_"..i, mining_drill_mk3_max_charge)
|
technic.register_power_tool("technic:mining_drill_mk3_"..i, mining_drill_mk3_max_charge)
|
||||||
minetest.register_tool("technic:mining_drill_mk3_"..i, {
|
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",
|
inventory_image = "technic_mining_drill_mk3.png^technic_tool_mode"..i..".png",
|
||||||
wield_image = "technic_mining_drill_mk3.png",
|
wield_image = "technic_mining_drill_mk3.png",
|
||||||
groups = {not_in_creative_inventory=1},
|
groups = {not_in_creative_inventory=1},
|
||||||
@ -335,11 +337,11 @@ function mining_drill_mk3_handler(itemstack, user, pointed_thing)
|
|||||||
end
|
end
|
||||||
|
|
||||||
mining_drill_mode_text = {
|
mining_drill_mode_text = {
|
||||||
{"Single node."},
|
{S("Single node.")},
|
||||||
{"3 nodes deep."},
|
{S("3 nodes deep.")},
|
||||||
{"3 modes wide."},
|
{S("3 nodes wide.")},
|
||||||
{"3 modes tall."},
|
{S("3 nodes tall.")},
|
||||||
{"3x3 nodes."},
|
{S("3x3 nodes.")},
|
||||||
}
|
}
|
||||||
|
|
||||||
function mining_drill_mk2_setmode(user,itemstack)
|
function mining_drill_mk2_setmode(user,itemstack)
|
||||||
@ -351,14 +353,14 @@ function mining_drill_mk2_setmode(user,itemstack)
|
|||||||
mode=0
|
mode=0
|
||||||
end
|
end
|
||||||
if meta["mode"]==nil then
|
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
|
meta["mode"]=0
|
||||||
mode=0
|
mode=0
|
||||||
end
|
end
|
||||||
mode=(meta["mode"])
|
mode=(meta["mode"])
|
||||||
mode=mode+1
|
mode=mode+1
|
||||||
if mode>=5 then mode=1 end
|
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
|
item["name"]="technic:mining_drill_mk2_"..mode
|
||||||
meta["mode"]=mode
|
meta["mode"]=mode
|
||||||
item["metadata"]=set_item_meta(meta)
|
item["metadata"]=set_item_meta(meta)
|
||||||
@ -375,14 +377,14 @@ function mining_drill_mk3_setmode(user,itemstack)
|
|||||||
mode=0
|
mode=0
|
||||||
end
|
end
|
||||||
if meta["mode"]==nil then
|
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
|
meta["mode"]=0
|
||||||
mode=0
|
mode=0
|
||||||
end
|
end
|
||||||
mode=(meta["mode"])
|
mode=(meta["mode"])
|
||||||
mode=mode+1
|
mode=mode+1
|
||||||
if mode>=6 then mode=1 end
|
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
|
item["name"]="technic:mining_drill_mk3_"..mode
|
||||||
meta["mode"]=mode
|
meta["mode"]=mode
|
||||||
item["metadata"]=set_item_meta(meta)
|
item["metadata"]=set_item_meta(meta)
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
local sonic_screwdriver_max_charge = 15000
|
local sonic_screwdriver_max_charge = 15000
|
||||||
|
|
||||||
|
local S = technic.getter
|
||||||
|
|
||||||
technic.register_power_tool("technic:sonic_screwdriver", sonic_screwdriver_max_charge)
|
technic.register_power_tool("technic:sonic_screwdriver", sonic_screwdriver_max_charge)
|
||||||
|
|
||||||
minetest.register_tool("technic:sonic_screwdriver", {
|
minetest.register_tool("technic:sonic_screwdriver", {
|
||||||
description = "Sonic Screwdriver",
|
description = S("Sonic Screwdriver"),
|
||||||
inventory_image = "technic_sonic_screwdriver.png",
|
inventory_image = "technic_sonic_screwdriver.png",
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
-- Must be pointing to facedir applicable node
|
-- Must be pointing to facedir applicable node
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
|
|
||||||
|
local S = technic.getter
|
||||||
|
|
||||||
minetest.register_tool("technic:treetap", {
|
minetest.register_tool("technic:treetap", {
|
||||||
description = "Tree Tap",
|
description = S("Tree Tap"),
|
||||||
inventory_image = "technic_tree_tap.png",
|
inventory_image = "technic_tree_tap.png",
|
||||||
on_use = function(itemstack,user,pointed_thing)
|
on_use = function(itemstack,user,pointed_thing)
|
||||||
if pointed_thing.type ~= "node" then
|
if pointed_thing.type ~= "node" then
|
||||||
@ -41,7 +44,7 @@ minetest.register_craft({
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("technic:raw_latex", {
|
minetest.register_craftitem("technic:raw_latex", {
|
||||||
description = "Raw Latex",
|
description = S("Raw Latex"),
|
||||||
inventory_image = "technic_raw_latex.png",
|
inventory_image = "technic_raw_latex.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -52,7 +55,7 @@ minetest.register_craft({
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("technic:rubber", {
|
minetest.register_craftitem("technic:rubber", {
|
||||||
description = "Rubber Fiber",
|
description = S("Rubber Fiber"),
|
||||||
inventory_image = "technic_rubber.png",
|
inventory_image = "technic_rubber.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user