From 6be65a5dace16967728677f6c816a18d59ec2e7d Mon Sep 17 00:00:00 2001 From: stujones11 Date: Sun, 14 Feb 2016 14:36:41 +0000 Subject: Code refactor and api improvements --- railtrack/railtrack.lua | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'railtrack') diff --git a/railtrack/railtrack.lua b/railtrack/railtrack.lua index 75a62a6..664300f 100644 --- a/railtrack/railtrack.lua +++ b/railtrack/railtrack.lua @@ -1,10 +1,11 @@ -RAILTRACK_MAX_SECTION_LEN = 20 -RAILTRACK_ROTATIONS = "FLR" -RAILTRACK_ACCEL_FLAT = -0.5 -RAILTRACK_ACCEL_UP = -2 -RAILTRACK_ACCEL_DOWN = 2 +local MAX_SECTION_LEN = 20 -railtrack = {} +railtrack = { + rotations = "FLR", + accel_flat = -0.5, + accel_up = -2, + accel_down = 2, +} railtrack.default_rail = { description = "Rail", @@ -90,7 +91,7 @@ function railtrack:limit_section_len(player, pos, meta) local junc = minetest.deserialize(s_junc) if #junc == 2 then local dist = railtrack:get_distance(junc[1], junc[2]) - if dist > RAILTRACK_MAX_SECTION_LEN then + if dist > MAX_SECTION_LEN then local node = minetest.get_node(pos) or {} if node.name then minetest.swap_node(pos, {name=node.name.."_union"}) -- cgit v1.2.3