[mcl_comparators] fix warnings
parent
3fbcacac3b
commit
52b1473657
|
@ -217,94 +217,94 @@ if minetest.get_modpath("screwdriver") then
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, mode in pairs{"comp", "sub"} do
|
for _, mode in pairs{"comp", "sub"} do
|
||||||
for _, state in pairs{mesecon.state.on, mesecon.state.off} do
|
for _, state in pairs{mesecon.state.on, mesecon.state.off} do
|
||||||
local state_str = state_strs[state]
|
local state_str = state_strs[state]
|
||||||
local nodename =
|
local nodename =
|
||||||
"mcl_comparators:comparator_"..state_strs[state].."_"..mode
|
"mcl_comparators:comparator_"..state_str.."_"..mode
|
||||||
|
|
||||||
-- Help
|
-- Help
|
||||||
local longdesc, usagehelp, use_help
|
local longdesc, usagehelp, use_help
|
||||||
if state_strs[state] == "off" and mode == "comp" then
|
if state_str == "off" and mode == "comp" then
|
||||||
longdesc = S("Redstone comparators are multi-purpose redstone components.").."\n"..
|
longdesc = S("Redstone comparators are multi-purpose redstone components.").."\n"..
|
||||||
S("They can transmit a redstone signal, detect whether a block contains any items and compare multiple signals.")
|
S("They can transmit a redstone signal, detect whether a block contains any items and compare multiple signals.")
|
||||||
|
|
||||||
usagehelp = S("A redstone comparator has 1 main input, 2 side inputs and 1 output. The output is in arrow direction, the main input is in the opposite direction. The other 2 sides are the side inputs.").."\n"..
|
usagehelp = S("A redstone comparator has 1 main input, 2 side inputs and 1 output. The output is in arrow direction, the main input is in the opposite direction. The other 2 sides are the side inputs.").."\n"..
|
||||||
S("The main input can powered in 2 ways: First, it can be powered directly by redstone power like any other component. Second, it is powered if, and only if a container (like a chest) is placed in front of it and the container contains at least one item.").."\n"..
|
S("The main input can powered in 2 ways: First, it can be powered directly by redstone power like any other component. Second, it is powered if, and only if a container (like a chest) is placed in front of it and the container contains at least one item.").."\n"..
|
||||||
S("The side inputs are only powered by normal redstone power. The redstone comparator can operate in two modes: Transmission mode and subtraction mode. It starts in transmission mode and the mode can be changed by using the block.").."\n\n"..
|
S("The side inputs are only powered by normal redstone power. The redstone comparator can operate in two modes: Transmission mode and subtraction mode. It starts in transmission mode and the mode can be changed by using the block.").."\n\n"..
|
||||||
S("Transmission mode:\nThe front torch is unlit and lowered. The output is powered if, and only if the main input is powered. The two side inputs are ignored.").."\n"..
|
S("Transmission mode:\nThe front torch is unlit and lowered. The output is powered if, and only if the main input is powered. The two side inputs are ignored.").."\n"..
|
||||||
S("Subtraction mode:\nThe front torch is lit. The output is powered if, and only if the main input is powered and none of the side inputs is powered.")
|
S("Subtraction mode:\nThe front torch is lit. The output is powered if, and only if the main input is powered and none of the side inputs is powered.")
|
||||||
else
|
else
|
||||||
use_help = false
|
use_help = false
|
||||||
end
|
end
|
||||||
|
|
||||||
local nodedef = {
|
local nodedef = {
|
||||||
description = S("Redstone Comparator"),
|
description = S("Redstone Comparator"),
|
||||||
inventory_image = icon,
|
inventory_image = icon,
|
||||||
wield_image = icon,
|
wield_image = icon,
|
||||||
_doc_items_create_entry = use_help,
|
_doc_items_create_entry = use_help,
|
||||||
_doc_items_longdesc = longdesc,
|
_doc_items_longdesc = longdesc,
|
||||||
_doc_items_usagehelp = usagehelp,
|
_doc_items_usagehelp = usagehelp,
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
tiles = get_tiles(state_strs[state], mode),
|
tiles = get_tiles(state_str, mode),
|
||||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
|
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
|
||||||
wield_image = "mcl_comparators_off.png",
|
--wield_image = "mcl_comparators_off.png",
|
||||||
walkable = true,
|
walkable = true,
|
||||||
selection_box = collision_box,
|
selection_box = collision_box,
|
||||||
collision_box = collision_box,
|
collision_box = collision_box,
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = node_boxes[mode],
|
fixed = node_boxes[mode],
|
||||||
},
|
|
||||||
groups = groups,
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
sunlight_propagates = false,
|
|
||||||
is_ground_content = false,
|
|
||||||
drop = 'mcl_comparators:comparator_off_comp',
|
|
||||||
on_construct = update_self,
|
|
||||||
on_rightclick =
|
|
||||||
make_rightclick_handler(state_strs[state], mode),
|
|
||||||
comparator_mode = mode,
|
|
||||||
comparator_onstate = "mcl_comparators:comparator_on_"..mode,
|
|
||||||
comparator_offstate = "mcl_comparators:comparator_off_"..mode,
|
|
||||||
sounds = mcl_sounds.node_sound_stone_defaults(),
|
|
||||||
mesecons = {
|
|
||||||
receptor = {
|
|
||||||
state = state,
|
|
||||||
rules = comparator_get_output_rules,
|
|
||||||
},
|
},
|
||||||
effector = {
|
groups = groups,
|
||||||
rules = comparator_get_input_rules,
|
paramtype = "light",
|
||||||
action_change = update_self,
|
paramtype2 = "facedir",
|
||||||
}
|
sunlight_propagates = false,
|
||||||
},
|
is_ground_content = false,
|
||||||
on_rotate = on_rotate,
|
drop = 'mcl_comparators:comparator_off_comp',
|
||||||
}
|
on_construct = update_self,
|
||||||
|
on_rightclick =
|
||||||
|
make_rightclick_handler(state_str, mode),
|
||||||
|
comparator_mode = mode,
|
||||||
|
comparator_onstate = "mcl_comparators:comparator_on_"..mode,
|
||||||
|
comparator_offstate = "mcl_comparators:comparator_off_"..mode,
|
||||||
|
sounds = mcl_sounds.node_sound_stone_defaults(),
|
||||||
|
mesecons = {
|
||||||
|
receptor = {
|
||||||
|
state = state,
|
||||||
|
rules = comparator_get_output_rules,
|
||||||
|
},
|
||||||
|
effector = {
|
||||||
|
rules = comparator_get_input_rules,
|
||||||
|
action_change = update_self,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
on_rotate = on_rotate,
|
||||||
|
}
|
||||||
|
|
||||||
if mode == "comp" and state == mesecon.state.off then
|
if mode == "comp" and state == mesecon.state.off then
|
||||||
-- This is the prototype
|
-- This is the prototype
|
||||||
nodedef._doc_items_create_entry = true
|
nodedef._doc_items_create_entry = true
|
||||||
else
|
else
|
||||||
nodedef.groups = table.copy(nodedef.groups)
|
nodedef.groups = table.copy(nodedef.groups)
|
||||||
nodedef.groups.not_in_creative_inventory = 1
|
nodedef.groups.not_in_creative_inventory = 1
|
||||||
local extra_desc = {}
|
--local extra_desc = {}
|
||||||
if mode == "sub" or state == mesecon.state.on then
|
if mode == "sub" or state == mesecon.state.on then
|
||||||
nodedef.inventory_image = nil
|
nodedef.inventory_image = nil
|
||||||
|
end
|
||||||
|
local desc = nodedef.description
|
||||||
|
if mode ~= "sub" and state == mesecon.state.on then
|
||||||
|
desc = S("Redstone Comparator (Powered)")
|
||||||
|
elseif mode == "sub" and state ~= mesecon.state.on then
|
||||||
|
desc = S("Redstone Comparator (Subtract)")
|
||||||
|
elseif mode == "sub" and state == mesecon.state.on then
|
||||||
|
desc = S("Redstone Comparator (Subtract, Powered)")
|
||||||
|
end
|
||||||
|
nodedef.description = desc
|
||||||
end
|
end
|
||||||
local desc = nodedef.description
|
|
||||||
if mode ~= "sub" and state == mesecon.state.on then
|
minetest.register_node(nodename, nodedef)
|
||||||
desc = S("Redstone Comparator (Powered)")
|
mcl_wip.register_wip_item(nodename)
|
||||||
elseif mode == "sub" and state ~= mesecon.state.on then
|
|
||||||
desc = S("Redstone Comparator (Subtract)")
|
|
||||||
elseif mode == "sub" and state == mesecon.state.on then
|
|
||||||
desc = S("Redstone Comparator (Subtract, Powered)")
|
|
||||||
end
|
|
||||||
nodedef.description = desc
|
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node(nodename, nodedef)
|
|
||||||
mcl_wip.register_wip_item(nodename)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Register recipies
|
-- Register recipies
|
||||||
|
@ -351,9 +351,9 @@ minetest.register_abm({
|
||||||
-- Add entry aliases for the Help
|
-- Add entry aliases for the Help
|
||||||
if minetest.get_modpath("doc") then
|
if minetest.get_modpath("doc") then
|
||||||
doc.add_entry_alias("nodes", "mcl_comparators:comparator_off_comp",
|
doc.add_entry_alias("nodes", "mcl_comparators:comparator_off_comp",
|
||||||
"nodes", "mcl_comparators:comparator_off_sub")
|
"nodes", "mcl_comparators:comparator_off_sub")
|
||||||
doc.add_entry_alias("nodes", "mcl_comparators:comparator_off_comp",
|
doc.add_entry_alias("nodes", "mcl_comparators:comparator_off_comp",
|
||||||
"nodes", "mcl_comparators:comparator_on_comp")
|
"nodes", "mcl_comparators:comparator_on_comp")
|
||||||
doc.add_entry_alias("nodes", "mcl_comparators:comparator_off_comp",
|
doc.add_entry_alias("nodes", "mcl_comparators:comparator_off_comp",
|
||||||
"nodes", "mcl_comparators:comparator_on_sub")
|
"nodes", "mcl_comparators:comparator_on_sub")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue