Skip to content

Commit

Permalink
Merge pull request #36 from bengardner/fix_sliding_sit
Browse files Browse the repository at this point in the history
Remove duplicate wait_until_dawn() and stop on SIT.
  • Loading branch information
sfence authored Sep 1, 2023
2 parents b02f46c + 75b2e3f commit 05115ed
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions working_villagers/async_actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -343,11 +343,7 @@ function working_villages.villager:goto_bed()
self:set_state_info("I'm waiting for dawn to come.")
self:set_displayed_action("waiting until dawn")
self:set_animation(working_villages.animation_frames.SIT)
local tod = minetest.get_timeofday()
while (tod > 0.2 and tod < 0.805) do
coroutine.yield()
tod = minetest.get_timeofday()
end
self.object:set_velocity{x = 0, y = 0, z = 0}
self.wait_until_dawn()
self:set_animation(working_villages.animation_frames.STAND)
self:set_state_info("I'm starting into the new day.")
Expand All @@ -370,6 +366,7 @@ function working_villages.villager:goto_bed()
self:set_state_info("I'm waiting for dawn to come.")
self:set_displayed_action("waiting until dawn")
self:set_animation(working_villages.animation_frames.SIT)
self.object:set_velocity{x = 0, y = 0, z = 0}
self.wait_until_dawn()
else
log.info("villager %s bed is at: %s", self.inventory_name, minetest.pos_to_string(self.pos_data.bed_pos))
Expand Down

0 comments on commit 05115ed

Please sign in to comment.