Merge server with github repository
Pas mal de changement n’ont pas été pushé sur le github du serveur, voici l’occasion de faire une bonne synchronisation :)
0
mods/mesecons/.gitignore
vendored
Executable file → Normal file
@ -1,110 +0,0 @@
|
||||
-- Object detector
|
||||
-- Detects players in a certain radius
|
||||
-- The radius can be specified in mesecons/settings.lua
|
||||
|
||||
local object_detector_make_formspec = function (pos)
|
||||
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 object_detector_on_receive_fields = function(pos, formname, fields)
|
||||
if not fields.scanname or not fields.digiline_channel then return end;
|
||||
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("scanname", fields.scanname)
|
||||
meta:set_string("digiline_channel", fields.digiline_channel)
|
||||
object_detector_make_formspec(pos)
|
||||
end
|
||||
|
||||
-- returns true if player was found, false if not
|
||||
local object_detector_scan = function (pos)
|
||||
local objs = minetest.get_objects_inside_radius(pos, OBJECT_DETECTOR_RADIUS)
|
||||
for k, obj in pairs(objs) do
|
||||
local isname = obj:get_player_name() -- "" is returned if it is not a player; "" ~= nil!
|
||||
local scanname = minetest.get_meta(pos):get_string("scanname")
|
||||
if (isname == scanname and isname ~= "") or (isname ~= "" and scanname == "") then -- player with scanname found or not scanname specified
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- set player name when receiving a digiline signal on a specific channel
|
||||
object_detector_digiline = {
|
||||
effector = {
|
||||
action = function (pos, node, channel, msg)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local active_channel = meta:get_string("digiline_channel")
|
||||
if channel == active_channel then
|
||||
meta:set_string("scanname", msg)
|
||||
object_detector_make_formspec(pos)
|
||||
end
|
||||
end,
|
||||
}
|
||||
}
|
||||
|
||||
minetest.register_node("mesecons_detector:object_detector_off", {
|
||||
tiles = {"default_steel_block.png", "default_steel_block.png", "jeija_object_detector_off.png", "jeija_object_detector_off.png", "jeija_object_detector_off.png", "jeija_object_detector_off.png"},
|
||||
paramtype = "light",
|
||||
walkable = true,
|
||||
groups = {cracky=3},
|
||||
description="Player Detector",
|
||||
mesecons = {receptor = {
|
||||
state = mesecon.state.off
|
||||
}},
|
||||
on_construct = object_detector_make_formspec,
|
||||
on_receive_fields = object_detector_on_receive_fields,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
digiline = object_detector_digiline
|
||||
})
|
||||
|
||||
minetest.register_node("mesecons_detector:object_detector_on", {
|
||||
tiles = {"default_steel_block.png", "default_steel_block.png", "jeija_object_detector_on.png", "jeija_object_detector_on.png", "jeija_object_detector_on.png", "jeija_object_detector_on.png"},
|
||||
paramtype = "light",
|
||||
walkable = true,
|
||||
groups = {cracky=3,not_in_creative_inventory=1},
|
||||
drop = 'mesecons_detector:object_detector_off',
|
||||
mesecons = {receptor = {
|
||||
state = mesecon.state.on
|
||||
}},
|
||||
on_construct = object_detector_make_formspec,
|
||||
on_receive_fields = object_detector_on_receive_fields,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
digiline = object_detector_digiline
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'mesecons_detector:object_detector_off',
|
||||
recipe = {
|
||||
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "mesecons_luacontroller:luacontroller0000", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "group:mesecon_conductor_craftable", "default:steel_ingot"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_abm(
|
||||
{nodenames = {"mesecons_detector:object_detector_off"},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
action = function(pos)
|
||||
if object_detector_scan(pos) then
|
||||
minetest.swap_node(pos, {name = "mesecons_detector:object_detector_on"})
|
||||
mesecon:receptor_on(pos)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm(
|
||||
{nodenames = {"mesecons_detector:object_detector_on"},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
action = function(pos)
|
||||
if not object_detector_scan(pos) then
|
||||
minetest.swap_node(pos, {name = "mesecons_detector:object_detector_off"})
|
||||
mesecon:receptor_off(pos)
|
||||
end
|
||||
end,
|
||||
})
|
0
mods/mesecons/LICENSE.txt
Executable file → Normal file
0
mods/mesecons/README.md
Executable file → Normal file
0
mods/mesecons/mesecons/VERSION
Executable file → Normal file
0
mods/mesecons/mesecons/actionqueue.lua
Executable file → Normal file
0
mods/mesecons/mesecons/depends.txt
Executable file → Normal file
7
mods/mesecons/mesecons/init.lua
Executable file → Normal file
@ -131,12 +131,11 @@ function mesecon:receptor_off(pos, rules)
|
||||
mesecon.queue:add_action(pos, "receptor_off", {rules}, nil, rules)
|
||||
end
|
||||
|
||||
|
||||
print("[OK] Mesecons")
|
||||
|
||||
--The actual wires
|
||||
dofile(minetest.get_modpath("mesecons").."/wires.lua");
|
||||
|
||||
--Services like turnoff receptor on dignode and so on
|
||||
dofile(minetest.get_modpath("mesecons").."/services.lua");
|
||||
|
||||
if minetest.setting_getbool("log_mods") then
|
||||
minetest.log("action", "Carbone: [mesecons] loaded.")
|
||||
end
|
||||
|
8
mods/mesecons/mesecons/internal.lua
Executable file → Normal file
@ -367,6 +367,7 @@ end
|
||||
|
||||
function mesecon:turnon(pos, rulename, recdepth)
|
||||
recdepth = recdepth or 2
|
||||
if (recdepth > STACK_SIZE) then return end
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if(node.name == "ignore") then
|
||||
@ -417,6 +418,7 @@ end)
|
||||
|
||||
function mesecon:turnoff(pos, rulename, recdepth)
|
||||
recdepth = recdepth or 2
|
||||
if (recdepth > STACK_SIZE) then return end
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if(node.name == "ignore") then
|
||||
@ -477,7 +479,9 @@ function mesecon:connected_to_receptor(pos, rulename)
|
||||
return false
|
||||
end
|
||||
|
||||
function mesecon:find_receptor_on(pos, checked, rulename)
|
||||
function mesecon:find_receptor_on(pos, checked, rulename, recdepth)
|
||||
recdepth = recdepth or 2
|
||||
if (recdepth > STACK_SIZE) then return true end -- ignore request
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if mesecon:is_receptor_on(node.name) then
|
||||
@ -501,7 +505,7 @@ function mesecon:find_receptor_on(pos, checked, rulename)
|
||||
local rulenames = mesecon:rules_link_rule_all_inverted(pos, rule)
|
||||
for _, rname in ipairs(rulenames) do
|
||||
local np = mesecon:addPosRule(pos, rname)
|
||||
if mesecon:find_receptor_on(np, checked, mesecon:invertRule(rname)) then
|
||||
if mesecon:find_receptor_on(np, checked, mesecon:invertRule(rname), recdepth + 1) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
0
mods/mesecons/mesecons/legacy.lua
Executable file → Normal file
0
mods/mesecons/mesecons/oldwires.lua
Executable file → Normal file
0
mods/mesecons/mesecons/presets.lua
Executable file → Normal file
0
mods/mesecons/mesecons/services.lua
Executable file → Normal file
2
mods/mesecons/mesecons/settings.lua
Executable file → Normal file
@ -10,3 +10,5 @@ MESECONS_RESUMETIME = 4 -- time to wait when starting the server before
|
||||
OVERHEAT_MAX = 20 -- maximum heat of any component that directly sends an output
|
||||
-- signal when the input changes (e.g. luacontroller, gates)
|
||||
-- Unit: actions per second, checks are every 1 second
|
||||
STACK_SIZE = 3000 -- Recursive functions will abort when this is reached. Therefore,
|
||||
-- this is also limits the maximum circuit size.
|
||||
|
BIN
mods/mesecons/mesecons/textures/jeija_fiber.png
Executable file → Normal file
Before Width: | Height: | Size: 431 B After Width: | Height: | Size: 592 B |
BIN
mods/mesecons/mesecons/textures/jeija_glue.png
Executable file → Normal file
Before Width: | Height: | Size: 434 B After Width: | Height: | Size: 487 B |
BIN
mods/mesecons/mesecons/textures/jeija_mesecon_crossing_off.png
Executable file → Normal file
Before Width: | Height: | Size: 288 B After Width: | Height: | Size: 341 B |
BIN
mods/mesecons/mesecons/textures/jeija_mesecon_crossing_on.png
Executable file → Normal file
Before Width: | Height: | Size: 287 B After Width: | Height: | Size: 340 B |
BIN
mods/mesecons/mesecons/textures/jeija_mesecon_curved_off.png
Executable file → Normal file
Before Width: | Height: | Size: 254 B After Width: | Height: | Size: 307 B |
BIN
mods/mesecons/mesecons/textures/jeija_mesecon_curved_on.png
Executable file → Normal file
Before Width: | Height: | Size: 254 B After Width: | Height: | Size: 307 B |
BIN
mods/mesecons/mesecons/textures/jeija_mesecon_inverter_off.png
Executable file → Normal file
Before Width: | Height: | Size: 537 B After Width: | Height: | Size: 743 B |
BIN
mods/mesecons/mesecons/textures/jeija_mesecon_inverter_on.png
Executable file → Normal file
Before Width: | Height: | Size: 514 B After Width: | Height: | Size: 725 B |
BIN
mods/mesecons/mesecons/textures/jeija_mesecon_off.png
Executable file → Normal file
Before Width: | Height: | Size: 151 B After Width: | Height: | Size: 204 B |
BIN
mods/mesecons/mesecons/textures/jeija_mesecon_on.png
Executable file → Normal file
Before Width: | Height: | Size: 143 B After Width: | Height: | Size: 196 B |
BIN
mods/mesecons/mesecons/textures/jeija_mesecon_plug.png
Executable file → Normal file
Before Width: | Height: | Size: 533 B After Width: | Height: | Size: 713 B |
BIN
mods/mesecons/mesecons/textures/jeija_mesecon_socket_off.png
Executable file → Normal file
Before Width: | Height: | Size: 580 B After Width: | Height: | Size: 751 B |
BIN
mods/mesecons/mesecons/textures/jeija_mesecon_socket_on.png
Executable file → Normal file
Before Width: | Height: | Size: 546 B After Width: | Height: | Size: 737 B |
BIN
mods/mesecons/mesecons/textures/jeija_mesecon_switch_off.png
Executable file → Normal file
Before Width: | Height: | Size: 505 B After Width: | Height: | Size: 598 B |
BIN
mods/mesecons/mesecons/textures/jeija_mesecon_switch_on.png
Executable file → Normal file
Before Width: | Height: | Size: 618 B After Width: | Height: | Size: 692 B |
BIN
mods/mesecons/mesecons/textures/jeija_mesecon_switch_side.png
Executable file → Normal file
Before Width: | Height: | Size: 253 B After Width: | Height: | Size: 553 B |
BIN
mods/mesecons/mesecons/textures/jeija_mesecon_t_junction_off.png
Executable file → Normal file
Before Width: | Height: | Size: 277 B After Width: | Height: | Size: 330 B |
BIN
mods/mesecons/mesecons/textures/jeija_mesecon_t_junction_on.png
Executable file → Normal file
Before Width: | Height: | Size: 266 B After Width: | Height: | Size: 319 B |
BIN
mods/mesecons/mesecons/textures/jeija_silicon.png
Executable file → Normal file
Before Width: | Height: | Size: 636 B After Width: | Height: | Size: 867 B |
BIN
mods/mesecons/mesecons/textures/wires_bump_off.png
Executable file → Normal file
Before Width: | Height: | Size: 307 B After Width: | Height: | Size: 347 B |
BIN
mods/mesecons/mesecons/textures/wires_bump_on.png
Executable file → Normal file
Before Width: | Height: | Size: 346 B After Width: | Height: | Size: 386 B |
BIN
mods/mesecons/mesecons/textures/wires_full_off.png
Executable file → Normal file
Before Width: | Height: | Size: 378 B After Width: | Height: | Size: 465 B |
BIN
mods/mesecons/mesecons/textures/wires_full_on.png
Executable file → Normal file
Before Width: | Height: | Size: 366 B After Width: | Height: | Size: 464 B |
BIN
mods/mesecons/mesecons/textures/wires_inv.png
Executable file → Normal file
Before Width: | Height: | Size: 124 B After Width: | Height: | Size: 167 B |
BIN
mods/mesecons/mesecons/textures/wires_off.png
Executable file → Normal file
Before Width: | Height: | Size: 379 B After Width: | Height: | Size: 454 B |
BIN
mods/mesecons/mesecons/textures/wires_on.png
Executable file → Normal file
Before Width: | Height: | Size: 381 B After Width: | Height: | Size: 492 B |
BIN
mods/mesecons/mesecons/textures/wires_vertical_off.png
Executable file → Normal file
Before Width: | Height: | Size: 315 B After Width: | Height: | Size: 373 B |
BIN
mods/mesecons/mesecons/textures/wires_vertical_on.png
Executable file → Normal file
Before Width: | Height: | Size: 338 B After Width: | Height: | Size: 396 B |
0
mods/mesecons/mesecons/util.lua
Executable file → Normal file
0
mods/mesecons/mesecons/wires.lua
Executable file → Normal file
0
mods/mesecons/mesecons_alias/depends.txt
Executable file → Normal file
2
mods/mesecons/mesecons_alias/init.lua
Executable file → Normal file
@ -28,7 +28,7 @@ minetest.register_alias("mesecons:delayer", "mesecons_delayer:delayer_off_1")
|
||||
minetest.register_alias("mesecons:solarpanel", "mesecons_solarpanel:solar_panel_off")
|
||||
|
||||
|
||||
-- Backwards compatibility
|
||||
--Backwards compatibility
|
||||
minetest.register_alias("mesecons:mesecon_off", "mesecons:wire_00000000_off")
|
||||
minetest.register_alias("mesecons_pistons:piston_sticky", "mesecons_pistons:piston_sticky_on")
|
||||
minetest.register_alias("mesecons_pistons:piston_normal", "mesecons_pistons:piston_normal_on")
|
||||
|
0
mods/mesecons/.mesecons_blinkyplant/depends.txt → mods/mesecons/mesecons_blinkyplant/depends.txt
Executable file → Normal file
28
mods/mesecons/.mesecons_blinkyplant/init.lua → mods/mesecons/mesecons_blinkyplant/init.lua
Executable file → Normal file
@ -77,26 +77,22 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_abm(
|
||||
{nodenames = {"mesecons_blinkyplant:blinky_plant_off"},
|
||||
minetest.register_abm({
|
||||
nodenames = {
|
||||
"mesecons_blinkyplant:blinky_plant_off",
|
||||
"mesecons_blinkyplant:blinky_plant_on"
|
||||
},
|
||||
interval = BLINKY_PLANT_INTERVAL,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
--minetest.remove_node(pos)
|
||||
minetest.add_node(pos, {name="mesecons_blinkyplant:blinky_plant_on"})
|
||||
if node.name == "mesecons_blinkyplant:blinky_plant_off" then
|
||||
minetest.add_node(pos, {name="mesecons_blinkyplant:blinky_plant_on"})
|
||||
mesecon:receptor_on(pos)
|
||||
else
|
||||
minetest.add_node(pos, {name="mesecons_blinkyplant:blinky_plant_off"})
|
||||
mesecon:receptor_off(pos)
|
||||
end
|
||||
nodeupdate(pos)
|
||||
mesecon:receptor_on(pos)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"mesecons_blinkyplant:blinky_plant_on"},
|
||||
interval = BLINKY_PLANT_INTERVAL,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
--minetest.remove_node(pos)
|
||||
minetest.add_node(pos, {name="mesecons_blinkyplant:blinky_plant_off"})
|
||||
nodeupdate(pos)
|
||||
mesecon:receptor_off(pos)
|
||||
end,
|
||||
})
|
Before Width: | Height: | Size: 454 B After Width: | Height: | Size: 454 B |
Before Width: | Height: | Size: 463 B After Width: | Height: | Size: 463 B |
0
mods/mesecons/mesecons_button/depends.txt
Executable file → Normal file
0
mods/mesecons/mesecons_button/init.lua
Executable file → Normal file
0
mods/mesecons/mesecons_button/sounds/mesecons_button_pop.ogg
Executable file → Normal file
0
mods/mesecons/mesecons_button/sounds/mesecons_button_push.ogg
Executable file → Normal file
BIN
mods/mesecons/mesecons_button/textures/jeija_wall_button_off.png
Executable file → Normal file
Before Width: | Height: | Size: 371 B After Width: | Height: | Size: 411 B |
BIN
mods/mesecons/mesecons_button/textures/jeija_wall_button_on.png
Executable file → Normal file
Before Width: | Height: | Size: 409 B After Width: | Height: | Size: 449 B |
BIN
mods/mesecons/mesecons_button/textures/jeija_wall_button_sides.png
Executable file → Normal file
Before Width: | Height: | Size: 229 B After Width: | Height: | Size: 434 B |
0
mods/mesecons/mesecons_commandblock/depends.txt
Executable file → Normal file
60
mods/mesecons/mesecons_commandblock/init.lua
Executable file → Normal file
@ -1,34 +1,46 @@
|
||||
minetest.register_chatcommand("say", {
|
||||
params = "<text>",
|
||||
description = "Say <text> as the server",
|
||||
privs = {server = true},
|
||||
privs = {server=true},
|
||||
func = function(name, param)
|
||||
minetest.chat_send_all("*** " .. param)
|
||||
minetest.log("action", name .. " broadcasts \"" .. param .. "\".")
|
||||
minetest.chat_send_all(name .. ": " .. param)
|
||||
end
|
||||
})
|
||||
|
||||
if minetest.setting_getbool("enable_damage") then
|
||||
minetest.register_chatcommand("hp", {
|
||||
params = "<name> <value>",
|
||||
description = "Set health of <name> to <value> HP",
|
||||
privs = {ban = true},
|
||||
func = function(name, param)
|
||||
local found, _, target, value = param:find("^([^%s]+)%s+(%d+)$")
|
||||
if found == nil then
|
||||
minetest.chat_send_player(name, "Invalid usage: /hp <name> <value>")
|
||||
return
|
||||
end
|
||||
local player = minetest.get_player_by_name(target)
|
||||
if player then
|
||||
player:set_hp(value)
|
||||
minetest.log("action", name .. " sets " .. target .. "'s HP to " .. value .. ".")
|
||||
else
|
||||
minetest.chat_send_player(name, "Invalid target: " .. target)
|
||||
end
|
||||
minetest.register_chatcommand("tell", {
|
||||
params = "<name> <text>",
|
||||
description = "Say <text> to <name> privately",
|
||||
func = function(name, param)
|
||||
local found, _, target, message = param:find("^([^%s]+)%s+(.*)$")
|
||||
if found == nil then
|
||||
minetest.chat_send_player(name, "Invalid usage: " .. param)
|
||||
return
|
||||
end
|
||||
})
|
||||
end
|
||||
if not minetest.get_player_by_name(target) then
|
||||
minetest.chat_send_player(name, "Invalid target: " .. target)
|
||||
end
|
||||
minetest.chat_send_player(target, name .. " whispers: " .. message, false)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("hp", {
|
||||
params = "<name> <value>",
|
||||
description = "Set health of <name> to <value> hitpoints",
|
||||
privs = {ban=true},
|
||||
func = function(name, param)
|
||||
local found, _, target, value = param:find("^([^%s]+)%s+(%d+)$")
|
||||
if found == nil then
|
||||
minetest.chat_send_player(name, "Invalid usage: " .. param)
|
||||
return
|
||||
end
|
||||
local player = minetest.get_player_by_name(target)
|
||||
if player then
|
||||
player:set_hp(value)
|
||||
else
|
||||
minetest.chat_send_player(name, "Invalid target: " .. target)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
local function initialize_data(meta)
|
||||
local commands = meta:get_string("commands")
|
||||
@ -67,7 +79,7 @@ local function after_place(pos, placer)
|
||||
end
|
||||
|
||||
local function receive_fields(pos, formname, fields, sender)
|
||||
if fields.quit then
|
||||
if not fields.submit then
|
||||
return
|
||||
end
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
BIN
mods/mesecons/mesecons_commandblock/textures/jeija_close_window.png
Executable file → Normal file
Before Width: | Height: | Size: 194 B After Width: | Height: | Size: 323 B |
BIN
mods/mesecons/mesecons_commandblock/textures/jeija_commandblock_off.png
Executable file → Normal file
Before Width: | Height: | Size: 194 B After Width: | Height: | Size: 282 B |
BIN
mods/mesecons/mesecons_commandblock/textures/jeija_commandblock_on.png
Executable file → Normal file
Before Width: | Height: | Size: 193 B After Width: | Height: | Size: 278 B |
0
mods/mesecons/mesecons_compatibility/depends.txt
Executable file → Normal file
0
mods/mesecons/mesecons_compatibility/init.lua
Executable file → Normal file
0
mods/mesecons/mesecons_delayer/depends.txt
Executable file → Normal file
0
mods/mesecons/mesecons_delayer/init.lua
Executable file → Normal file
BIN
mods/mesecons/mesecons_delayer/textures/mesecons_delayer_bottom.png
Executable file → Normal file
Before Width: | Height: | Size: 221 B After Width: | Height: | Size: 438 B |
BIN
mods/mesecons/mesecons_delayer/textures/mesecons_delayer_ends_off.png
Executable file → Normal file
Before Width: | Height: | Size: 186 B After Width: | Height: | Size: 226 B |
BIN
mods/mesecons/mesecons_delayer/textures/mesecons_delayer_ends_on.png
Executable file → Normal file
Before Width: | Height: | Size: 188 B After Width: | Height: | Size: 228 B |
BIN
mods/mesecons/mesecons_delayer/textures/mesecons_delayer_off_1.png
Executable file → Normal file
Before Width: | Height: | Size: 448 B After Width: | Height: | Size: 562 B |
BIN
mods/mesecons/mesecons_delayer/textures/mesecons_delayer_off_2.png
Executable file → Normal file
Before Width: | Height: | Size: 449 B After Width: | Height: | Size: 558 B |
BIN
mods/mesecons/mesecons_delayer/textures/mesecons_delayer_off_3.png
Executable file → Normal file
Before Width: | Height: | Size: 448 B After Width: | Height: | Size: 561 B |
BIN
mods/mesecons/mesecons_delayer/textures/mesecons_delayer_off_4.png
Executable file → Normal file
Before Width: | Height: | Size: 446 B After Width: | Height: | Size: 556 B |
BIN
mods/mesecons/mesecons_delayer/textures/mesecons_delayer_on_1.png
Executable file → Normal file
Before Width: | Height: | Size: 544 B After Width: | Height: | Size: 635 B |
BIN
mods/mesecons/mesecons_delayer/textures/mesecons_delayer_on_2.png
Executable file → Normal file
Before Width: | Height: | Size: 544 B After Width: | Height: | Size: 632 B |
BIN
mods/mesecons/mesecons_delayer/textures/mesecons_delayer_on_3.png
Executable file → Normal file
Before Width: | Height: | Size: 544 B After Width: | Height: | Size: 635 B |
BIN
mods/mesecons/mesecons_delayer/textures/mesecons_delayer_on_4.png
Executable file → Normal file
Before Width: | Height: | Size: 539 B After Width: | Height: | Size: 630 B |
BIN
mods/mesecons/mesecons_delayer/textures/mesecons_delayer_sides_off.png
Executable file → Normal file
Before Width: | Height: | Size: 189 B After Width: | Height: | Size: 229 B |
BIN
mods/mesecons/mesecons_delayer/textures/mesecons_delayer_sides_on.png
Executable file → Normal file
Before Width: | Height: | Size: 194 B After Width: | Height: | Size: 234 B |
0
mods/mesecons/.mesecons_detector/depends.txt → mods/mesecons/mesecons_detector/depends.txt
Executable file → Normal file
266
mods/mesecons/mesecons_detector/init.lua
Normal file
@ -0,0 +1,266 @@
|
||||
local GET_COMMAND = "GET"
|
||||
|
||||
-- Object detector
|
||||
-- Detects players in a certain radius
|
||||
-- The radius can be specified in mesecons/settings.lua
|
||||
|
||||
local object_detector_make_formspec = function (pos)
|
||||
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 object_detector_on_receive_fields = function(pos, formname, fields)
|
||||
if not fields.scanname or not fields.digiline_channel then return end;
|
||||
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("scanname", fields.scanname)
|
||||
meta:set_string("digiline_channel", fields.digiline_channel)
|
||||
object_detector_make_formspec(pos)
|
||||
end
|
||||
|
||||
-- returns true if player was found, false if not
|
||||
local object_detector_scan = function (pos)
|
||||
local objs = minetest.get_objects_inside_radius(pos, OBJECT_DETECTOR_RADIUS)
|
||||
for k, obj in pairs(objs) do
|
||||
local isname = obj:get_player_name() -- "" is returned if it is not a player; "" ~= nil!
|
||||
local scanname = minetest.get_meta(pos):get_string("scanname")
|
||||
if (isname == scanname and isname ~= "") or (isname ~= "" and scanname == "") then -- player with scanname found or not scanname specified
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- set player name when receiving a digiline signal on a specific channel
|
||||
local object_detector_digiline = {
|
||||
effector = {
|
||||
action = function (pos, node, channel, msg)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local active_channel = meta:get_string("digiline_channel")
|
||||
if channel == active_channel then
|
||||
meta:set_string("scanname", msg)
|
||||
object_detector_make_formspec(pos)
|
||||
end
|
||||
end,
|
||||
}
|
||||
}
|
||||
|
||||
minetest.register_node("mesecons_detector:object_detector_off", {
|
||||
tiles = {"default_steel_block.png", "default_steel_block.png", "jeija_object_detector_off.png", "jeija_object_detector_off.png", "jeija_object_detector_off.png", "jeija_object_detector_off.png"},
|
||||
paramtype = "light",
|
||||
walkable = true,
|
||||
groups = {cracky=3},
|
||||
description="Player Detector",
|
||||
mesecons = {receptor = {
|
||||
state = mesecon.state.off
|
||||
}},
|
||||
on_construct = object_detector_make_formspec,
|
||||
on_receive_fields = object_detector_on_receive_fields,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
digiline = object_detector_digiline
|
||||
})
|
||||
|
||||
minetest.register_node("mesecons_detector:object_detector_on", {
|
||||
tiles = {"default_steel_block.png", "default_steel_block.png", "jeija_object_detector_on.png", "jeija_object_detector_on.png", "jeija_object_detector_on.png", "jeija_object_detector_on.png"},
|
||||
paramtype = "light",
|
||||
walkable = true,
|
||||
groups = {cracky=3,not_in_creative_inventory=1},
|
||||
drop = 'mesecons_detector:object_detector_off',
|
||||
mesecons = {receptor = {
|
||||
state = mesecon.state.on
|
||||
}},
|
||||
on_construct = object_detector_make_formspec,
|
||||
on_receive_fields = object_detector_on_receive_fields,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
digiline = object_detector_digiline
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'mesecons_detector:object_detector_off',
|
||||
recipe = {
|
||||
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "mesecons_luacontroller:luacontroller0000", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "group:mesecon_conductor_craftable", "default:steel_ingot"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_abm(
|
||||
{nodenames = {"mesecons_detector:object_detector_off"},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
action = function(pos)
|
||||
if object_detector_scan(pos) then
|
||||
minetest.swap_node(pos, {name = "mesecons_detector:object_detector_on"})
|
||||
mesecon:receptor_on(pos)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm(
|
||||
{nodenames = {"mesecons_detector:object_detector_on"},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
action = function(pos)
|
||||
if not object_detector_scan(pos) then
|
||||
minetest.swap_node(pos, {name = "mesecons_detector:object_detector_off"})
|
||||
mesecon:receptor_off(pos)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- Node detector
|
||||
-- Detects the node in front of it
|
||||
|
||||
local node_detector_make_formspec = function (pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
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}]"..
|
||||
"button_exit[7,0.75;2,3;;Save]")
|
||||
end
|
||||
|
||||
local node_detector_on_receive_fields = function(pos, formname, fields)
|
||||
if not fields.scanname or not fields.digiline_channel then return end;
|
||||
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("scanname", fields.scanname)
|
||||
meta:set_string("digiline_channel", fields.digiline_channel)
|
||||
node_detector_make_formspec(pos)
|
||||
end
|
||||
|
||||
-- returns true if player was found, false if not
|
||||
local node_detector_scan = function (pos)
|
||||
local node = minetest.get_node(pos)
|
||||
local frontpos = vector.subtract(pos, minetest.facedir_to_dir(node.param2))
|
||||
local frontnode = minetest.get_node(frontpos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
return (frontnode.name == meta:get_string("scanname")) or
|
||||
(frontnode.name ~= "air" and frontnode.name ~= "ignore" and meta:get_string("scanname") == "")
|
||||
end
|
||||
|
||||
-- set player name when receiving a digiline signal on a specific channel
|
||||
local node_detector_digiline = {
|
||||
effector = {
|
||||
action = function (pos, node, channel, msg)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local active_channel = meta:get_string("digiline_channel")
|
||||
if channel == active_channel then
|
||||
if msg == GET_COMMAND then
|
||||
local frontpos = vector.subtract(pos, minetest.facedir_to_dir(node.param2))
|
||||
local name = minetest.get_node(frontpos).name
|
||||
digiline:receptor_send(pos, digiline.rules.default, channel, name)
|
||||
else
|
||||
meta:set_string("scanname", msg)
|
||||
node_detector_make_formspec(pos)
|
||||
end
|
||||
end
|
||||
end,
|
||||
},
|
||||
receptor = {}
|
||||
}
|
||||
|
||||
minetest.register_node("mesecons_detector:node_detector_off", {
|
||||
tiles = {"default_steel_block.png", "default_steel_block.png", "default_steel_block.png", "default_steel_block.png", "default_steel_block.png", "jeija_node_detector_off.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
walkable = true,
|
||||
groups = {cracky=3},
|
||||
description="Node Detector",
|
||||
mesecons = {receptor = {
|
||||
state = mesecon.state.off
|
||||
}},
|
||||
on_construct = node_detector_make_formspec,
|
||||
on_receive_fields = node_detector_on_receive_fields,
|
||||
after_place_node = function (pos, placer)
|
||||
local placer_pos = placer:getpos()
|
||||
|
||||
--correct for the player's height
|
||||
if placer:is_player() then placer_pos.y = placer_pos.y + 1.5 end
|
||||
|
||||
--correct for 6d facedir
|
||||
if placer_pos then
|
||||
local dir = {
|
||||
x = pos.x - placer_pos.x,
|
||||
y = pos.y - placer_pos.y,
|
||||
z = pos.z - placer_pos.z
|
||||
}
|
||||
local node = minetest.get_node(pos)
|
||||
node.param2 = minetest.dir_to_facedir(dir, true)
|
||||
minetest.set_node(pos, node)
|
||||
minetest.log("action", "real (6d) facedir: " .. node.param2)
|
||||
end
|
||||
end,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
digiline = node_detector_digiline
|
||||
})
|
||||
|
||||
minetest.register_node("mesecons_detector:node_detector_on", {
|
||||
tiles = {"default_steel_block.png", "default_steel_block.png", "default_steel_block.png", "default_steel_block.png", "default_steel_block.png", "jeija_node_detector_on.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
walkable = true,
|
||||
groups = {cracky=3,not_in_creative_inventory=1},
|
||||
drop = 'mesecons_detector:node_detector_off',
|
||||
mesecons = {receptor = {
|
||||
state = mesecon.state.on
|
||||
}},
|
||||
on_construct = node_detector_make_formspec,
|
||||
on_receive_fields = node_detector_on_receive_fields,
|
||||
after_place_node = function (pos, placer)
|
||||
local placer_pos = placer:getpos()
|
||||
|
||||
--correct for the player's height
|
||||
if placer:is_player() then placer_pos.y = placer_pos.y + 1.5 end
|
||||
|
||||
--correct for 6d facedir
|
||||
if placer_pos then
|
||||
local dir = {
|
||||
x = pos.x - placer_pos.x,
|
||||
y = pos.y - placer_pos.y,
|
||||
z = pos.z - placer_pos.z
|
||||
}
|
||||
local node = minetest.get_node(pos)
|
||||
node.param2 = minetest.dir_to_facedir(dir, true)
|
||||
minetest.set_node(pos, node)
|
||||
minetest.log("action", "real (6d) facedir: " .. node.param2)
|
||||
end
|
||||
end,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
digiline = node_detector_digiline
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'mesecons_detector:node_detector_off',
|
||||
recipe = {
|
||||
{"default:steel_ingot", "group:mesecon_conductor_craftable", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "mesecons_luacontroller:luacontroller0000", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_abm(
|
||||
{nodenames = {"mesecons_detector:node_detector_off"},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
action = function(pos, node)
|
||||
if node_detector_scan(pos) then
|
||||
minetest.swap_node(pos, {name = "mesecons_detector:node_detector_on", param2 = node.param2})
|
||||
mesecon:receptor_on(pos)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm(
|
||||
{nodenames = {"mesecons_detector:node_detector_on"},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
action = function(pos, node)
|
||||
if not node_detector_scan(pos) then
|
||||
minetest.swap_node(pos, {name = "mesecons_detector:node_detector_off", param2 = node.param2})
|
||||
mesecon:receptor_off(pos)
|
||||
end
|
||||
end,
|
||||
})
|
After Width: | Height: | Size: 717 B |
After Width: | Height: | Size: 727 B |
Before Width: | Height: | Size: 712 B After Width: | Height: | Size: 712 B |
Before Width: | Height: | Size: 735 B After Width: | Height: | Size: 735 B |
0
mods/mesecons/mesecons_extrawires/corner.lua
Executable file → Normal file
0
mods/mesecons/mesecons_extrawires/crossover.lua
Executable file → Normal file
0
mods/mesecons/mesecons_extrawires/depends.txt
Executable file → Normal file
0
mods/mesecons/mesecons_extrawires/init.lua
Executable file → Normal file
@ -13,7 +13,6 @@ minetest.register_node(":default:mese", {
|
||||
tiles = {minetest.registered_nodes["default:mese"].tiles[1]},
|
||||
is_ground_content = true,
|
||||
groups = {cracky=1},
|
||||
light_source = 7,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
mesecons = {conductor = {
|
||||
state = mesecon.state.off,
|
||||
|
0
mods/mesecons/mesecons_extrawires/tjunction.lua
Executable file → Normal file
0
mods/mesecons/mesecons_extrawires/vertical.lua
Executable file → Normal file
0
mods/mesecons/.mesecons_gates/depends.txt → mods/mesecons/mesecons_gates/depends.txt
Executable file → Normal file
0
mods/mesecons/.mesecons_gates/init.lua → mods/mesecons/mesecons_gates/init.lua
Executable file → Normal file
0
mods/mesecons/.mesecons_gates/textures/jeija_gate_and.png → mods/mesecons/mesecons_gates/textures/jeija_gate_and.png
Executable file → Normal file
Before Width: | Height: | Size: 233 B After Width: | Height: | Size: 233 B |
0
mods/mesecons/.mesecons_gates/textures/jeija_gate_diode.png → mods/mesecons/mesecons_gates/textures/jeija_gate_diode.png
Executable file → Normal file
Before Width: | Height: | Size: 231 B After Width: | Height: | Size: 231 B |
0
mods/mesecons/.mesecons_gates/textures/jeija_gate_nand.png → mods/mesecons/mesecons_gates/textures/jeija_gate_nand.png
Executable file → Normal file
Before Width: | Height: | Size: 251 B After Width: | Height: | Size: 251 B |
0
mods/mesecons/.mesecons_gates/textures/jeija_gate_not.png → mods/mesecons/mesecons_gates/textures/jeija_gate_not.png
Executable file → Normal file
Before Width: | Height: | Size: 241 B After Width: | Height: | Size: 241 B |
0
mods/mesecons/.mesecons_gates/textures/jeija_gate_off.png → mods/mesecons/mesecons_gates/textures/jeija_gate_off.png
Executable file → Normal file
Before Width: | Height: | Size: 195 B After Width: | Height: | Size: 195 B |
0
mods/mesecons/.mesecons_gates/textures/jeija_gate_on.png → mods/mesecons/mesecons_gates/textures/jeija_gate_on.png
Executable file → Normal file
Before Width: | Height: | Size: 195 B After Width: | Height: | Size: 195 B |