Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix most of the namespace pollutions reported in #311
  • Loading branch information
sfan5 committed Jan 15, 2017
1 parent 7415036 commit c2e3d7c
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 20 deletions.
6 changes: 4 additions & 2 deletions mesecons_delayer/init.lua
Expand Up @@ -47,7 +47,8 @@ elseif i == 2 then delaytime = 0.3
elseif i == 3 then delaytime = 0.5
elseif i == 4 then delaytime = 1.0 end

boxes = {{ -6/16, -8/16, -6/16, 6/16, -7/16, 6/16 }, -- the main slab
local boxes = {
{ -6/16, -8/16, -6/16, 6/16, -7/16, 6/16 }, -- the main slab

{ -2/16, -7/16, -4/16, 2/16, -26/64, -3/16 }, -- the jeweled "on" indicator
{ -3/16, -7/16, -3/16, 3/16, -26/64, -2/16 },
Expand All @@ -57,7 +58,8 @@ boxes = {{ -6/16, -8/16, -6/16, 6/16, -7/16, 6/16 }, -- the main slab

{ -6/16, -7/16, -6/16, -4/16, -27/64, -4/16 }, -- the timer indicator
{ -8/16, -8/16, -1/16, -6/16, -7/16, 1/16 }, -- the two wire stubs
{ 6/16, -8/16, -1/16, 8/16, -7/16, 1/16 }}
{ 6/16, -8/16, -1/16, 8/16, -7/16, 1/16 }
}

minetest.register_node("mesecons_delayer:delayer_off_"..tostring(i), {
description = "Delayer",
Expand Down
2 changes: 1 addition & 1 deletion mesecons_extrawires/crossover.lua
@@ -1,4 +1,4 @@
function crossover_get_rules(node)
local function crossover_get_rules(node)
return {
{--first wire
{x=-1,y=0,z=0},
Expand Down
2 changes: 1 addition & 1 deletion mesecons_gates/init.lua
Expand Up @@ -54,7 +54,7 @@ local function update_gate(pos, node, link, newstate)
end
end

function register_gate(name, inputnumber, assess, recipe)
local function register_gate(name, inputnumber, assess, recipe)
local get_inputrules = inputnumber == 2 and gate_get_input_rules_twoinputs or
gate_get_input_rules_oneinput
local description = "Mesecons Logic Gate: "..name
Expand Down
2 changes: 1 addition & 1 deletion mesecons_insulated/init.lua
@@ -1,4 +1,4 @@
function insulated_wire_get_rules(node)
local function insulated_wire_get_rules(node)
local rules = {{x = 1, y = 0, z = 0},
{x =-1, y = 0, z = 0}}
if node.param2 == 1 or node.param2 == 3 then
Expand Down
2 changes: 1 addition & 1 deletion mesecons_lamp/init.lua
Expand Up @@ -2,7 +2,7 @@
-- A lamp is "is an electrical device used to create artificial light" (wikipedia)
-- guess what?

mesecon_lamp_box = {
local mesecon_lamp_box = {
type = "wallmounted",
wall_top = {-0.3125,0.375,-0.3125,0.3125,0.5,0.3125},
wall_bottom = {-0.3125,-0.5,-0.3125,0.3125,-0.375,0.3125},
Expand Down
27 changes: 15 additions & 12 deletions mesecons_pistons/init.lua
@@ -1,52 +1,55 @@
-- Get mesecon rules of pistons
piston_rules =
{{x=0, y=0, z=1}, --everything apart from z- (pusher side)
local piston_rules = {
{x=0, y=0, z=1}, --everything apart from z- (pusher side)
{x=1, y=0, z=0},
{x=-1, y=0, z=0},
{x=1, y=1, z=0},
{x=1, y=-1, z=0},
{x=-1, y=1, z=0},
{x=-1, y=-1, z=0},
{x=0, y=1, z=1},
{x=0, y=-1, z=1}}
{x=0, y=-1, z=1}
}

local piston_up_rules =
{{x=0, y=0, z=-1}, --everything apart from y+ (pusher side)
local piston_up_rules = {
{x=0, y=0, z=-1}, --everything apart from y+ (pusher side)
{x=1, y=0, z=0},
{x=-1, y=0, z=0},
{x=0, y=0, z=1},
{x=1, y=-1, z=0},
{x=-1, y=-1, z=0},
{x=0, y=-1, z=1},
{x=0, y=-1, z=-1}}
{x=0, y=-1, z=-1}
}

local piston_down_rules =
{{x=0, y=0, z=-1}, --everything apart from y- (pusher side)
local piston_down_rules = {
{x=0, y=0, z=-1}, --everything apart from y- (pusher side)
{x=1, y=0, z=0},
{x=-1, y=0, z=0},
{x=0, y=0, z=1},
{x=1, y=1, z=0},
{x=-1, y=1, z=0},
{x=0, y=1, z=1},
{x=0, y=1, z=-1}}
{x=0, y=1, z=-1}
}

local piston_get_rules = function (node)
local function piston_get_rules(node)
local rules = piston_rules
for i = 1, node.param2 do
rules = mesecon.rotate_rules_left(rules)
end
return rules
end

piston_facedir_direction = function (node)
local function piston_facedir_direction(node)
local rules = {{x = 0, y = 0, z = -1}}
for i = 1, node.param2 do
rules = mesecon.rotate_rules_left(rules)
end
return rules[1]
end

piston_get_direction = function(dir, node)
local function piston_get_direction(dir, node)
if type(dir) == "function" then
return dir(node)
else
Expand Down
2 changes: 1 addition & 1 deletion mesecons_pressureplates/init.lua
Expand Up @@ -8,7 +8,7 @@ local pp_box_on = {
fixed = { -7/16, -8/16, -7/16, 7/16, -7.5/16, 7/16 },
}

pp_on_timer = function (pos, elapsed)
local function pp_on_timer(pos, elapsed)
local node = minetest.get_node(pos)
local basename = minetest.registered_nodes[node.name].pressureplate_basename

Expand Down
2 changes: 1 addition & 1 deletion mesecons_wires/init.lua
Expand Up @@ -140,7 +140,7 @@ nid_inc = function (nid)
return i <= 8
end

register_wires = function()
local function register_wires()
local nid = {}
while true do
-- Create group specifiction and nodeid string (see note above for details)
Expand Down

1 comment on commit c2e3d7c

@Jeija
Copy link
Collaborator

@Jeija Jeija commented on c2e3d7c Jan 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you 😌 !

Please sign in to comment.