diff options
author | Och Noe <och_noe@forksworld.de> | 2020-02-25 13:55:47 +0100 |
---|---|---|
committer | Gabriel PĂ©rez-Cerezo <gabriel@gpcf.eu> | 2020-05-01 17:33:59 +0200 |
commit | 12124d0b77f8835e020604c98fbe42ea7683c1eb (patch) | |
tree | fc8948024e6b30c31d3e3a2f86dd638b276de012 | |
parent | 1cd6b661c60446f6093c3c6d92cb9a0cce0f7433 (diff) | |
download | elevator-12124d0b77f8835e020604c98fbe42ea7683c1eb.tar.gz elevator-12124d0b77f8835e020604c98fbe42ea7683c1eb.tar.bz2 elevator-12124d0b77f8835e020604c98fbe42ea7683c1eb.zip |
Speed and distance to brake before target now in constants
-rw-r--r-- | init.lua | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -1,3 +1,4 @@ + -- Detect optional mods. local armor_path = minetest.get_modpath("3d_armor") @@ -10,7 +11,8 @@ elevator = { VISUAL_INCREASE = 1.75, VERSION = 8, -- Elevator interface/database version. PTIMEOUT = minetest.settings:get("elevator_time") or 120, -- Maximum time a box can go without players nearby. - + SLOW_DIST = 16 + SLOW_SPEED = 1.75 boxes = {}, -- Elevator boxes in action. lastboxes = {}, -- Player near box timeout. riding = {}, -- Players riding boxes. @@ -52,9 +54,11 @@ elevator.create_box = function(motorhash, pos, target, sender) obj:get_luaentity().vmult = (target.y < pos.y) and -1 or 1 -- FIX for "overshooting" local delta_y = math.abs(pos.y-target.y) + local speed = elevator.SPEED - if (delta_y<10) then - speed = 2 + if (delta_y<SLOW_DIST) then + speed = SLOW_SPEED + end -- Set the speed. |