mirror of
https://github.com/tacigar/maidroid.git
synced 2025-01-10 16:20:19 +01:00
Merge pull request #106 from tacigar/tacigar/farming
Make maidroids face to destination when plant and mow
This commit is contained in:
commit
021ec88ff4
@ -158,6 +158,7 @@ to_plant = function(self)
|
|||||||
self.time_counters[1] = 0
|
self.time_counters[1] = 0
|
||||||
self.object:setvelocity{x = 0, y = 0, z = 0}
|
self.object:setvelocity{x = 0, y = 0, z = 0}
|
||||||
self:set_animation(maidroid.animation_frames.MINE)
|
self:set_animation(maidroid.animation_frames.MINE)
|
||||||
|
self:set_yaw_by_direction(vector.subtract(self.destination, self.object:getpos()))
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
to_walk_randomly(self)
|
to_walk_randomly(self)
|
||||||
@ -170,6 +171,7 @@ to_mow = function(self)
|
|||||||
self.time_counters[1] = 0
|
self.time_counters[1] = 0
|
||||||
self.object:setvelocity{x = 0, y = 0, z = 0}
|
self.object:setvelocity{x = 0, y = 0, z = 0}
|
||||||
self:set_animation(maidroid.animation_frames.MINE)
|
self:set_animation(maidroid.animation_frames.MINE)
|
||||||
|
self:set_yaw_by_direction(vector.subtract(self.destination, self.object:getpos()))
|
||||||
end
|
end
|
||||||
|
|
||||||
walk_to_plant_and_mow_common = function(self, dtime)
|
walk_to_plant_and_mow_common = function(self, dtime)
|
||||||
@ -218,9 +220,7 @@ walk_to_plant_and_mow_common = function(self, dtime)
|
|||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
-- self:change_direction(self.path[1])
|
|
||||||
-- if maidroid is stopped by obstacles, the maidroid must jump.
|
-- if maidroid is stopped by obstacles, the maidroid must jump.
|
||||||
-- self:change_direction(self.path[1])
|
|
||||||
local velocity = self.object:getvelocity()
|
local velocity = self.object:getvelocity()
|
||||||
if velocity.y == 0 then
|
if velocity.y == 0 then
|
||||||
local front_node = self:get_front_node()
|
local front_node = self:get_front_node()
|
||||||
|
Loading…
Reference in New Issue
Block a user