fix deprecation
This commit is contained in:
@@ -86,7 +86,7 @@ minetest.register_entity(
|
|||||||
self._tmr = self._tmr + elapsed
|
self._tmr = self._tmr + elapsed
|
||||||
self.object:set_yaw(math.rad(math.fmod((math.floor(math.fmod(math.deg(self.object:get_yaw()), 360) / 90) * 90), 360)))
|
self.object:set_yaw(math.rad(math.fmod((math.floor(math.fmod(math.deg(self.object:get_yaw()), 360) / 90) * 90), 360)))
|
||||||
--get yaw and convert it into param2
|
--get yaw and convert it into param2
|
||||||
local p = self.object:getyaw()
|
local p = self.object:get_yaw()
|
||||||
--convert yaw from rad to degrees
|
--convert yaw from rad to degrees
|
||||||
local yaw = math.deg(p)
|
local yaw = math.deg(p)
|
||||||
yaw = math.floor(yaw / 90)
|
yaw = math.floor(yaw / 90)
|
||||||
@@ -97,7 +97,7 @@ minetest.register_entity(
|
|||||||
p = yaw
|
p = yaw
|
||||||
--add -y force
|
--add -y force
|
||||||
local force = {x = 0, y = -10, z = 0}
|
local force = {x = 0, y = -10, z = 0}
|
||||||
self.object:setvelocity(force)
|
self.object:set_velocity(force)
|
||||||
if self._tmr < 0.2 then
|
if self._tmr < 0.2 then
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
@@ -135,14 +135,14 @@ minetest.register_entity(
|
|||||||
end
|
end
|
||||||
if d then
|
if d then
|
||||||
local bullet_ent = minetest.add_entity(pos1, "portalgun:bullet1")
|
local bullet_ent = minetest.add_entity(pos1, "portalgun:bullet1")
|
||||||
bullet_ent:setvelocity(d)
|
bullet_ent:set_velocity(d)
|
||||||
--rotate bullet to by 90 degrees in x axis
|
--rotate bullet to by 90 degrees in x axis
|
||||||
local yaw = math.rad(math.fmod((math.floor(math.fmod(math.deg(self.object:get_yaw()), 360) / 90) * 90), 360))
|
local yaw = math.rad(math.fmod((math.floor(math.fmod(math.deg(self.object:get_yaw()), 360) / 90) * 90), 360))
|
||||||
bullet_ent:set_yaw(yaw)
|
bullet_ent:set_yaw(yaw)
|
||||||
minetest.sound_play("portalgun_bullet1", {pos = pos, gain = 1, max_hear_distance = 15})
|
minetest.sound_play("portalgun_bullet1", {pos = pos, gain = 1, max_hear_distance = 15})
|
||||||
else
|
else
|
||||||
local obj = minetest.add_entity(pos1, "portalgun:turretgun")
|
local obj = minetest.add_entity(pos1, "portalgun:turretgun")
|
||||||
obj:setyaw(self.object:getyaw())
|
obj:setyaw(self.object:get_yaw())
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
@@ -226,7 +226,7 @@ minetest.register_entity(
|
|||||||
on_step = function(self, elapsed, moveresult)
|
on_step = function(self, elapsed, moveresult)
|
||||||
self.object:set_yaw(math.rad(math.fmod((math.floor(math.fmod(math.deg(self.object:get_yaw()), 360) / 90) * 90), 360)))
|
self.object:set_yaw(math.rad(math.fmod((math.floor(math.fmod(math.deg(self.object:get_yaw()), 360) / 90) * 90), 360)))
|
||||||
--get yaw and convert it into param2
|
--get yaw and convert it into param2
|
||||||
local p = self.object:getyaw()
|
local p = self.object:get_yaw()
|
||||||
--convert yaw from rad to degrees
|
--convert yaw from rad to degrees
|
||||||
local yaw = math.deg(p)
|
local yaw = math.deg(p)
|
||||||
yaw = math.floor(yaw / 90)
|
yaw = math.floor(yaw / 90)
|
||||||
@@ -238,7 +238,7 @@ minetest.register_entity(
|
|||||||
local pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
local pos1 = {x = pos.x, y = pos.y + 0.5, z = pos.z}
|
local pos1 = {x = pos.x, y = pos.y + 0.5, z = pos.z}
|
||||||
local force = {x = 0, y = -10, z = 0}
|
local force = {x = 0, y = -10, z = 0}
|
||||||
self.object:setvelocity(force)
|
self.object:set_velocity(force)
|
||||||
self._tmr = self._tmr + elapsed
|
self._tmr = self._tmr + elapsed
|
||||||
if self._tmr < 0.2 then
|
if self._tmr < 0.2 then
|
||||||
return
|
return
|
||||||
@@ -278,7 +278,7 @@ minetest.register_entity(
|
|||||||
if d then
|
if d then
|
||||||
local obj = minetest.add_entity(pos1, "portalgun:turretgun2")
|
local obj = minetest.add_entity(pos1, "portalgun:turretgun2")
|
||||||
--set yaw to same as this object
|
--set yaw to same as this object
|
||||||
obj:setyaw(self.object:getyaw())
|
obj:setyaw(self.object:get_yaw())
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
|
Reference in New Issue
Block a user