]> git.lizzy.rs Git - Crafter.git/commitdiff
Add in lag exception for minecarts
authoroilboi <47129783+oilboi@users.noreply.github.com>
Sun, 5 Jul 2020 15:04:08 +0000 (11:04 -0400)
committeroilboi <47129783+oilboi@users.noreply.github.com>
Sun, 5 Jul 2020 15:04:08 +0000 (11:04 -0400)
mods/minecart/init.lua

index 670fce60ac07766f03495e5b3823adbe48ad4a7b..a989390bd26ca021ac58923519246932105a50b5 100644 (file)
@@ -286,6 +286,9 @@ end
 local minecart = {}
 
 minecart.on_step = function(self,dtime)
+       if dtime > 0.1 then
+               self.object:set_pos(self.old_pos)
+       end
        local pos = vector.round(self.object:get_pos())
        if not self.axis_lock then
                local possible_dirs = create_axis(pos)
@@ -306,6 +309,7 @@ minecart.on_step = function(self,dtime)
                rail_brain(self,pos)
                --collision_detect(self)
        end
+       self.old_pos = self.object:get_pos()
 end