mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-01-23 16:30:19 +01:00
[mesecons] Update mesecons
- Also fix whitespaces in default/nodes.lua
This commit is contained in:
parent
0b2f6d8453
commit
9a3a835771
@ -563,7 +563,7 @@ minetest.register_node("default:sapling", {
|
||||
type = "fixed",
|
||||
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
|
||||
},
|
||||
groups = {snappy = 3, flammable=2,
|
||||
groups = {snappy = 3, flammable=2,
|
||||
attached_node = 1, sapling = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
@ -28,11 +28,13 @@ mesecon.on_placenode = function (pos, node)
|
||||
-- Effectors: Send changesignal and activate or deactivate
|
||||
if mesecon.is_effector(node.name) then
|
||||
local powered_rules = {}
|
||||
local unpowered_rules = {}
|
||||
|
||||
-- for each input rule, check if powered
|
||||
for _, r in ipairs(mesecon.effector_get_rules(node)) do
|
||||
local powered = mesecon.is_powered(pos, r)
|
||||
if powered then table.insert(powered_rules, r) end
|
||||
if powered then table.insert(powered_rules, r)
|
||||
else table.insert(unpowered_rules, r) end
|
||||
|
||||
local state = powered and mesecon.state.on or mesecon.state.off
|
||||
mesecon.changesignal(pos, node, r, state, 1)
|
||||
@ -42,6 +44,10 @@ mesecon.on_placenode = function (pos, node)
|
||||
for _, r in ipairs(powered_rules) do
|
||||
mesecon.activate(pos, node, r, 1)
|
||||
end
|
||||
else
|
||||
for _, r in ipairs(unpowered_rules) do
|
||||
mesecon.deactivate(pos, node, r, 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,7 +1,12 @@
|
||||
-- SETTINGS
|
||||
function mesecon.setting(setting, default)
|
||||
if type(default) == "bool" then
|
||||
return minetest.setting_getbool("mesecon."..setting) or default
|
||||
if type(default) == "boolean" then
|
||||
local read = minetest.setting_getbool("mesecon."..setting)
|
||||
if read == nil then
|
||||
return default
|
||||
else
|
||||
return read
|
||||
end
|
||||
elseif type(default) == "string" then
|
||||
return minetest.setting_get("mesecon."..setting) or default
|
||||
elseif type(default) == "number" then
|
||||
|
@ -40,7 +40,7 @@ minetest.register_node("mesecons_button:button_off", {
|
||||
},
|
||||
groups = {dig_immediate=2, mesecon_needs_receiver = 1},
|
||||
description = "Button",
|
||||
on_punch = function (pos, node)
|
||||
on_rightclick = function (pos, node)
|
||||
minetest.swap_node(pos, {name = "mesecons_button:button_on", param2=node.param2})
|
||||
mesecon.receptor_on(pos, mesecon.rules.buttonlike_get(node))
|
||||
minetest.sound_play("mesecons_button_push", {pos=pos})
|
||||
|
@ -4,7 +4,7 @@
|
||||
-- All sides sticky block
|
||||
minetest.register_node("mesecons_stickyblocks:sticky_block_all", {
|
||||
description = "All-sides sticky block",
|
||||
tiles = {"default_grass_footsteps.png"},
|
||||
tiles = {"default_grass.png^default_footprint.png"},
|
||||
groups = {dig_immediate=2},
|
||||
mvps_sticky = function (pos, node)
|
||||
local connected = {}
|
||||
|
@ -4,7 +4,7 @@ mesecon.register_node("mesecons_switch:mesecon_switch", {
|
||||
paramtype2="facedir",
|
||||
description="Switch",
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_punch = function (pos, node)
|
||||
on_rightclick = function (pos, node)
|
||||
if(mesecon.flipstate(pos, node) == "on") then
|
||||
mesecon.receptor_on(pos)
|
||||
else
|
||||
|
@ -15,7 +15,7 @@ mesecon.register_node("mesecons_walllever:wall_lever", {
|
||||
fixed = { -8/16, -8/16, 3/16, 8/16, 8/16, 8/16 },
|
||||
},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_punch = function (pos, node)
|
||||
on_rightclick = function (pos, node)
|
||||
if(mesecon.flipstate(pos, node) == "on") then
|
||||
mesecon.receptor_on(pos, mesecon.rules.buttonlike_get(node))
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user