4 Commits

Author SHA1 Message Date
tour
3c3fc6749a prevent invalid rotations and add on_rotate callbacks 2025-11-15 09:57:45 +01:00
tour
46d1f500bf entity_detactor: detect stacks of dropped items 2025-11-15 09:57:45 +01:00
tour
3b0d06569d rewrite timegate to make use of nodetimers
- fixes a crash with timer=NaN
- fixes 1-tick circels with timer=0
- fixes timegates getting stuck when unloaded in on-state
2025-11-15 09:57:45 +01:00
tour
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
17 changed files with 55 additions and 32 deletions

View File

@@ -1,6 +1,6 @@
read_globals = {
-- Defined by Minetest
"minetest", "vector", "PseudoRandom", "VoxelArea", "table",
"minetest", "vector", "PseudoRandom", "VoxelArea", "table", "ItemStack",
-- Mods
"digiline", "default", "creative",

View File

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

View File

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

View File

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

View File

@@ -45,10 +45,11 @@ mesecon.register_node("moremesecons_conductor_signalchanger:conductor_signalchan
inventory_image = "moremesecons_conductor_signalchanger_off.png",
groups = {dig_immediate = 2},
paramtype = "light",
paramtype2 = "facedir",
paramtype2 = "4dir",
drawtype = "nodebox",
selection_box = nodebox,
node_box = nodebox,
on_rotate = mesecon.on_rotate,
},{
groups = {dig_immediate = 2},
mesecons = {

View File

@@ -68,7 +68,7 @@ for n,i in pairs({{0,0},{1,0},{1,1}}) do
inventory_image = top_texture,
wield_image = top_texture,
paramtype = "light",
paramtype2 = "facedir",
paramtype2 = "4dir",
drawtype = "nodebox",
node_box = {
type = "fixed",
@@ -79,6 +79,7 @@ for n,i in pairs({{0,0},{1,0},{1,1}}) do
groups = groups,
tiles = {top_texture, "moremesecons_dual_delayer_bottom.png", "moremesecons_dual_delayer_side_left.png", "moremesecons_dual_delayer_side_right.png", "moremesecons_dual_delayer_ends.png", "moremesecons_dual_delayer_ends.png"},
use_texture_alpha = use_texture_alpha,
on_rotate = mesecon.on_rotate,
mesecons = {
receptor = {
state = mesecon.state.off,

View File

@@ -46,9 +46,14 @@ local object_detector_scan = function (pos)
return true
end
local isname = luaentity.name
-- If the item is present as dropped item entity:
local bitemname = (isname == "__builtin:item" and ItemStack(luaentity.itemstring):get_name())
for _, name in ipairs(scan_names) do
if isname == name or (isname == "__builtin:item" and luaentity.itemstring == name) then
return true
if name == isname then
return true -- object name matches
end
if name == bitemname then
return true -- item of the item entity matches
end
end
end

View File

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

View File

@@ -58,6 +58,7 @@ mesecon.register_node("moremesecons_induction_transmitter:induction_transmitter"
{-0.25, -0.25, -0.5, 0.25, 0.25, -0.1875},
},
},
on_rotate = mesecon.on_rotate,
}, {
tiles = {"default_mese_block.png"},
groups = {cracky = 3},

View File

@@ -42,12 +42,13 @@ mesecon.register_node("moremesecons_injector_controller:injector_controller", {
drawtype = "nodebox",
inventory_image = "moremesecons_injector_controller_off.png",
paramtype = "light",
paramtype2 = "facedir",
paramtype2 = "4dir",
node_box = {
type = "fixed",
fixed = {{-8/16, -8/16, -8/16, 8/16, -7/16, 8/16 }},
},
on_timer = on_timer,
on_rotate = mesecon.on_rotate,
},{
tiles = {"moremesecons_injector_controller_off.png", "moremesecons_injector_controller_side.png", "moremesecons_injector_controller_side.png"},
groups = {dig_immediate=2},

View File

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

View File

@@ -41,10 +41,11 @@ mesecon.register_node("moremesecons_signalchanger:signalchanger", {
inventory_image = "moremesecons_signalchanger_off.png",
groups = {dig_immediate = 2},
paramtype = "light",
paramtype2 = "facedir",
paramtype2 = "4dir",
drawtype = "nodebox",
selection_box = nodebox,
node_box = nodebox,
on_rotate = mesecon.on_rotate,
},{
groups = {dig_immediate = 2},
mesecons = {

View File

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

View File

@@ -1,3 +1,5 @@
local MIN_DELAY = moremesecons.setting("timegate", "min_delay", 0.5)
local timegate_get_output_rules = function(node)
local rules = {{x = 0, y = 0, z = 1}}
for _ = 0, node.param2 do
@@ -14,25 +16,28 @@ local timegate_get_input_rules = function(node)
return rules
end
-- Functions that are called after the delay time
local function turnoff(pos, _, node)
if mesecon.is_receptor_on(node.name) then
node.name = "moremesecons_timegate:timegate_off"
minetest.swap_node(pos, node)
mesecon.receptor_off(pos)
end
end
local function timegate_activate(pos, node)
local function turnon(pos, node)
-- using a meta string allows writing the time in hexadecimals
local time = tonumber(minetest.get_meta(pos):get_string("time"))
if not time then
if not (time and time >= MIN_DELAY) then
return
end
node.name = "moremesecons_timegate:timegate_on"
minetest.swap_node(pos, node)
mesecon.receptor_on(pos)
minetest.after(time, function()
local node = minetest.get_node(pos)
if node.name == "moremesecons_timegate:timegate_on" then
mesecon.receptor_off(pos)
node.name = "moremesecons_timegate:timegate_off"
minetest.swap_node(pos, node)
end
end)
-- restart the timer when the input was turned off and on again
minetest.get_node_timer(pos):start(time)
if mesecon.is_receptor_off(node.name) then
node.name = "moremesecons_timegate:timegate_on"
minetest.swap_node(pos, node)
mesecon.receptor_on(pos)
end
end
local boxes = {{ -6/16, -8/16, -6/16, 6/16, -7/16, 6/16 }, -- the main slab
@@ -66,7 +71,7 @@ mesecon.register_node("moremesecons_timegate:timegate", {
fixed = boxes
},
paramtype = "light",
paramtype2 = "facedir",
paramtype2 = "4dir",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_stone_defaults(),
@@ -78,7 +83,9 @@ mesecon.register_node("moremesecons_timegate:timegate", {
and not minetest.is_protected(pos, player:get_player_name()) then
minetest.get_meta(pos):set_string("time", fields.time)
end
end
end,
on_timer = turnoff,
on_rotate = mesecon.on_rotate
},{
tiles = {
"moremesecons_timegate_off.png",
@@ -99,7 +106,7 @@ mesecon.register_node("moremesecons_timegate:timegate", {
effector =
{
rules = timegate_get_input_rules,
action_on = timegate_activate
action_on = turnon
}
},
},{
@@ -120,6 +127,7 @@ mesecon.register_node("moremesecons_timegate:timegate", {
},
effector = {
rules = timegate_get_input_rules,
action_on = turnon
}
},
})

View File

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

View File

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

View File

@@ -69,6 +69,11 @@ moremesecons_teleporter.max_p2t_distance (Maximum Player To Teleporter distance)
# from an older version which did not use it.
moremesecons_teleporter.enable_lbm (Enable Registration LBM) bool false
[Timegate]
# Minimum authorized length for the timegate signal. Timegates with a shorter time will not respond.
moremesecons_timegate.min_delay (Minimum timegate delay) float 0.5
[Wireless]
# Whether to enable the wireless jammer node