Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Remove trailing whitespace
- Loading branch information
|
@@ -30,7 +30,7 @@ |
|
|
-- action_change = function |
|
|
-- rules = rules/get_rules |
|
|
-- }, |
|
|
-- conductor = |
|
|
-- conductor = |
|
|
-- { |
|
|
-- state = mesecon.state.on/off |
|
|
-- offstate = opposite state (for state = on only) |
|
|
|
@@ -496,7 +496,7 @@ function mesecon.find_receptor_on(pos, link) |
|
|
end |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
end |
|
|
depth = depth + 1 |
|
|
end |
|
@@ -533,7 +533,7 @@ function mesecon.rules_link_rule_all(output, rule) |
|
|
return {} |
|
|
end |
|
|
local rules = {} |
|
|
|
|
|
|
|
|
for _, inputrule in ipairs(mesecon.flattenrules(inputrules)) do |
|
|
-- Check if input accepts from output |
|
|
if mesecon.cmpPos(mesecon.addPosRule(input, inputrule), output) then |
|
@@ -552,7 +552,7 @@ function mesecon.rules_link_rule_all_inverted(input, rule) |
|
|
return {} |
|
|
end |
|
|
local rules = {} |
|
|
|
|
|
|
|
|
for _, outputrule in ipairs(mesecon.flattenrules(outputrules)) do |
|
|
if mesecon.cmpPos(mesecon.addPosRule(output, outputrule), input) then |
|
|
table.insert(rules, mesecon.invertRule(outputrule)) |
|
@@ -607,8 +607,8 @@ function mesecon.rotate_rules_right(rules) |
|
|
local nr = {} |
|
|
for i, rule in ipairs(rules) do |
|
|
table.insert(nr, { |
|
|
x = -rule.z, |
|
|
y = rule.y, |
|
|
x = -rule.z, |
|
|
y = rule.y, |
|
|
z = rule.x, |
|
|
name = rule.name}) |
|
|
end |
|
@@ -619,8 +619,8 @@ function mesecon.rotate_rules_left(rules) |
|
|
local nr = {} |
|
|
for i, rule in ipairs(rules) do |
|
|
table.insert(nr, { |
|
|
x = rule.z, |
|
|
y = rule.y, |
|
|
x = rule.z, |
|
|
y = rule.y, |
|
|
z = -rule.x, |
|
|
name = rule.name}) |
|
|
end |
|
@@ -631,8 +631,8 @@ function mesecon.rotate_rules_down(rules) |
|
|
local nr = {} |
|
|
for i, rule in ipairs(rules) do |
|
|
table.insert(nr, { |
|
|
x = -rule.y, |
|
|
y = rule.x, |
|
|
x = -rule.y, |
|
|
y = rule.x, |
|
|
z = rule.z, |
|
|
name = rule.name}) |
|
|
end |
|
@@ -643,8 +643,8 @@ function mesecon.rotate_rules_up(rules) |
|
|
local nr = {} |
|
|
for i, rule in ipairs(rules) do |
|
|
table.insert(nr, { |
|
|
x = rule.y, |
|
|
y = -rule.x, |
|
|
x = rule.y, |
|
|
y = -rule.x, |
|
|
z = rule.z, |
|
|
name = rule.name}) |
|
|
end |
|
|
|
@@ -21,7 +21,7 @@ mesecon.rules.buttonlike = |
|
|
{{x = 1, y = 0, z = 0}, |
|
|
{x = 1, y = 1, z = 0}, |
|
|
{x = 1, y =-1, z = 0}, |
|
|
{x = 1, y =-1, z = 1}, |
|
|
{x = 1, y =-1, z = 1}, |
|
|
{x = 1, y =-1, z =-1}, |
|
|
{x = 2, y = 0, z = 0}} |
|
|
|
|
@@ -38,7 +38,7 @@ mesecon.rules.alldirs = |
|
|
{x= 0, y=-1, z= 0}, |
|
|
{x= 0, y= 0, z= 1}, |
|
|
{x= 0, y= 0, z=-1}} |
|
|
|
|
|
|
|
|
mesecon.rules.buttonlike_get = function(node) |
|
|
local rules = mesecon.rules.buttonlike |
|
|
if node.param2 == 2 then |
|
|
|
@@ -129,7 +129,7 @@ function mesecon.set_bit(binary,bit,value) |
|
|
end |
|
|
end |
|
|
return binary |
|
|
|
|
|
|
|
|
end |
|
|
|
|
|
function mesecon.invertRule(r) |
|
@@ -203,7 +203,7 @@ function mesecon.flipstate(pos, node) |
|
|
local newstate |
|
|
if (nodedef.__mesecon_state == "on") then newstate = "off" end |
|
|
if (nodedef.__mesecon_state == "off") then newstate = "on" end |
|
|
|
|
|
|
|
|
minetest.swap_node(pos, {name = nodedef.__mesecon_basename .. "_" .. newstate, |
|
|
param2 = node.param2}) |
|
|
|
|
|
|
@@ -135,7 +135,7 @@ nid_inc = function (nid) |
|
|
end |
|
|
|
|
|
-- BUT: Skip impossible nodeids: |
|
|
if ((nid[0] == 0 and nid[4] == 1) or (nid[1] == 0 and nid[5] == 1) |
|
|
if ((nid[0] == 0 and nid[4] == 1) or (nid[1] == 0 and nid[5] == 1) |
|
|
or (nid[2] == 0 and nid[6] == 1) or (nid[3] == 0 and nid[7] == 1)) then |
|
|
return nid_inc(nid) |
|
|
end |
|
|
|
@@ -15,7 +15,7 @@ end |
|
|
minetest.register_node("mesecons_button:button_off", { |
|
|
drawtype = "nodebox", |
|
|
tiles = { |
|
|
"jeija_wall_button_sides.png", |
|
|
"jeija_wall_button_sides.png", |
|
|
"jeija_wall_button_sides.png", |
|
|
"jeija_wall_button_sides.png", |
|
|
"jeija_wall_button_sides.png", |
|
@@ -32,7 +32,7 @@ minetest.register_node("mesecons_button:button_off", { |
|
|
fixed = { -6/16, -6/16, 5/16, 6/16, 6/16, 8/16 } |
|
|
}, |
|
|
node_box = { |
|
|
type = "fixed", |
|
|
type = "fixed", |
|
|
fixed = { |
|
|
{ -6/16, -6/16, 6/16, 6/16, 6/16, 8/16 }, -- the thin plate behind the button |
|
|
{ -4/16, -2/16, 4/16, 4/16, 2/16, 6/16 } -- the button itself |
|
|
|
@@ -35,7 +35,7 @@ end |
|
|
|
|
|
for i = 1, 4 do |
|
|
local groups = {} |
|
|
if i == 1 then |
|
|
if i == 1 then |
|
|
groups = {bendy=2,snappy=1,dig_immediate=2} |
|
|
else |
|
|
groups = {bendy=2,snappy=1,dig_immediate=2, not_in_creative_inventory=1} |
|
|
|
@@ -182,10 +182,10 @@ minetest.register_node("mesecons_detector:node_detector_off", { |
|
|
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 = { |
|
@@ -217,10 +217,10 @@ minetest.register_node("mesecons_detector:node_detector_on", { |
|
|
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 = { |
|
|
|
@@ -10,7 +10,7 @@ local corner_selectionbox = { |
|
|
} |
|
|
|
|
|
local corner_get_rules = function (node) |
|
|
local rules = |
|
|
local rules = |
|
|
{{x = 1, y = 0, z = 0}, |
|
|
{x = 0, y = 0, z = -1}} |
|
|
|
|
@@ -39,7 +39,7 @@ minetest.register_node("mesecons_extrawires:corner_on", { |
|
|
node_box = corner_nodebox, |
|
|
groups = {dig_immediate = 3, not_in_creative_inventory = 1}, |
|
|
drop = "mesecons_extrawires:corner_off", |
|
|
mesecons = {conductor = |
|
|
mesecons = {conductor = |
|
|
{ |
|
|
state = mesecon.state.on, |
|
|
rules = corner_get_rules, |
|
@@ -65,7 +65,7 @@ minetest.register_node("mesecons_extrawires:corner_off", { |
|
|
selection_box = corner_selectionbox, |
|
|
node_box = corner_nodebox, |
|
|
groups = {dig_immediate = 3}, |
|
|
mesecons = {conductor = |
|
|
mesecons = {conductor = |
|
|
{ |
|
|
state = mesecon.state.off, |
|
|
rules = corner_get_rules, |
|
|
|
@@ -10,7 +10,7 @@ local tjunction_selectionbox = { |
|
|
} |
|
|
|
|
|
local tjunction_get_rules = function (node) |
|
|
local rules = |
|
|
local rules = |
|
|
{{x = 0, y = 0, z = 1}, |
|
|
{x = 1, y = 0, z = 0}, |
|
|
{x = 0, y = 0, z = -1}} |
|
@@ -40,7 +40,7 @@ minetest.register_node("mesecons_extrawires:tjunction_on", { |
|
|
node_box = tjunction_nodebox, |
|
|
groups = {dig_immediate = 3, not_in_creative_inventory = 1}, |
|
|
drop = "mesecons_extrawires:tjunction_off", |
|
|
mesecons = {conductor = |
|
|
mesecons = {conductor = |
|
|
{ |
|
|
state = mesecon.state.on, |
|
|
rules = tjunction_get_rules, |
|
@@ -66,7 +66,7 @@ minetest.register_node("mesecons_extrawires:tjunction_off", { |
|
|
selection_box = tjunction_selectionbox, |
|
|
node_box = tjunction_nodebox, |
|
|
groups = {dig_immediate = 3}, |
|
|
mesecons = {conductor = |
|
|
mesecons = {conductor = |
|
|
{ |
|
|
state = mesecon.state.off, |
|
|
rules = tjunction_get_rules, |
|
|
|
@@ -247,7 +247,7 @@ end |
|
|
|
|
|
local safe_globals = { |
|
|
"assert", "error", "ipairs", "next", "pairs", "pcall", "select", |
|
|
"tonumber", "tostring", "type", "unpack", "_VERSION", "xpcall", |
|
|
"tonumber", "tostring", "type", "unpack", "_VERSION", "xpcall", |
|
|
} |
|
|
local function create_environment(pos, mem, event) |
|
|
-- Gather variables for the environment |
|
|
|
@@ -262,7 +262,7 @@ function parse_get_command(code, starti) |
|
|
if s == "(" then |
|
|
return string.sub(code, starti, i-1), i + 1 -- i: ( i+1 after ( |
|
|
end |
|
|
if s == ";" and starti == i then |
|
|
if s == ";" and starti == i then |
|
|
starti = starti + 1 |
|
|
i = starti |
|
|
elseif s == ">" then |
|
@@ -410,7 +410,7 @@ function yc_command_sbi(params, eeprom, L, Lv) |
|
|
--is an eeprom address |
|
|
local new_eeprom = ""; |
|
|
for i=1, #eeprom do |
|
|
if tonumber(params[1])==i then |
|
|
if tonumber(params[1])==i then |
|
|
new_eeprom = new_eeprom..status |
|
|
else |
|
|
new_eeprom = new_eeprom..eeprom:sub(i, i) |
|
@@ -476,7 +476,7 @@ function yc_command_if_getcondition(code, starti) |
|
|
local brackets = 1 --1 Bracket to close |
|
|
while s ~= "" do |
|
|
s = string.sub(code, i, i) |
|
|
|
|
|
|
|
|
if s == ")" then |
|
|
brackets = brackets - 1 |
|
|
end |
|
@@ -539,7 +539,7 @@ function yc_command_parsecondition(cond, L, eeprom) |
|
|
i = i + 1 |
|
|
end |
|
|
|
|
|
local i = 2 |
|
|
local i = 2 |
|
|
local l = string.len(cond) |
|
|
while i<=l do |
|
|
local s = cond:sub(i,i) |
|
@@ -612,12 +612,12 @@ function yc_action_setports(pos, L, Lv) |
|
|
if L.b == true then mesecon.receptor_on(pos, rules) |
|
|
else mesecon.receptor_off(pos, rules) end |
|
|
end |
|
|
if Lv.c ~= L.c then |
|
|
if Lv.c ~= L.c then |
|
|
rules = microc_rules[name.."0100"] |
|
|
if L.c == true then mesecon.receptor_on(pos, rules) |
|
|
else mesecon.receptor_off(pos, rules) end |
|
|
end |
|
|
if Lv.d ~= L.d then |
|
|
if Lv.d ~= L.d then |
|
|
rules = microc_rules[name.."1000"] |
|
|
if L.d == true then mesecon.receptor_on(pos, rules) |
|
|
else mesecon.receptor_off(pos, rules) end |
|
|
|
@@ -74,7 +74,7 @@ function mesecon.register_movestone(name, def, is_sticky) |
|
|
local maxpush = mesecon.setting("movestone_max_push", 50) |
|
|
local maxpull = mesecon.setting("movestone_max_pull", 50) |
|
|
local success, stack, oldstack = mesecon.mvps_push(frontpos, direction, maxpush) |
|
|
if success then |
|
|
if success then |
|
|
mesecon.mvps_process_stack(stack) |
|
|
mesecon.mvps_move_objects(frontpos, direction, oldstack) |
|
|
-- Too large stack/stopper in the way: try again very soon |
|
|
Oops, something went wrong.