summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesecons_detector/doc/nodedetector/description.html1
-rw-r--r--mesecons_detector/doc/objectdetector/description.html1
-rw-r--r--mesecons_detector/init.lua49
-rw-r--r--pipeworks/luaentity.lua55
-rw-r--r--ropes/ropeboxes.lua5
-rw-r--r--technic/machines/HV/nuclear_reactor.lua1
-rw-r--r--technic/machines/MV/power_radiator.lua1
-rw-r--r--technic/machines/other/coal_alloy_furnace.lua1
-rw-r--r--technic/machines/other/injector.lua1
-rw-r--r--technic/machines/power_monitor.lua2
-rw-r--r--technic/machines/switching_station.lua2
-rw-r--r--technic/radiation.lua5
-rw-r--r--technic/tools/tree_tap.lua1
-rw-r--r--technic_worldgen/mg.lua2
-rw-r--r--technic_worldgen/rubber.lua1
15 files changed, 86 insertions, 42 deletions
diff --git a/mesecons_detector/doc/nodedetector/description.html b/mesecons_detector/doc/nodedetector/description.html
index be34fde..be1582e 100644
--- a/mesecons_detector/doc/nodedetector/description.html
+++ b/mesecons_detector/doc/nodedetector/description.html
@@ -4,3 +4,4 @@ It can also receive digiline signals. You can either send "GET" and it will
respond with the detected nodename or you can send any other string and it will
set this string as the node to scan for.
Nodenames must include the mod they reside in, so for instance default:dirt, not just dirt.
+The distance parameter specifies how many blocks are between the node detector and the node to detect.
diff --git a/mesecons_detector/doc/objectdetector/description.html b/mesecons_detector/doc/objectdetector/description.html
index c8315e8..bb88856 100644
--- a/mesecons_detector/doc/objectdetector/description.html
+++ b/mesecons_detector/doc/objectdetector/description.html
@@ -1,3 +1,4 @@
The object detector is a receptor. It changes its state when a player approaches.
Right-click it to set a name to scan for.
+You can also search for comma-separated lists of players where the detector gets activated if any of the names in the list are found.
It can also receive digiline signals which are the name to scan for on the specified channel in the right-click menu.
diff --git a/mesecons_detector/init.lua b/mesecons_detector/init.lua
index 65e5c6e..397543c 100644
--- a/mesecons_detector/init.lua
+++ b/mesecons_detector/init.lua
@@ -5,15 +5,18 @@ local GET_COMMAND = "GET"
-- The radius can be specified in mesecons/settings.lua
local function object_detector_make_formspec(pos)
- minetest.get_meta(pos):set_string("formspec", "size[9,2.5]" ..
+ local meta = minetest.get_meta(pos)
+ meta:set_string("formspec", "size[9,2.5]" ..
"field[0.3, 0;9,2;scanname;Name of player to scan for (empty for any):;${scanname}]"..
"field[0.3,1.5;4,2;digiline_channel;Digiline Channel (optional):;${digiline_channel}]"..
"button_exit[7,0.75;2,3;;Save]")
end
-local function object_detector_on_receive_fields(pos, _, fields)
+local function object_detector_on_receive_fields(pos, formname, fields, sender)
if not fields.scanname or not fields.digiline_channel then return end
+ if minetest.is_protected(pos, sender:get_player_name()) then return end
+
local meta = minetest.get_meta(pos)
meta:set_string("scanname", fields.scanname)
meta:set_string("digiline_channel", fields.digiline_channel)
@@ -28,14 +31,17 @@ local function object_detector_scan(pos)
if next(objs) == nil then return false end
local scanname = minetest.get_meta(pos):get_string("scanname")
+ local scan_for = {}
+ for _, str in pairs(string.split(scanname:gsub(" ", ""), ",")) do
+ scan_for[str] = true
+ end
+
local every_player = scanname == ""
for _, obj in pairs(objs) do
-- "" is returned if it is not a player; "" ~= nil; so only handle objects with foundname ~= ""
local foundname = obj:get_player_name()
-
if foundname ~= "" then
- -- return true if scanning for any player or if specific playername was detected
- if scanname == "" or foundname == scanname then
+ if every_player or scan_for[foundname] then
return true
end
end
@@ -128,17 +134,23 @@ minetest.register_abm({
-- Detects the node in front of it
local function node_detector_make_formspec(pos)
- minetest.get_meta(pos):set_string("formspec", "size[9,2.5]" ..
+ local meta = minetest.get_meta(pos)
+ if meta:get_string("distance") == "" then meta:set_string("distance", "0") end
+ meta:set_string("formspec", "size[9,2.5]" ..
"field[0.3, 0;9,2;scanname;Name of node to scan for (empty for any):;${scanname}]"..
- "field[0.3,1.5;4,2;digiline_channel;Digiline Channel (optional):;${digiline_channel}]"..
+ "field[0.3,1.5;2.5,2;distance;Distance (0-"..mesecon.setting("node_detector_distance_max", 10).."):;${distance}]"..
+ "field[3,1.5;4,2;digiline_channel;Digiline Channel (optional):;${digiline_channel}]"..
"button_exit[7,0.75;2,3;;Save]")
end
-local function node_detector_on_receive_fields(pos, _, fields)
+local function node_detector_on_receive_fields(pos, fieldname, fields, sender)
if not fields.scanname or not fields.digiline_channel then return end
+ if minetest.is_protected(pos, sender:get_player_name()) then return end
+
local meta = minetest.get_meta(pos)
meta:set_string("scanname", fields.scanname)
+ meta:set_string("distance", fields.distance or "0")
meta:set_string("digiline_channel", fields.digiline_channel)
node_detector_make_formspec(pos)
end
@@ -148,10 +160,17 @@ local function node_detector_scan(pos)
local node = minetest.get_node_or_nil(pos)
if not node then return end
+ local meta = minetest.get_meta(pos)
+
+ local distance = meta:get_int("distance")
+ local distance_max = mesecon.setting("node_detector_distance_max", 10)
+ if distance < 0 then distance = 0 end
+ if distance > distance_max then distance = distance_max end
+
local frontname = minetest.get_node(
- vector.subtract(pos, minetest.facedir_to_dir(node.param2))
+ vector.subtract(pos, vector.multiply(minetest.facedir_to_dir(node.param2), distance + 1))
).name
- local scanname = minetest.get_meta(pos):get_string("scanname")
+ local scanname = meta:get_string("scanname")
return (frontname == scanname) or
(frontname ~= "air" and frontname ~= "ignore" and scanname == "")
@@ -162,11 +181,17 @@ local node_detector_digiline = {
effector = {
action = function(pos, node, channel, msg)
local meta = minetest.get_meta(pos)
+
+ local distance = meta:get_int("distance")
+ local distance_max = mesecon.setting("node_detector_distance_max", 10)
+ if distance < 0 then distance = 0 end
+ if distance > distance_max then distance = distance_max end
+
if channel ~= meta:get_string("digiline_channel") then return end
if msg == GET_COMMAND then
local nodename = minetest.get_node(
- vector.subtract(pos, minetest.facedir_to_dir(node.param2))
+ vector.subtract(pos, vector.multiply(minetest.facedir_to_dir(node.param2), distance + 1))
).name
digiline:receptor_send(pos, digiline.rules.default, channel, nodename)
@@ -208,7 +233,6 @@ minetest.register_node("mesecons_detector:node_detector_off", {
}},
on_construct = node_detector_make_formspec,
on_receive_fields = node_detector_on_receive_fields,
- after_place_node = after_place_node_detector,
sounds = default.node_sound_stone_defaults(),
digiline = node_detector_digiline
})
@@ -225,7 +249,6 @@ minetest.register_node("mesecons_detector:node_detector_on", {
}},
on_construct = node_detector_make_formspec,
on_receive_fields = node_detector_on_receive_fields,
- after_place_node = after_place_node_detector,
sounds = default.node_sound_stone_defaults(),
digiline = node_detector_digiline
})
diff --git a/pipeworks/luaentity.lua b/pipeworks/luaentity.lua
index 665e055..50004ed 100644
--- a/pipeworks/luaentity.lua
+++ b/pipeworks/luaentity.lua
@@ -52,32 +52,27 @@ local function get_blockpos(pos)
end
local active_blocks = {} -- These only contain active blocks near players (i.e., not forceloaded ones)
-local handle_active_blocks_step = 2
-local handle_active_blocks_timer = 0
-minetest.register_globalstep(function(dtime)
- handle_active_blocks_timer = handle_active_blocks_timer + dtime
- if handle_active_blocks_timer >= handle_active_blocks_step then
- handle_active_blocks_timer = handle_active_blocks_timer - handle_active_blocks_step
- local active_block_range = tonumber(minetest.setting_get("active_block_range")) or 2
- local new_active_blocks = {}
- for _, player in ipairs(minetest.get_connected_players()) do
- local blockpos = get_blockpos(player:getpos())
- local minp = vector.subtract(blockpos, active_block_range)
- local maxp = vector.add(blockpos, active_block_range)
- for x = minp.x, maxp.x do
- for y = minp.y, maxp.y do
- for z = minp.z, maxp.z do
- local pos = {x = x, y = y, z = z}
- new_active_blocks[minetest.hash_node_position(pos)] = pos
- end
- end
- end
+local move_entities_globalstep_part1 = function(dtime)
+ local active_block_range = tonumber(minetest.setting_get("active_block_range")) or 2
+ local new_active_blocks = {}
+ for _, player in ipairs(minetest.get_connected_players()) do
+ local blockpos = get_blockpos(player:getpos())
+ local minp = vector.subtract(blockpos, active_block_range)
+ local maxp = vector.add(blockpos, active_block_range)
+
+ for x = minp.x, maxp.x do
+ for y = minp.y, maxp.y do
+ for z = minp.z, maxp.z do
+ local pos = {x = x, y = y, z = z}
+ new_active_blocks[minetest.hash_node_position(pos)] = pos
+ end
+ end
end
- active_blocks = new_active_blocks
- -- todo: callbacks on block load/unload
end
-end)
+ active_blocks = new_active_blocks
+ -- todo: callbacks on block load/unload
+end
local function is_active(pos)
return active_blocks[minetest.hash_node_position(get_blockpos(pos))] ~= nil
@@ -309,7 +304,7 @@ function luaentity.get_objects_inside_radius(pos, radius)
end
end
-minetest.register_globalstep(function(dtime)
+local move_entities_globalstep_part2 = function(dtime)
if not luaentity.entities then
luaentity.entities = read_entities()
end
@@ -348,4 +343,16 @@ minetest.register_globalstep(function(dtime)
end
end
end
+end
+
+local handle_active_blocks_step = 0.2
+local handle_active_blocks_timer = 0.1
+
+minetest.register_globalstep(function(dtime)
+ handle_active_blocks_timer = handle_active_blocks_timer + dtime
+ if handle_active_blocks_timer >= handle_active_blocks_step then
+ handle_active_blocks_timer = handle_active_blocks_timer - handle_active_blocks_step
+ move_entities_globalstep_part1(dtime)
+ move_entities_globalstep_part2(dtime)
+ end
end)
diff --git a/ropes/ropeboxes.lua b/ropes/ropeboxes.lua
index 9049bb1..676f1c2 100644
--- a/ropes/ropeboxes.lua
+++ b/ropes/ropeboxes.lua
@@ -225,9 +225,8 @@ local rope_def = {
drop = "",
tiles = { "ropes_3.png", "ropes_3.png", "ropes_3.png", "ropes_3.png", "ropes_5.png", "ropes_5.png" },
groups = {choppy=2, flammable=2, not_in_creative_inventory=1},
- sounds = default.node_sound_leaves_defaults(),
sounds = {
- footstep = "ropes_creak",
+ footstep = {name = "ropes_creak", gain = 0.8, max_hear_distance = 6},
dig = "__group",
dug = "__group",
},
@@ -262,7 +261,7 @@ local rope_bottom_def = {
drawtype = "nodebox",
groups = {choppy=2, flammable=2, not_in_creative_inventory=1},
sounds = {
- footstep = "ropes_creak",
+ footstep = {name = "ropes_creak", gain = 0.8, max_hear_distance = 6},
dig = "__group",
dug = "__group",
},
diff --git a/technic/machines/HV/nuclear_reactor.lua b/technic/machines/HV/nuclear_reactor.lua
index 16bb928..cea3a91 100644
--- a/technic/machines/HV/nuclear_reactor.lua
+++ b/technic/machines/HV/nuclear_reactor.lua
@@ -221,6 +221,7 @@ end
minetest.register_abm({
+ label = "Machines: reactor melt-down check",
nodenames = {"technic:hv_nuclear_reactor_core_active"},
interval = 4,
chance = 1,
diff --git a/technic/machines/MV/power_radiator.lua b/technic/machines/MV/power_radiator.lua
index 9349e66..623af34 100644
--- a/technic/machines/MV/power_radiator.lua
+++ b/technic/machines/MV/power_radiator.lua
@@ -146,6 +146,7 @@ minetest.register_node("technic:power_radiator", {
})
minetest.register_abm({
+ label = "Machines: run power radiator",
nodenames = {"technic:power_radiator"},
interval = 1,
chance = 1,
diff --git a/technic/machines/other/coal_alloy_furnace.lua b/technic/machines/other/coal_alloy_furnace.lua
index 58af679..30db8ed 100644
--- a/technic/machines/other/coal_alloy_furnace.lua
+++ b/technic/machines/other/coal_alloy_furnace.lua
@@ -70,6 +70,7 @@ minetest.register_node("technic:coal_alloy_furnace_active", {
})
minetest.register_abm({
+ label = "Machines: run coal alloy furnace",
nodenames = {"technic:coal_alloy_furnace", "technic:coal_alloy_furnace_active"},
interval = 1,
chance = 1,
diff --git a/technic/machines/other/injector.lua b/technic/machines/other/injector.lua
index ec8966c..7dc5d0c 100644
--- a/technic/machines/other/injector.lua
+++ b/technic/machines/other/injector.lua
@@ -104,6 +104,7 @@ minetest.register_node("technic:injector", {
})
minetest.register_abm({
+ label = "Machines: run injector",
nodenames = {"technic:injector"},
interval = 1,
chance = 1,
diff --git a/technic/machines/power_monitor.lua b/technic/machines/power_monitor.lua
index 4306693..8c5bed6 100644
--- a/technic/machines/power_monitor.lua
+++ b/technic/machines/power_monitor.lua
@@ -35,7 +35,7 @@ minetest.register_node("technic:power_monitor",{
minetest.register_abm({
nodenames = {"technic:power_monitor"},
- label = "Power Monitor",
+ label = "Machines: run power monitor",
interval = 1,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
diff --git a/technic/machines/switching_station.lua b/technic/machines/switching_station.lua
index dcf6849..4fbd269 100644
--- a/technic/machines/switching_station.lua
+++ b/technic/machines/switching_station.lua
@@ -436,6 +436,7 @@ local function switching_station_timeout_count(pos, tier)
end
end
minetest.register_abm({
+ label = "Machines: timeout check",
nodenames = {"group:technic_machine"},
interval = 1,
chance = 1,
@@ -461,6 +462,7 @@ minetest.register_abm({
--Re-enable disabled switching station if necessary, similar to the timeout above
minetest.register_abm({
+ label = "Machines: re-enable check",
nodenames = {"technic:switching_station"},
interval = 1,
chance = 1,
diff --git a/technic/radiation.lua b/technic/radiation.lua
index 79dfcb4..6a93483 100644
--- a/technic/radiation.lua
+++ b/technic/radiation.lua
@@ -346,6 +346,7 @@ end
if minetest.setting_getbool("enable_damage") then
minetest.register_abm({
+ label = "Radiation damage",
nodenames = {"group:radioactive"},
interval = 1,
chance = 1,
@@ -438,6 +439,7 @@ minetest.register_node("technic:chernobylite_block", {
})
minetest.register_abm({
+ label = "Corium: boil-off water (sources)",
nodenames = {"group:water"},
neighbors = {"technic:corium_source"},
interval = 1,
@@ -448,6 +450,7 @@ minetest.register_abm({
})
minetest.register_abm({
+ label = "Corium: boil-off water (flowing)",
nodenames = {"technic:corium_flowing"},
neighbors = {"group:water"},
interval = 1,
@@ -458,6 +461,7 @@ minetest.register_abm({
})
minetest.register_abm({
+ label = "Corium: become chernobylite",
nodenames = {"technic:corium_flowing"},
interval = 5,
chance = (griefing and 10 or 1),
@@ -468,6 +472,7 @@ minetest.register_abm({
if griefing then
minetest.register_abm({
+ label = "Corium: griefing",
nodenames = {"technic:corium_source", "technic:corium_flowing"},
interval = 4,
chance = 4,
diff --git a/technic/tools/tree_tap.lua b/technic/tools/tree_tap.lua
index e84fe33..ae68b56 100644
--- a/technic/tools/tree_tap.lua
+++ b/technic/tools/tree_tap.lua
@@ -62,6 +62,7 @@ minetest.register_craftitem("technic:rubber", {
})
minetest.register_abm({
+ label = "Tools: tree tap",
nodenames = {"moretrees:rubber_tree_trunk_empty"},
interval = 60,
chance = 15,
diff --git a/technic_worldgen/mg.lua b/technic_worldgen/mg.lua
index 4025384..74807d7 100644
--- a/technic_worldgen/mg.lua
+++ b/technic_worldgen/mg.lua
@@ -51,7 +51,7 @@ mg.register_ore({
mg.register_ore({
name = "technic:mineral_lead",
wherein = "default:stone",
- seeddiff = 13,
+ seeddiff = 14,
maxvdistance = 10.5,
maxheight = 16,
seglenghtn = 15,
diff --git a/technic_worldgen/rubber.lua b/technic_worldgen/rubber.lua
index 3094fa0..3307b8b 100644
--- a/technic_worldgen/rubber.lua
+++ b/technic_worldgen/rubber.lua
@@ -73,6 +73,7 @@ technic.rubber_tree_model={
minetest.register_abm({
nodenames = {"moretrees:rubber_tree_sapling"},
+ label = "Worldgen: grow rubber tree sapling",
interval = 60,
chance = 20,
action = function(pos, node)