Compare commits

...

3 Commits

Author SHA1 Message Date
b9048f34b0 deprecation 2022-08-18 17:04:29 +02:00
257c1e0be8 fix deprecation 2022-08-18 17:00:24 +02:00
db20ba0317 fix portalgun being in item list 2022-08-18 16:45:08 +02:00
2 changed files with 9 additions and 8 deletions

View File

@@ -412,6 +412,7 @@ minetest.register_craftitem(
range = 100,
inventory_image = "portalgun_gun0_rndr.png",
wield_image = "portalgun_gun0_rndr.png",
groups = {not_in_creative_inventory = 1},
--inventory_image = "portalgun_gun_orange.png",
--wield_image = "portalgun_gun_orange.png",
on_place = function(itemstack, user, pointed_thing)

View File

@@ -86,7 +86,7 @@ minetest.register_entity(
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)))
--get yaw and convert it into param2
local p = self.object:getyaw()
local p = self.object:get_yaw()
--convert yaw from rad to degrees
local yaw = math.deg(p)
yaw = math.floor(yaw / 90)
@@ -97,13 +97,13 @@ minetest.register_entity(
p = yaw
--add -y force
local force = {x = 0, y = -10, z = 0}
self.object:setvelocity(force)
self.object:set_velocity(force)
if self._tmr < 0.2 then
return
else
self._tmr = 0
end
local pos = self.object:getpos()
local pos = self.object:get_pos()
local pos1 = {x = pos.x, y = pos.y + 0.5, z = pos.z}
local d
--swap 1 and 3 in p
@@ -135,14 +135,14 @@ minetest.register_entity(
end
if d then
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
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)
minetest.sound_play("portalgun_bullet1", {pos = pos, gain = 1, max_hear_distance = 15})
else
local obj = minetest.add_entity(pos1, "portalgun:turretgun")
obj:setyaw(self.object:getyaw())
obj:set_yaw(self.object:get_yaw())
self.object:remove()
end
return true
@@ -226,7 +226,7 @@ minetest.register_entity(
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)))
--get yaw and convert it into param2
local p = self.object:getyaw()
local p = self.object:get_yaw()
--convert yaw from rad to degrees
local yaw = math.deg(p)
yaw = math.floor(yaw / 90)
@@ -238,7 +238,7 @@ minetest.register_entity(
local pos = self.object:get_pos()
local pos1 = {x = pos.x, y = pos.y + 0.5, z = pos.z}
local force = {x = 0, y = -10, z = 0}
self.object:setvelocity(force)
self.object:set_velocity(force)
self._tmr = self._tmr + elapsed
if self._tmr < 0.2 then
return
@@ -278,7 +278,7 @@ minetest.register_entity(
if d then
local obj = minetest.add_entity(pos1, "portalgun:turretgun2")
--set yaw to same as this object
obj:setyaw(self.object:getyaw())
obj:setyaw(self.object:get_yaw())
self.object:remove()
end
return true