3 Commits

Author SHA1 Message Date
52fc535d26 Add missing dependencies (#41)
Some dependencies are technically not necessary but should help to avoid issues in the future.
2025-07-17 19:22:07 +02:00
3e93b939f3 Validate user inputs (#39) 2024-12-19 19:47:36 +01:00
79b72e8b76 Replace deprecated formspec element 'invsize' with 'size' (#37) 2024-11-22 21:21:37 +01:00
30 changed files with 23 additions and 58 deletions

View File

@ -64,5 +64,3 @@ minetest.register_craft({
recipe = { {"mesecons_blinkyplant:blinky_plant_off"}, recipe = { {"mesecons_blinkyplant:blinky_plant_off"},
{"default:mese_crystal_fragment"},} {"default:mese_crystal_fragment"},}
}) })
minetest.log("action", "[moremesecons_adjustable_blinky_plant] loaded.")

View File

@ -1,3 +1,3 @@
name = moremesecons_adjustable_blinkyplant name = moremesecons_adjustable_blinkyplant
depends = mesecons,moremesecons_utils depends = mesecons,moremesecons_utils,default
optional_depends = craft_guide optional_depends = craft_guide

View File

@ -2,6 +2,8 @@
-- Detects players in a certain radius -- Detects players in a certain radius
-- The radius can be changes by right-click (by default 6) -- The radius can be changes by right-click (by default 6)
local MAX_RADIUS = moremesecons.setting("adjustable_player_detector", "max_radius", 16, 0)
local function make_formspec(meta) local function make_formspec(meta)
meta:set_string("formspec", "size[9,5]" .. meta:set_string("formspec", "size[9,5]" ..
"field[0.3, 0;9,2;scanname;Comma-separated list of the names of players to scan for (empty for any):;${scanname}]".. "field[0.3, 0;9,2;scanname;Comma-separated list of the names of players to scan for (empty for any):;${scanname}]"..
@ -36,7 +38,7 @@ local object_detector_scan = function (pos)
local scanname = meta:get_string("scanname") local scanname = meta:get_string("scanname")
local scan_all = scanname == "" local scan_all = scanname == ""
local scan_names = scanname:split(',') local scan_names = scanname:split(',')
local radius = meta:get_int("radius") local radius = math.min(meta:get_int("radius"), MAX_RADIUS)
if radius <= 0 then if radius <= 0 then
radius = 6 radius = 6
end end
@ -76,11 +78,11 @@ local object_detector_digiline = {
make_formspec(meta) make_formspec(meta)
end end
end end
if msg.scanname then if type(msg.scanname) == "string" then
meta:set_string("scanname", msg.scanname) meta:set_string("scanname", msg.scanname)
make_formspec(meta) make_formspec(meta)
end end
if msg.command and msg.command == "get" then if msg.command == "get" then
local found, name = object_detector_scan(pos) local found, name = object_detector_scan(pos)
if not found then if not found then
name = "" name = ""
@ -156,5 +158,3 @@ minetest.register_abm({
end end
end, end,
}) })
minetest.log("action", "[moremesecons_adjustable_player_detector] loaded.")

View File

@ -1,3 +1,3 @@
name = moremesecons_adjustable_player_detector name = moremesecons_adjustable_player_detector
depends = mesecons depends = mesecons,moremesecons_utils,default
optional_depends = craft_guide optional_depends = craft_guide

View File

@ -5,7 +5,7 @@ local function initialize_data(meta)
local commands = meta:get_string("commands") local commands = meta:get_string("commands")
meta:set_string("formspec", meta:set_string("formspec",
"invsize[9,5;]" .. "size[9,5]" ..
"textarea[0.5,0.5;8.5,4;commands;Commands;"..minetest.formspec_escape(commands).."]" .. "textarea[0.5,0.5;8.5,4;commands;Commands;"..minetest.formspec_escape(commands).."]" ..
"label[1,3.8;@nearest is replaced by the nearest player name ("..tostring(NEAREST_MAX_DISTANCE).." nodes max for the nearest distance)".."]" .. "label[1,3.8;@nearest is replaced by the nearest player name ("..tostring(NEAREST_MAX_DISTANCE).." nodes max for the nearest distance)".."]" ..
"button_exit[3.3,4.5;2,1;submit;Submit]") "button_exit[3.3,4.5;2,1;submit;Submit]")
@ -178,5 +178,3 @@ minetest.register_craft({
{"group:mesecon_conductor_craftable","default:mese_crystal","group:mesecon_conductor_craftable"} {"group:mesecon_conductor_craftable","default:mese_crystal","group:mesecon_conductor_craftable"}
} }
}) })
minetest.log("action", "[moremesecons_commandblock] loaded.")

View File

@ -1,3 +1,3 @@
name = moremesecons_commandblock name = moremesecons_commandblock
depends = mesecons,moremesecons_utils depends = mesecons,moremesecons_utils,default
optional_depends = craft_guide optional_depends = craft_guide

View File

@ -79,5 +79,3 @@ minetest.register_craft({
output = "moremesecons_conductor_signalchanger:conductor_signalchanger_off", output = "moremesecons_conductor_signalchanger:conductor_signalchanger_off",
recipe = {{"group:mesecon_conductor_craftable","moremesecons_signalchanger:signalchanger_off"}} recipe = {{"group:mesecon_conductor_craftable","moremesecons_signalchanger:signalchanger_off"}}
}) })
minetest.log("action", "[moremesecons_conductor_signalchanger] loaded.")

View File

@ -98,5 +98,3 @@ minetest.register_craft({
output = "moremesecons_dual_delayer:dual_delayer_00 2", output = "moremesecons_dual_delayer:dual_delayer_00 2",
recipe = {"mesecons_delayer:delayer_off_1", "mesecons_delayer:delayer_off_1"} recipe = {"mesecons_delayer:delayer_off_1", "mesecons_delayer:delayer_off_1"}
}) })
minetest.log("action", "[moremesecons_dual_delayer] loaded.")

View File

@ -2,6 +2,8 @@
-- Detects entitys in a certain radius -- Detects entitys in a certain radius
-- The radius can be changes by right-click (by default 6) -- The radius can be changes by right-click (by default 6)
local MAX_RADIUS = moremesecons.setting("entity_detector", "max_radius", 16, 0)
local function make_formspec(meta) local function make_formspec(meta)
meta:set_string("formspec", "size[9,5]" .. meta:set_string("formspec", "size[9,5]" ..
"field[0.3, 0;9,2;scanname;Comma-separated list of the names (itemstring) of entities to scan for (empty for any):;${scanname}]".. "field[0.3, 0;9,2;scanname;Comma-separated list of the names (itemstring) of entities to scan for (empty for any):;${scanname}]"..
@ -26,8 +28,7 @@ local function object_detector_on_receive_fields(pos, _, fields, player)
meta:set_string("digiline_channel", fields.digiline_channel) meta:set_string("digiline_channel", fields.digiline_channel)
local r = tonumber(fields.radius) local r = tonumber(fields.radius)
if r then if r then
local max_radius = moremesecons.setting("entity_detector", "max_radius", 16, 0) meta:set_int("radius", math.min(r, MAX_RADIUS))
meta:set_int("radius", math.min(r, max_radius))
end end
end end
@ -37,8 +38,7 @@ local object_detector_scan = function (pos)
local scanname = meta:get_string("scanname") local scanname = meta:get_string("scanname")
local scan_all = scanname == "" local scan_all = scanname == ""
local scan_names = scanname:split(',') local scan_names = scanname:split(',')
local max_radius = moremesecons.setting("entity_detector", "max_radius", 16, 0) local radius = math.min(tonumber(meta:get("radius")) or 6, MAX_RADIUS)
local radius = math.min(tonumber(meta:get("radius")) or 6, max_radius)
for _,obj in pairs(minetest.get_objects_inside_radius(pos, radius)) do for _,obj in pairs(minetest.get_objects_inside_radius(pos, radius)) do
local luaentity = obj:get_luaentity() local luaentity = obj:get_luaentity()
if luaentity then if luaentity then
@ -62,7 +62,7 @@ local object_detector_digiline = {
action = function (pos, node, channel, msg) action = function (pos, node, channel, msg)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local active_channel = meta:get_string("digiline_channel") local active_channel = meta:get_string("digiline_channel")
if channel ~= active_channel then if channel ~= active_channel or type(msg) ~= "string" then
return return
end end
meta:set_string("scanname", msg) meta:set_string("scanname", msg)
@ -136,5 +136,3 @@ minetest.register_abm({
end end
end, end,
}) })
minetest.log("action", "[moremesecons_entity_detector] loaded.")

View File

@ -1,3 +1,3 @@
name = moremesecons_entity_detector name = moremesecons_entity_detector
depends = mesecons depends = mesecons,moremesecons_utils,default
optional_depends = craft_guide optional_depends = craft_guide

View File

@ -46,5 +46,3 @@ minetest.register_craft({
recipe = { {"default:torch"}, recipe = { {"default:torch"},
{"default:mese_crystal_fragment"},} {"default:mese_crystal_fragment"},}
}) })
minetest.log("action", "[moremesecons_igniter] loaded.")

