fix initialization check (hopefully finally)

This commit is contained in:
Alexander Weber 2017-01-16 22:33:06 +01:00
parent cb229b93ec
commit 3d6167bf32

View File

@ -125,10 +125,8 @@ function control_proto:_do_control_step(dtime)
return
end
self._step_timer = 0
if self._step_init_done == true then
control_framework.getControl(self._npc)
self._step_init_done = false
end
control_framework.getControl(self._npc)
self._step_init_done = false
-- check path
if self.speed > 0 then
@ -138,8 +136,8 @@ function control_proto:_do_control_step(dtime)
local a = table.copy(self.pos)
a.y = 0
local b = {x=self.path[1].x, y=0 ,z=self.path[1].z}
print(minetest.pos_to_string(self.pos), minetest.pos_to_string(self.path[1]), vector.distance(a, b),minetest.pos_to_string(self._npc.object:getpos()))
if self.path[2] then print(minetest.pos_to_string(self.path[2])) end
--print(minetest.pos_to_string(self.pos), minetest.pos_to_string(self.path[1]), vector.distance(a, b),minetest.pos_to_string(self._npc.object:getpos()))
--if self.path[2] then print(minetest.pos_to_string(self.path[2])) end
if vector.distance(a, b) < 0.4
or (self.path[2] and vector.distance(self.pos, self.path[2]) < vector.distance(self.path[1], self.path[2])) then