update descriptions, update some formspecs to v4, update template
grinder: dust alpha variation
keypad: add beamed eighth notes button
machines_configuration: support for the new button
technic_power: the lost texture of the battery (https://forum.minetest.net/viewtopic.php?p=321100&sid=799f03e59259ee730d0aa596bdc5f883#p321100)
This commit is contained in:
мтест 2022-12-07 16:29:17 +01:00 committed by waxtatect
parent c05dc50982
commit 0f984a45fc
16 changed files with 195 additions and 120 deletions

View File

@ -316,7 +316,7 @@ end
bounce_materialslist = table.concat(bounce_materialslist, "\n")
minetest.register_node("basic_machines:ball_spawner", {
description = S("Spawns energy ball"),
description = S("Ball Spawner"),
groups = {cracky = 3, oddly_breakable_by_hand = 1},
drawtype = "allfaces",
tiles = {"basic_machines_ball.png"},
@ -465,7 +465,8 @@ minetest.register_node("basic_machines:ball_spawner", {
elseif fields.help then
local lifetime = minetest.get_meta(pos):get_int("admin") == 1 and S("\nLifetime: [1, +∞[") or ""
minetest.show_formspec(name, "basic_machines:help_ball",
"size[6,7]textarea[0,0;6.5,8.5;help;" .. F(S("BALL SPAWNER CAPABILITIES")) .. ";" .. F(S([[
"formspec_version[4]size[8,9.3]textarea[0,0.35;8,8.95;help;" .. F(S("BALL SPAWNER CAPABILITIES")) .. ";" ..
F(S([[
VALUES
Target*: Direction of velocity
@ -690,7 +691,7 @@ end)
-- ball as magic spell user can cast
minetest.register_tool("basic_machines:ball_spell", {
description = S("Ball Spawner"),
description = S("Ball Spell"),
groups = {not_in_creative_inventory = 1},
inventory_image = "basic_machines_ball.png",
light_source = 10,

View File

@ -29,7 +29,7 @@ minetest.register_abm({
})
minetest.register_node("basic_machines:clockgen", {
description = S("Clock Generator - use sparingly, continually activates top block"),
description = S("Clock Generator"),
groups = {cracky = 3},
tiles = {"basic_machines_clock_generator.png"},
sounds = default.node_sound_wood_defaults(),

View File

@ -182,7 +182,7 @@ end
-- CONSTRUCTOR
local def = {
description = "Constructor: used to make machines",
description = "Constructor",
recipe = {
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
{"default:steel_ingot", "default:copperblock", "default:steel_ingot"},
@ -203,7 +203,7 @@ local def = {
["Battery"] = {
item = "basic_machines:battery_0",
description = "Power for machines",
description = "Store energy, can power nearby machines",
craft = {"default:bronzeblock 2", "default:mese", "default:diamond"}
},
@ -221,7 +221,7 @@ local def = {
["Detector"] = {
item = "basic_machines:detector",
description = "Detect and measure players, objects, blocks, light level",
description = "Detect block, player, object, light level...",
craft = {"default:mese_crystal 4", "basic_machines:keypad"}
},
@ -231,7 +231,7 @@ local def = {
craft = {"default:steel_ingot", "default:mese_crystal", "basic_machines:keypad"}
},
["Environment"] = {
["Environment Changer"] = {
item = "basic_machines:enviro",
description = "Change gravity and more",
craft = {"basic_machines:generator 8", "basic_machines:clockgen"}
@ -245,13 +245,13 @@ local def = {
["Grinder"] = {
item = "basic_machines:grinder",
description = "Makes dusts and grinds materials",
description = "Make dusts and grind materials",
craft = {"default:diamond 13", "default:mese 4"}
},
["Keypad"] = {
item = "basic_machines:keypad",
description = "Turns on/off lights and activates machines or opens doors",
description = "Activate machines by sending signal",
craft = {"default:wood", "default:stick"}
},
@ -263,19 +263,19 @@ local def = {
["Mover"] = {
item = "basic_machines:mover",
description = "Can dig, harvest, plant, teleport or move items from/in inventories",
description = "Universal digging, harvesting, teleporting, transporting machine",
craft = {"default:mese_crystal 6", "default:stone 2", "basic_machines:keypad"}
},
["Power Block"] = {
item = "basic_machines:power_block 5",
description = "Energy cell, contains 11 energy units",
description = "Energy block",
craft = {"basic_machines:power_rod"}
},
["Power Cell"] = {
item = "basic_machines:power_cell 5",
description = "Energy cell, contains 1 energy unit",
description = "Energy cell",
craft = {"basic_machines:power_block"}
},
@ -298,7 +298,7 @@ local def = {
"Recycler",
"Autocrafter",
"Ball Spawner",
"Environment",
"Environment Changer",
"Power Block",
"Power Cell",
"Coal Lump"

View File

@ -12,7 +12,7 @@ end
detector_modelist_translated = table.concat(detector_modelist_translated, ",")
minetest.register_node("basic_machines:detector", {
description = S("Detector - can detect blocks/players/objects and activate machines"),
description = S("Detector"),
groups = {cracky = 3},
tiles = {"basic_machines_detector.png"},
sounds = default.node_sound_wood_defaults(),
@ -246,11 +246,11 @@ minetest.register_node("basic_machines:detector", {
local state = meta:get_int("state")
-- -2: only false, -1: NOT, 0: no signal, 1: normal signal: 2: only true, 3: only if change
if NOT ~= 1 then -- else, just go on normally
if NOT == -1 then trigger = not trigger -- NEGATION
if NOT ~= 1 and NOT ~= 4 then -- else, just go on normally
if NOT == 2 and not trigger then meta:set_string("infotext", ""); return -- ONLY TRUE
elseif NOT == -2 and trigger then meta:set_string("infotext", ""); return -- ONLY FALSE
elseif NOT == -1 then trigger = not trigger -- NEGATION
elseif NOT == 0 then meta:set_string("infotext", ""); return -- do nothing
elseif NOT == 2 and not trigger then meta:set_string("infotext", ""); return -- ONLY TRUE
elseif NOT == 3 and ((trigger and state == 1) or (not trigger and state == 0)) then
meta:set_string("infotext", ""); return -- no change of state
end

View File

@ -52,7 +52,7 @@ basic_machines.get_distributor_form = function(pos)
end
minetest.register_node("basic_machines:distributor", {
description = S("Distributor - can forward signal up to 16 different targets"),
description = S("Distributor"),
groups = {cracky = 3},
tiles = {"basic_machines_distributor.png"},
sounds = default.node_sound_wood_defaults(),

View File

@ -92,7 +92,7 @@ end
-- environment changer
minetest.register_node("basic_machines:enviro", {
description = S("Changes environment for players around target location"),
description = S("Environment Changer"),
groups = {cracky = 3},
tiles = {"basic_machines_enviro.png"},
drawtype = "allfaces",
@ -176,7 +176,8 @@ minetest.register_node("basic_machines:enviro", {
elseif fields.help then
minetest.show_formspec(name, "basic_machines:help_enviro",
"size[6,7]textarea[0,0;6.5,8.5;help;" .. F(S("ENVIRONMENT MODIFICATIONS")) .. ";" .. F(S([[
"formspec_version[4]size[7.4,7.4]textarea[0,0.35;7.4,7.05;help;" .. F(S("ENVIRONMENT MODIFICATIONS")) .. ";" ..
F(S([[
VALUES
Target: Center position of the area to apply environment effects

View File

@ -145,11 +145,9 @@ if basic_machines.settings.grinder_register_dusts then
for i, purity in ipairs(purity_table) do
minetest.register_craftitem(dust .. purity, {
description = S(name:gsub("^%l", string.upper) .. " dust purity @1% " ..
(purity == "00" and "(combine with chemicals to create " .. name .. " extractor)" or
"(smelt to increase purity)"), purity),
description = S(name:gsub("^%l", string.upper) .. " Dust (purity @1%)", purity),
groups = {dust = 1},
inventory_image = "basic_machines_dust.png^[colorize:#" .. hex .. ":180",
inventory_image = "basic_machines_dust.png^[colorize:#" .. hex .. ":" .. (114 + purity),
light_source = light_source and light_source[i]
})
if have_ui_categories then
@ -200,7 +198,7 @@ if basic_machines.settings.grinder_register_dusts then
local item = "basic_machines:" .. name .. "_extractor"
minetest.register_craftitem(item, {
description = S("Smelt to get " .. name),
description = S(name:gsub("^%l", string.upper) .. " Extractor"),
groups = {extractor = 1},
inventory_image = "basic_machines_ore_extractor.png^[colorize:#" .. hex .. ":180"
})
@ -408,7 +406,7 @@ minetest.register_node("basic_machines:grinder", {
grinder_recipes_help = F(table.concat(grinder_recipes_translated, "\n"))
end
minetest.show_formspec(sender:get_player_name(), "basic_machines:help_grinder",
"size[6,7]textarea[0,0;6.5,8.5;help;" .. F(S("GRINDER HELP")) .. ";" ..
"formspec_version[4]size[8,9.3]textarea[0,0.35;8,8.95;help;" .. F(S("GRINDER HELP")) .. ";" ..
F(S("To upgrade grinder, put grinders in upgrade slot." ..
" Each upgrade adds ability to process additional materials.\n\n")) .. grinder_recipes_help .. "]")
end

View File

@ -228,7 +228,7 @@ basic_machines.use_keypad = function(pos, ttl, reset, reset_msg)
end
minetest.register_node("basic_machines:keypad", {
description = S("Keypad - basic way to activate machines by sending signal"),
description = S("Keypad"),
groups = {cracky = 3},
tiles = {"basic_machines_keypad.png"},
sounds = default.node_sound_wood_defaults(),
@ -253,16 +253,17 @@ minetest.register_node("basic_machines:keypad", {
local x0, y0, z0 = meta:get_int("x0"), meta:get_int("y0"), meta:get_int("z0")
machines.mark_pos1(name, vector.add(pos, {x = x0, y = y0, z = z0})) -- mark pos1
minetest.show_formspec(name, "basic_machines:keypad_" .. minetest.pos_to_string(pos), "size[4.25,3.75]" ..
-- "no_prepend[]bgcolor[#888888BB;false]" ..
"field[1.25,0.25;1,1;iter;" .. F(S("Repeat")) .. ";" .. meta:get_int("iter") ..
"]field[0.25,0.25;1,1;mode;" .. F(S("Mode")) .. ";" .. meta:get_int("mode") ..
"]field[2.25,0.25;2.25,1;pass;" .. F(S("Password")) .. ";" .. meta:get_string("pass") ..
"]label[0,0.75;" .. minetest.colorize("lawngreen", F(S("MODE: 1=OFF, 2=ON, 3=TOGGLE"))) ..
"]field[0.25,2.5;3.25,1;text;" .. F(S("Text")) .. ";" .. F(meta:get_string("text")) ..
"]button_exit[3.25,2.2;1,1;OK;" .. F(S("OK")) .. "]field[0.25,3.5;1,1;x0;" .. F(S("Target")) .. ";" .. x0 ..
"]field[1.25,3.5;1,1;y0;;" .. y0 .. "]field[2.25,3.5;1,1;z0;;" .. z0 .. "]button[3.25,3.2;1,1;help;" ..
F(S("help")) .. "]")
minetest.show_formspec(name, "basic_machines:keypad_" .. minetest.pos_to_string(pos),
"formspec_version[4]size[6,5.3]no_prepend[]bgcolor[#888888BB;false]set_focus[text]" ..
"field[0.25,0.4;1,0.8;mode;" .. F(S("Mode")) .. ";" .. meta:get_int("mode") ..
"]field[1.5,0.4;1,0.8;iter;" .. F(S("Repeat")) .. ";" .. meta:get_int("iter") ..
"]field[2.75,0.4;3,0.8;pass;" .. F(S("Password")) .. ";" .. meta:get_string("pass") ..
"]label[0.25,1.5;" .. minetest.colorize("lawngreen", F(S("MODE: 1=OFF, 2=ON, 3=TOGGLE"))) ..
"]field[0.25,3;3.85,0.8;text;" .. F(S("Text")) .. ";" .. F(meta:get_string("text")) ..
"]button[4.1,3;0.5,0.8;sounds;♫]button_exit[4.75,3;1,0.8;OK;" .. F(S("OK")) ..
"]field[0.25,4.25;1,0.8;x0;" .. F(S("Target")) .. ";" .. x0 ..
"]field[1.5,4.25;1,0.8;y0;;" .. y0 .. "]field[2.75,4.25;1,0.8;z0;;" .. z0 ..
"]button[4.75,4.25;1,0.8;help;" .. F(S("help")) .. "]")
end,
effector = {

View File

@ -1,7 +1,7 @@
local F, S = basic_machines.F, basic_machines.S
minetest.register_node("basic_machines:light_off", {
description = S("Light Off"),
description = S("Light off"),
groups = {cracky = 3, not_in_creative_inventory = 1},
tiles = {"basic_machines_light_off.png"},
@ -19,7 +19,7 @@ minetest.register_node("basic_machines:light_off", {
})
minetest.register_node("basic_machines:light_on", {
description = S("Light On"),
description = S("Light"),
groups = {cracky = 3},
light_source = default.LIGHT_MAX,
tiles = {"basic_machines_light.png"},

View File

@ -26,7 +26,7 @@ Scale=
Visual=
help=
OK=
Spawns energy ball=
Ball Spawner=
@nLifetime: [1, +∞[=
## ball spawner help
BALL SPAWNER CAPABILITIES=
@ -52,10 +52,10 @@ Visual*: "cube" or "sprite"@
@nNote: Hold sneak while digging to get the Ball Spawner@n=
##
Overheat! Temperature: @1=
Ball Spawner=
Ball Spell=
# clockgen.lua
Clock Generator - use sparingly, continually activates top block=
Clock Generator=
Clock Generator: Interference from nearby clock generator detected=
Clock Generator (owned by @1): place machine to be activated on top=
@ -65,7 +65,7 @@ CRAFT=
@#CRAFTING: '@1' (@2)=
Constructor: to operate it insert materials, select item to make and click craft button=
## basic_machines:constructor
Constructor: used to make machines=
Constructor=
Keypad=
Light=
Grinder=
@ -74,28 +74,27 @@ Battery=
Generator=
Detector=
Distributor=
Clock Generator=
Recycler=
Environment=
Environment Changer=
Power Block=
Power Cell=
Coal Lump=
Mesecon Adapter=
Automate crafting=
Spawn moving energy balls=
Power for machines=
Store energy, can power nearby machines=
For making circuits that run non stop=
Coal lump, contains 1 energy unit=
Detect and measure players, objects, blocks, light level=
Detect block, player, object, light level...=
Organize your circuits better=
Change gravity and more=
Generate power crystals=
Makes dusts and grinds materials=
Turns on/off lights and activates machines or opens doors=
Make dusts and grind materials=
Activate machines by sending signal=
Light in darkness=
Can dig, harvest, plant, teleport or move items from/in inventories=
Energy cell, contains 11 energy units=
Energy cell, contains 1 energy unit=
Universal digging, harvesting, teleporting, transporting machine=
Energy block=
Energy cell=
Recycle old tools=
Interface between machines and mesecons=
@ -106,7 +105,6 @@ object=
inventory=
infotext=
light=
Detector - can detect blocks/players/objects and activate machines=
Detector. Right click/punch to set it up.=
Inventory selection=
Source1=
@ -131,7 +129,6 @@ scan=
view=
delay=
ADD=
Distributor - can forward signal up to 16 different targets=
DISTRIBUTOR: Event handler nearest position found at @1 (@2) - displaying mark 1=
Distributor. Right click to set it up.=
@ -143,7 +140,6 @@ Jump=
Sneak=
Sky=
FUEL=
Changes environment for players around target location=
Right click to set it. Activate by signal.=
## environment machine help
ENVIRONMENT MODIFICATIONS=
@ -169,30 +165,22 @@ IN: @1@nOUT(@2): @3@n=
IN(@1): @2@nOUT: @3@n=
IN(@1): @2@nOUT(@3): @4@n=
IN: @1@nOUT: @2@n=
Iron dust purity @1% (combine with chemicals to create iron extractor)=
Iron dust purity @1% (smelt to increase purity)=
Copper dust purity @1% (combine with chemicals to create copper extractor)=
Copper dust purity @1% (smelt to increase purity)=
Tin dust purity @1% (combine with chemicals to create tin extractor)=
Tin dust purity @1% (smelt to increase purity)=
Gold dust purity @1% (combine with chemicals to create gold extractor)=
Gold dust purity @1% (smelt to increase purity)=
Mese dust purity @1% (combine with chemicals to create mese extractor)=
Mese dust purity @1% (smelt to increase purity)=
Diamond dust purity @1% (combine with chemicals to create diamond extractor)=
Diamond dust purity @1% (smelt to increase purity)=
Silver dust purity @1% (combine with chemicals to create silver extractor)=
Silver dust purity @1% (smelt to increase purity)=
Mithril dust purity @1% (combine with chemicals to create mithril extractor)=
Mithril dust purity @1% (smelt to increase purity)=
Smelt to get iron=
Smelt to get copper=
Smelt to get tin=
Smelt to get gold=
Smelt to get mese=
Smelt to get diamond=
Smelt to get silver=
Smelt to get mithril=
Iron Dust (purity @1%)=
Copper Dust (purity @1%)=
Tin Dust (purity @1%)=
Gold Dust (purity @1%)=
Mese Dust (purity @1%)=
Diamond Dust (purity @1%)=
Silver Dust (purity @1%)=
Mithril Dust (purity @1%)=
Iron Extractor=
Copper Extractor=
Tin Extractor=
Gold Extractor=
Mese Extractor=
Diamond Extractor=
Silver Extractor=
Mithril Extractor=
IN=
OUT=
UPGRADE=
@ -218,17 +206,15 @@ Protection fail. Reset.=
KEYPAD: Resetting. Punch again after @1s to activate.=
Keypad operation: @1 cycle left=
Keypad operation: @1 cycles left=
Keypad - basic way to activate machines by sending signal=
Keypad. Right click to set it up or punch it. Set any password and text "@@" to work as keyboard.=
Repeat=
Mode=
Repeat=
Password=
MODE: 1@=OFF, 2@=ON, 3@=TOGGLE=
Text=
# light.lua
Light Off=
Light On=
Light off=
Deactivate after:=
# machines_configuration.lua
@ -305,9 +291,8 @@ KEYPAD: Position is protected. Aborting.=
KEYPAD: All coordinates must be between @1 and @2.=
Punch keyboard to use it.=
Punch keypad to use it. Password protected.=
ACCESS DENIED. WRONG PASSWORD.=
ACCESS GRANTED=
Operation aborted by user. Punch to activate.=
(@1 sounds)=
Sounds (@1):=
## keypad help
KEYPAD HELP=
#
@ -322,12 +307,15 @@ Mode: 1@=OFF, 2@=ON, 3@=TOGGLE control the way how target node is activated.@
To set text on other nodes (text shows when you look at node) just target the node and set nonempty text. Upon activation text will be set. When target node is another keypad, its "text" field will be set. When targets is mover/detector, its "filter" field will be set. To clear "filter" set text to "@@". When target is distributor, you can change i-th target of distributor to mode mode with "i mode".@
@nKeyboard: To use keypad as keyboard for text input write "@@" in "text" field and set any password. Next time keypad is used it will work as text input device.@
@nDisplaying messages to nearby players (up to 5 blocks around keypad's target): Set text to "!text". Upon activation player will see "text" in their chat.@
@nPlaying sound to nearby players: set text to "$sound_name", optionally followed by a space and pitch value: 0.01 to 10.=
@nPlaying sound to nearby players: set text to "$sound_name", optionally followed by a space and pitch value: 0.01 to 10. Can choose a sound with sounds menu.=
#
@n@nADVANCED:@
Text replacement: Suppose keypad A is set with text "@@some @@. text @@!" and there are blocks on top of keypad A with infotext '1' and '2'. Suppose we target B with A and activate A. Then text of keypad B will be set to "some 1. text 2!".@
Word extraction: Suppose similar setup but now keypad A is set with text "%1". Then upon activation text of keypad B will be set to 1.st word of infotext.=
##
ACCESS DENIED. WRONG PASSWORD.=
ACCESS GRANTED=
Operation aborted by user. Punch to activate.=
DETECTOR: Position is protected. Aborting.=
DETECTOR: All coordinates must be between @1 and @2.=
## detector help
@ -343,7 +331,7 @@ You can also filter output signal in any modes:@
##
# mesecon_adapter.lua
Interface between machines and mesecons - place block to be activated on top of it=
Mesecon Adapter: place machine to be activated on top=
# control_doors.lua
@#steel door: punch me one more time to remove me=
@ -381,7 +369,6 @@ REVERSE source and target (0/1/2/3)=
Toggle mover introduction=
Mover introduction enabled=
Mover introduction disabled=
Mover - universal digging/harvesting/teleporting/transporting machine, it's upgradeable=
Mover block. Set it up by punching or right click. Activated by signal.=
## mover introduction
MOVER INTRODUCTION=
@ -408,7 +395,6 @@ MOVER: Wrong filter (@1) at @2,@3,@4.=
At least @1 of '@2' (@3) required=
Fuel status @1, recycling '@2' (@3)=
Select recipe:=
Recycler - use to get some ingredients back from crafted things=
Recycler: Put one item in 'IN' (src) and obtain 75% of raw materials in 'OUT' (dst). To operate it insert fuel, then insert item to recycle or activate with signal.=
# space.lua
@ -426,7 +412,6 @@ Recharge problem: capacity @1, needed @2=
Power draw required: @1, maximum power output @2. Please upgrade battery.=
Used fuel provides too little power for current power draw @1=
Energy: @1 / @2=
Battery - stores energy, generates energy from fuel, can power nearby machines, or accelerate/run furnace above it, it's upgradeable=
Battery - stores energy, generates energy from fuel, can power nearby machines, or accelerate/run furnace above it=
## battery help
BATTERY HELP=
@ -446,7 +431,6 @@ High upgrade: power rod=
Medium upgrade: power block=
Low upgrade: power cell=
Generator: Interference from nearby generator detected=
Generator - very expensive, generates power crystals that provide power, it's upgradeable=
Generator - generates power crystals that provide power, upgrade with up to @1 generators=
## generator help
GENERATOR HELP=
@ -455,6 +439,4 @@ Generator slowly produces power crystals. Those can be used to recharge batterie
@nLow (0-4), medium (5-19) and high level (20+). Upgrading the generator (upgrade with generators) will increase the rate at which the crystals are produced.@
@nYou can automate the process of battery recharging by using mover in inventory mode, taking from inventory "fuel".=
##
Power Cell - provides @1 energy=
Power Block - provides @1 energy=
Power Rod - provides @1 energy=
Power Rod=

View File

@ -2,14 +2,39 @@ local F, S = basic_machines.F, basic_machines.S
local machines_TTL = basic_machines.properties.machines_TTL
local max_range = basic_machines.properties.max_range
local mover_upgrade_max = basic_machines.properties.mover_upgrade_max
local punchset = {}
local sounds, punchset, keypad_soundlist, sound_selected = {}, {}, nil, {}
minetest.register_on_mods_loaded(function()
local sounds_array, i = {}, 1
for _, mod_name in ipairs(minetest.get_modnames()) do
local sounds_path = minetest.get_modpath(mod_name) .. "/sounds"
for _, sound_file in ipairs(minetest.get_dir_list(sounds_path, false)) do
local sound_name = sound_file:match("(.*)%.ogg$")
if sound_name then
local sounds_name = sound_name:gsub("%.[0-9]$", "")
if sound_name == sounds_name then
sounds[i] = {name = sound_name}; i = i + 1
else
local sound = sounds_array[sounds_name]
local id, count = (sound or {}).id or i, (sound or {}).count
count = count and count + 1 or 1
sounds_array[sounds_name] = {id = id, count = count}
sounds[id] = {name = sounds_name, count = count}
if count == 1 then i = i + 1 end
end
end
end
end
end)
minetest.register_on_joinplayer(function(player)
punchset[player:get_player_name()] = {state = 0, node = ""}
end)
minetest.register_on_leaveplayer(function(player)
punchset[player:get_player_name()] = nil
local name = player:get_player_name()
punchset[name] = nil
sound_selected[name] = nil
end)
-- SETUP BY PUNCHING
@ -30,12 +55,13 @@ local function check_keypad(pos, name) -- called only when manually activated vi
if meta:get_string("text") == "@" then -- keypad works as a keyboard
minetest.show_formspec(name, "basic_machines:check_keypad_" .. minetest.pos_to_string(pos),
"size[3,1.25]field[0.25,0.25;3,1;pass;" .. F(S("Enter text:")) ..
";]button_exit[0,0.75;1,1;OK;" .. F(S("OK")) .. "]")
"formspec_version[4]size[4,2.2]field[0.25,0.4;3.5,0.8;pass;" .. F(S("Enter text:")) ..
";]button_exit[0.25,1.3;1,0.8;OK;" .. F(S("OK")) .. "]")
else
minetest.show_formspec(name, "basic_machines:check_keypad_" .. minetest.pos_to_string(pos),
"size[3,1.25]no_prepend[]bgcolor[#FF8888BB;false]field[0.25,0.25;3,1;pass;" .. F(S("Enter password:")) ..
";]button_exit[0,0.75;1,1;OK;" .. F(S("OK")) .. "]")
"formspec_version[4]size[4,2.2]no_prepend[]bgcolor[#FF8888BB;false]" ..
"pwdfield[0.25,0.4;3.5,0.8;pass;" .. F(S("Enter password:")) ..
"]button_exit[0.25,1.3;1,0.8;OK;" .. F(S("OK")) .. "]")
end
end
@ -61,7 +87,9 @@ minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing)
if punch_state == 0 then
if punchset_desc == "KEYPAD" then
local meta = minetest.get_meta(pos)
if meta:get_int("x0") ~= 0 or meta:get_int("y0") ~= 0 or meta:get_int("z0") ~= 0 then -- already configured
if meta:get_int("x0") ~= 0 or meta:get_int("y0") ~= 0 or meta:get_int("z0") ~= 0 or
meta:get_string("text") ~= ""
then -- already configured
check_keypad(pos, name); return -- not setup, just standard operation
elseif minetest.is_protected(pos, name) then
minetest.chat_send_player(name, S("KEYPAD: You must be able to build to set up keypad.")); return
@ -297,6 +325,7 @@ local fnames = {
"basic_machines:distributor_",
"basic_machines:keypad_",
"basic_machines:check_keypad_",
"basic_machines:sounds_keypad_",
"basic_machines:detector_"
}
@ -452,7 +481,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
elseif fields.help then
minetest.show_formspec(name, "basic_machines:help_mover", "size[6,7]textarea[0,0;6.5,8.5;help;" ..
minetest.show_formspec(name, "basic_machines:help_mover", "formspec_version[4]size[8,9.3]textarea[0,0.35;8,8.95;help;" ..
F(S("MOVER HELP")) .. ";" .. F(S("version @1\nSETUP: For interactive setup punch the mover and then punch source1, source2, target node (follow instructions)." ..
" Put the mover directly next to a battery. For advanced setup right click mover." ..
" Positions are defined by x y z coordinates (see top of mover for orientation)." ..
@ -583,7 +612,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
minetest.chat_send_player(name, S("DISTRIBUTOR: Connected @1 targets.", count))
elseif fields.help then
minetest.show_formspec(name, "basic_machines:help_distributor", "size[5.5,5.5]textarea[0,0;6,7;help;" ..
minetest.show_formspec(name, "basic_machines:help_distributor", "formspec_version[4]size[7.4,7.4]textarea[0,0.35;7.4,7.05;help;" ..
F(S("DISTRIBUTOR HELP")) .. ";" .. F(S("SETUP: To select target nodes for activation click SET then click target node.\n" ..
"You can add more targets with ADD. To see where target node is click SHOW button next to it.\n" ..
"\n4 numbers in each row represent (from left to right): first 3 numbers are target coordinates x y z, last number (MODE) controls how signal is passed to target.\n" ..
@ -694,8 +723,45 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
end
elseif fields.sounds then
if keypad_soundlist == nil then
keypad_soundlist = {}
for i, v in ipairs(sounds) do
local count, sound = v.count, v.name
if count and count > 1 then
sound = sound .. " " .. S("(@1 sounds)", count)
end
keypad_soundlist[i] = F(sound:gsub("_", " "))
end
keypad_soundlist = table.concat(keypad_soundlist, ",")
end
local idx, text = sound_selected[name], meta:get_string("text")
if idx and text:byte() == 36 or text:byte() == 36 then -- text starts with $
text = text:sub(2)
if text ~= "" then
local sound_text
if idx then
local sound_name = (sounds[idx] or {}).name
sound_text = sound_name and "$" .. sound_name
end
text = text:split(" ")[1]
if sound_text and sound_text ~= text or not sound_text then
for i, v in ipairs(sounds) do
if v.name == text then sound_selected[name] = i; break end
end
end
end
end
minetest.show_formspec(name, "basic_machines:sounds_keypad_" .. minetest.pos_to_string(pos),
"formspec_version[4]size[7.75,5.75]" ..
"label[0.25,0.25;" .. F(S("Sounds (@1):", #sounds)) ..
"]textlist[0.25,0.5;6,5;sound;" .. keypad_soundlist .. ";" .. (sound_selected[name] or 0) ..
"]button_exit[6.5,0.6;1,0.8;OK;" .. F(S("OK")) .. "]")
elseif fields.help then
minetest.show_formspec(name, "basic_machines:help_keypad", "size[6,7]textarea[0,0;6.5,8.5;help;" ..
minetest.show_formspec(name, "basic_machines:help_keypad", "formspec_version[4]size[8,9.3]textarea[0,0.35;8,8.95;help;" ..
F(S("KEYPAD HELP")) .. ";" .. F(S("Mode: 1=OFF, 2=ON, 3=TOGGLE control the way how target node is activated." ..
"\n\nRepeat: Number to control how many times activation is repeated after initial punch." ..
"\n\nPassword: Enter password and press OK. Password will be encrypted." ..
@ -715,7 +781,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
" Next time keypad is used it will work as text input device." ..
"\n\nDisplaying messages to nearby players (up to 5 blocks around keypad's target): Set text to \"!text\"." ..
" Upon activation player will see \"text\" in their chat." ..
"\n\nPlaying sound to nearby players: set text to \"$sound_name\", optionally followed by a space and pitch value: 0.01 to 10.")) ..
"\n\nPlaying sound to nearby players: set text to \"$sound_name\", optionally followed by a space and pitch value: 0.01 to 10. Can choose a sound with sounds menu.")) ..
F(S("\n\nADVANCED:\nText replacement: Suppose keypad A is set with text \"@@some @@. text @@!\" and there are blocks on top of keypad A with infotext '1' and '2'." ..
" Suppose we target B with A and activate A. Then text of keypad B will be set to \"some 1. text 2!\"." ..
"\nWord extraction: Suppose similar setup but now keypad A is set with text \"%1\"." ..
@ -748,6 +814,28 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
end
elseif formname_sub == "sounds_keypad" then
if minetest.is_protected(pos, name) then return end
if fields.sound then
sound_selected[name] = minetest.explode_textlist_event(fields.sound).index
elseif fields.OK then
local i = sound_selected[name]
if i then
local sound_name = (sounds[i] or {}).name
if sound_name then
local sound_text = "$" .. sound_name
if sound_text ~= meta:get_string("text"):split(" ")[1] then
meta:set_string("text", sound_text)
end
end
end
else
sound_selected[name] = nil
end
-- DETECTOR
elseif formname_sub == "detector" then
@ -786,7 +874,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
meta:set_string("inv1", strip_translator_sequence(fields.inv1, ""))
elseif fields.help then
minetest.show_formspec(name, "basic_machines:help_detector", "size[5.5,5.5]textarea[0,0;6,7;help;" ..
minetest.show_formspec(name, "basic_machines:help_detector", "formspec_version[4]size[7.4,7.4]textarea[0,0.35;7.4,7.05;help;" ..
F(S("DETECTOR HELP")) .. ";" .. F(S("SETUP: Right click or punch and follow chat instructions." ..
" With a detector you can detect nodes, objects, players, items inside inventories, nodes information and light levels. " ..
"If detector activates it will trigger machine at target position." ..

View File

@ -1,5 +1,6 @@
-- Block that can be activated by/activate mesecon blocks
local S = basic_machines.S
local machines_TTL = basic_machines.properties.machines_TTL
local adapter_effector = {
@ -43,13 +44,17 @@ local adapter_effector = {
}
minetest.register_node("basic_machines:mesecon_adapter", {
description = basic_machines.S("Interface between machines and mesecons - place block to be activated on top of it"),
description = S("Mesecon Adapter"),
groups = {cracky = 3, mesecon_effector_on = 1, mesecon_effector_off = 1, mesecon_needs_receiver = 1},
tiles = {"basic_machines_clock_generator.png", "basic_machines_clock_generator.png",
"jeija_luacontroller_top.png", "jeija_luacontroller_top.png",
"jeija_luacontroller_top.png", "jeija_luacontroller_top.png"},
sounds = default.node_sound_wood_defaults(),
after_place_node = function(pos, placer)
minetest.get_meta(pos):set_string("infotext", S("Mesecon Adapter: place machine to be activated on top"))
end,
effector = adapter_effector,
mesecons = {

View File

@ -393,7 +393,7 @@ local mover_upgrades = {
}
minetest.register_node("basic_machines:mover", {
description = S("Mover - universal digging/harvesting/teleporting/transporting machine, it's upgradeable"),
description = S("Mover"),
groups = {cracky = 3},
tiles = {"basic_machines_mover.png"},
sounds = default.node_sound_wood_defaults(),
@ -432,7 +432,7 @@ minetest.register_node("basic_machines:mover", {
player_meta:set_int("basic_machines:mover_intro", 2)
end
minetest.show_formspec(name, "basic_machines:intro_mover", "size[5.5,5.5]textarea[0,0;6,7;intro_mover;" ..
minetest.show_formspec(name, "basic_machines:intro_mover", "formspec_version[4]size[7.4,7.4]textarea[0,0.35;7.4,7.05;intro_mover;" ..
F(S("MOVER INTRODUCTION")) .. ";" .. F(S("This machine can move anything. General idea is the following:\n\n" ..
"First you need to define rectangle box work area (larger area, where it takes from, defined by source1/source2 which appear as two number 1 boxes) and target position (where it puts, marked by one number 2 box) by punching mover then following CHAT instructions exactly.\n\n" ..
"CHECK why it doesn't work: 1. did you click OK in mover after changing setting 2. does it have battery, 3. does battery have enough fuel 4. did you set filter for taking out of chest ?\n\n" ..

View File

@ -165,7 +165,7 @@ local function recycler_process(pos)
end
minetest.register_node("basic_machines:recycler", {
description = S("Recycler - use to get some ingredients back from crafted things"),
description = S("Recycler"),
groups = {cracky = 3},
tiles = {"basic_machines_recycler.png"},
sounds = default.node_sound_wood_defaults(),

View File

@ -167,8 +167,7 @@ end
local machines_activate_furnace = minetest.registered_nodes["default:furnace"].on_metadata_inventory_put
minetest.register_node("basic_machines:battery_0", {
description = S("Battery - stores energy, generates energy from fuel, can power nearby machines," ..
" or accelerate/run furnace above it, it's upgradeable"),
description = S("Battery"),
groups = {cracky = 3},
tiles = {"basic_machines_outlet.png", "basic_machines_battery.png", "basic_machines_battery_0.png"},
sounds = default.node_sound_wood_defaults(),
@ -205,7 +204,7 @@ minetest.register_node("basic_machines:battery_0", {
on_receive_fields = function(pos, formname, fields, sender)
if fields.help then
minetest.show_formspec(sender:get_player_name(), "basic_machines:help_battery",
"size[6,7]textarea[0,0;6.5,8.5;help;" .. F(S("BATTERY HELP")) .. ";" ..
"formspec_version[4]size[7.4,7.4]textarea[0,0.35;7.4,7.05;help;" .. F(S("BATTERY HELP")) .. ";" ..
F(S("Battery provides power to machines or furnace. It can either use " ..
"power crystals or convert ordinary furnace fuels into energy. 1 coal lump gives 1 energy.\n\n" ..
"UPGRADE with diamond blocks for more available power output or with " ..
@ -443,7 +442,7 @@ local function generator_near_found(pos, name) -- check to prevent too many gene
end
minetest.register_node("basic_machines:generator", {
description = S("Generator - very expensive, generates power crystals that provide power, it's upgradeable"),
description = S("Generator"),
groups = {cracky = 3},
tiles = {"basic_machines_generator.png"},
sounds = default.node_sound_wood_defaults(),
@ -476,7 +475,7 @@ minetest.register_node("basic_machines:generator", {
on_receive_fields = function(pos, formname, fields, sender)
if fields.help then
minetest.show_formspec(sender:get_player_name(), "basic_machines:help_generator",
"size[6,7]textarea[0,0;6.5,8.5;help;" .. F(S("GENERATOR HELP")) .. ";" ..
"formspec_version[4]size[7.4,7.4]textarea[0,0.35;7.4,7.05;help;" .. F(S("GENERATOR HELP")) .. ";" ..
F(S("Generator slowly produces power crystals. Those can be used to recharge batteries and come in 3 flavours:\n\n" ..
"Low (0-4), medium (5-19) and high level (20+)." ..
" Upgrading the generator (upgrade with generators) will increase the rate at which the crystals are produced.\n\n" ..
@ -569,7 +568,7 @@ minetest.register_node("basic_machines:generator", {
-- CRAFTS
minetest.register_craftitem("basic_machines:power_cell", {
description = S("Power Cell - provides @1 energy", 1 * energy_multiplier),
description = S("Power Cell"),
groups = {energy = 1},
inventory_image = "basic_machines_power_cell.png",
stack_max = power_stackmax,
@ -577,7 +576,7 @@ minetest.register_craftitem("basic_machines:power_cell", {
})
minetest.register_craftitem("basic_machines:power_block", {
description = S("Power Block - provides @1 energy", 11 * energy_multiplier),
description = S("Power Block"),
groups = {energy = 1},
inventory_image = "basic_machines_power_block.png",
stack_max = power_stackmax,
@ -585,7 +584,7 @@ minetest.register_craftitem("basic_machines:power_block", {
})
minetest.register_craftitem("basic_machines:power_rod", {
description = S("Power Rod - provides @1 energy", 100 * energy_multiplier),
description = S("Power Rod"),
groups = {energy = 1},
inventory_image = "basic_machines_power_rod.png",
stack_max = power_stackmax,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 242 B

After

Width:  |  Height:  |  Size: 303 B