View File

@ -98,5 +98,3 @@ minetest.register_craft({
{"", "default:mese_crystal_fragment", ""} {"", "default:mese_crystal_fragment", ""}
} }
}) })
minetest.log("action", "[moremesecons_induction_transmitter] loaded.")

View File

@ -82,5 +82,3 @@ minetest.register_craft({
output = "moremesecons_injector_controller:injector_controller_off", output = "moremesecons_injector_controller:injector_controller_off",
recipe = {{"mesecons_blinkyplant:blinky_plant_off","mesecons_gates:and_off"}} recipe = {{"mesecons_blinkyplant:blinky_plant_off","mesecons_gates:and_off"}}
}) })
minetest.log("action", "[moremesecons_injector_controller] loaded.")

View File

@ -131,5 +131,3 @@ if moremesecons.setting("jammer", "enable_lbm", false) then
action = add_jammer action = add_jammer
}) })
end end
minetest.log("action", "[moremesecons_jammer] loaded.")

View File

@ -158,5 +158,3 @@ minetest.register_node("moremesecons_luablock:luablock", {
end end
}} }}
}) })
minetest.log("action", "[moremesecons_luablock] loaded.")

View File

@ -355,5 +355,3 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
return return
end end
end) end)
minetest.log("action", "[moremesecons_luacontroller_tool] loaded.")

View File

@ -118,5 +118,3 @@ minetest.register_alias("default:mesechest", "moremesecons_mesechest:mesechest")
minetest.register_alias("mesechest", "moremesecons_mesechest:mesechest") minetest.register_alias("mesechest", "moremesecons_mesechest:mesechest")
minetest.register_alias("default:mesechest_locked", "moremesecons_mesechest:mesechest") minetest.register_alias("default:mesechest_locked", "moremesecons_mesechest:mesechest")
minetest.register_alias("mesechest_locked", "moremesecons_mesechest:mesechest_locked") minetest.register_alias("mesechest_locked", "moremesecons_mesechest:mesechest_locked")
minetest.log("action", "[moremesecons_mesechest] loaded.")

View File

@ -60,5 +60,3 @@ minetest.register_node("moremesecons_playerkiller:playerkiller", {
end, end,
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
}) })
minetest.log("action", "[moremesecons_playerkiller] loaded.")

View File

@ -1,3 +1,3 @@
name = moremesecons_playerkiller name = moremesecons_playerkiller
depends = mesecons,mesecons_materials,moremesecons_utils depends = mesecons,mesecons_materials,moremesecons_utils,default
optional_depends = craft_guide optional_depends = craft_guide

