]> git.lizzy.rs Git - Crafter.git/commitdiff
Fix limiter causing problems
authoroilboi <47129783+oilboi@users.noreply.github.com>
Sat, 4 Jul 2020 20:06:34 +0000 (16:06 -0400)
committeroilboi <47129783+oilboi@users.noreply.github.com>
Sat, 4 Jul 2020 20:06:34 +0000 (16:06 -0400)
mods/minecart/init.lua

index f94c3fae29c0c4c3dea047dc2e549475471716e3..87f33604c54ceaeaf4d704cd9324998376985b5e 100644 (file)
@@ -151,24 +151,24 @@ minecart.on_step = function(self,dtime)
        local pos = vector.round(float_pos)
 
        if self.velocity then
-               local new_vel = dtime/0.01
-               --print(new_vel)
+               local new_vel = dtime/0.01              
                local test = vector.multiply(self.velocity,new_vel)
+
                --print(dump(test))
-               if test.x >= 0.5 then
-                       test.x = 0.4999999999
-               elseif test.x <= -0.5 then
-                       test.x = -0.4999999999
+               if test.x > 0.5 then
+                       test.x = 0.5
+               elseif test.x < -0.5 then
+                       test.x = -0.5
                end
-               if test.z >= 0.5 then
-                       test.z = 0.4999999999
-               elseif test.z <= -0.5 then
-                       test.z = -0.4999999999
+               if test.z > 0.5 then
+                       test.z = 0.5
+               elseif test.z < -0.5 then
+                       test.z = -0.5
                end
                self.object:move_to(vector.add(float_pos,test))
-               self.velocity = test
        end
 
+       
        --stop minecarts from derailing when going super fast
        if self.old_pos and vector.distance(float_pos,self.old_pos) > 0.5 then
                self.object:move_to(self.old_pos)