diff options
author | stujones11 <stujones111@gmail.com> | 2016-02-14 14:36:41 +0000 |
---|---|---|
committer | stujones11 <stujones111@gmail.com> | 2016-02-14 14:36:41 +0000 |
commit | 6be65a5dace16967728677f6c816a18d59ec2e7d (patch) | |
tree | 8c6a4f37d6ce1b3e01976c50862c82c6d6aa65b5 /railtrack | |
parent | f746e814abddcc6434317bbc21aa452d3e30bef1 (diff) |
Code refactor and api improvements
Diffstat (limited to 'railtrack')
-rw-r--r-- | railtrack/railtrack.lua | 15 |
1 files changed, 8 insertions, 7 deletions
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"}) |