View File

@ -121,5 +121,3 @@ minetest.register_craft({
recipe = {{"mesecons_luacontroller:luacontroller0000", "mesecons_noteblock:noteblock"}, recipe = {{"mesecons_luacontroller:luacontroller0000", "mesecons_noteblock:noteblock"},
{"group:wood", "group:wood"}} {"group:wood", "group:wood"}}
}) })
minetest.log("action", "[moremesecons_sayer] loaded.")

View File

@ -79,5 +79,3 @@ minetest.register_craft({
output = "moremesecons_signalchanger:signalchanger_off", output = "moremesecons_signalchanger:signalchanger_off",
recipe = {{"group:mesecon_conductor_craftable","moremesecons_switchtorch:switchtorch_off","group:mesecon_conductor_craftable"}} recipe = {{"group:mesecon_conductor_craftable","moremesecons_switchtorch:switchtorch_off","group:mesecon_conductor_craftable"}}
}) })
minetest.log("action", "[moremesecons_signalchanger] loaded.")

View File

@ -127,5 +127,3 @@ minetest.register_abm({
-- 2 = x+1 -- 2 = x+1
-- 0 = y+1 -- 0 = y+1
-- 1 = y-1 -- 1 = y-1
minetest.log("action", "[moremesecons_switchtorch] loaded.")

View File

@ -106,5 +106,3 @@ if moremesecons.setting("teleporter", "enable_lbm", false) then
action = register action = register
}) })
end end
minetest.log("action", "[moremesecons_teleporter] loaded.")

View File

@ -1,3 +1,3 @@
name = moremesecons_teleporter name = moremesecons_teleporter
depends = mesecons,moremesecons_utils depends = mesecons,moremesecons_utils,default
optional_depends = craft_guide optional_depends = craft_guide

View File

@ -134,5 +134,3 @@ minetest.register_craft({
minetest.register_alias("moremesecons_temporarygate:temporarygate_off", "moremesecons_timegate:timegate_off") minetest.register_alias("moremesecons_temporarygate:temporarygate_off", "moremesecons_timegate:timegate_off")
minetest.register_alias("moremesecons_temporarygate:temporarygate_on", "moremesecons_timegate:timegate_on") minetest.register_alias("moremesecons_temporarygate:temporarygate_on", "moremesecons_timegate:timegate_on")
minetest.log("action", "[moremesecons_timegate] loaded.")

View File

@ -1,3 +1,3 @@
name = moremesecons_timegate name = moremesecons_timegate
depends = mesecons depends = mesecons,default
optional_depends = craft_guide optional_depends = craft_guide

View File

@ -379,4 +379,3 @@ local function do_test()
end end
do_test() do_test()
--]] --]]
minetest.log("action", "[moremesecons_utils] loaded.")

View File

@ -498,5 +498,3 @@ if storage:get_string("wireless_meta_2") == "" then
end end
minetest.log("action", "[moremesecons_wireless] Done!") minetest.log("action", "[moremesecons_wireless] Done!")
end end
minetest.log("action", "[moremesecons_wireless] loaded.")

View File

@ -1,3 +1,3 @@
name = moremesecons_wireless name = moremesecons_wireless
depends = mesecons,moremesecons_utils depends = mesecons,moremesecons_utils,default
optional_depends = digilines,craft_guide optional_depends = digilines,craft_guide

View File

@ -3,6 +3,10 @@
# Minimal interval authorized. Any lower will be set to it. # Minimal interval authorized. Any lower will be set to it.
moremesecons_adjustable_blinky_plant.min_interval (Minimum Interval) float 0.5 moremesecons_adjustable_blinky_plant.min_interval (Minimum Interval) float 0.5
[Adjustable Player Detector]
moremesecons_adjustable_player_detector.max_radius (Maximum adjustable player detector radius) float 16 0
[Craftable Commandblock] [Craftable Commandblock]
# Space-separated list of authorized commands # Space-separated list of authorized commands