aboutsummaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorOch Noe <och_noe@forksworld.de>2020-02-25 13:55:47 +0100
committerOch Noe <och_noe@forksworld.de>2020-02-25 13:55:47 +0100
commit41be2310324784e7de2fbb2c4e0c18858615c006 (patch)
tree02f9ad522e9574988acaef9a2d8b4261685ce3d3 /init.lua
parentff355e45f6e325fe32c044ca22b258ed0eab22e0 (diff)
downloadelevator-41be2310324784e7de2fbb2c4e0c18858615c006.tar.gz
elevator-41be2310324784e7de2fbb2c4e0c18858615c006.tar.bz2
elevator-41be2310324784e7de2fbb2c4e0c18858615c006.zip
Speed and distance to brake before target now in constants
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/init.lua b/init.lua
index 9efd66f..c8e2ef3 100644
--- a/init.lua
+++ b/init.lua
@@ -2,6 +2,10 @@
local SPEED = 10
-- Acceleration of a box.
local ACCEL = 0.1
+-- Distance before target to slow down
+local SLOW_DIST = 16
+-- Slow speed before the target
+local SLOW_SPEED = 1.75
-- Elevator interface/database version.
local VERSION = 8
-- Maximum time a box can go without players nearby.
@@ -121,8 +125,8 @@ local function create_box(motorhash, pos, target, sender)
-- FIX for "overshooting"
local delta_y = math.abs(pos.y-target.y)
local speed = SPEED
- if (delta_y<10) then
- speed = 2
+ if (delta_y<SLOW_DIST) then
+ speed = SLOW_SPEED
end
-- Set the speed.