Revert "Add a shim for object:getyaw returning nan, this should be fixed correctly eventually"

This reverts commit dffc4b97dba5e8384ca880e91c7a4de5e042025b.
This commit is contained in:
KaadmY 2017-05-12 09:07:18 -07:00
parent dffc4b97db
commit d85bdb491e

View File

@ -150,24 +150,13 @@ function mobs:register_mob(name, def)
end,
set_velocity = function(self, v)
v = (v or 0)
if def.drawtype
and def.drawtype == "side" then
self.rotate = math.rad(90)
end
local tmpyaw = self.object:getyaw()
local yaw = self.rotate;
if tmpyaw ~= nan then
yaw = yaw + tmpyaw
else
minetest.log("object:getyaw() nan shim used")
end
local yaw = self.object:getyaw() + self.rotate
local x = math.sin(yaw) * -v
local z = math.cos(yaw) * v
self.object:setvelocity({x = x, y = self.object:getvelocity().y, z = z})
end,
get_velocity = function(self)
@ -792,7 +781,7 @@ function mobs:register_mob(name, def)
-- water swimmers cannot move out of water
if self.fly and self.fly_in == "default:water_source" and not lp then
-- print("out of water")
print ("out of water")
self.set_velocity(self, 0)
self.state = "flop" -- change to undefined state so nothing more happens
self:set_animation("stand")
@ -913,7 +902,10 @@ function mobs:register_mob(name, def)
end
-- end of exploding mobs
-- print("stop attacking")
elseif self.state == "attack"
and self.attack_type == "dogfight" then
if not self.attack.player or not self.attack.player:getpos() then
print("stop attacking")
self.state = "stand"
self:set_animation("stand")
return