Fix crashes #1
34
rocket.lua
34
rocket.lua
|
@ -58,7 +58,6 @@ function rocket.on_punch(self, puncher)
|
||||||
puncher:set_detach()
|
puncher:set_detach()
|
||||||
puncher:set_eye_offset({x=0,y=0,z=0},{x=0,y=0,z=0})
|
puncher:set_eye_offset({x=0,y=0,z=0},{x=0,y=0,z=0})
|
||||||
default.player_attached[name] = false
|
default.player_attached[name] = false
|
||||||
minetest.sound_stop(self.soundThrust)
|
|
||||||
end
|
end
|
||||||
if not self.driver then
|
if not self.driver then
|
||||||
-- Move to inventory
|
-- Move to inventory
|
||||||
|
@ -95,7 +94,6 @@ function rocket.on_rightclick(self, clicker)
|
||||||
minetest.after(0.1, function()
|
minetest.after(0.1, function()
|
||||||
clicker:setpos(pos)
|
clicker:setpos(pos)
|
||||||
end)
|
end)
|
||||||
minetest.sound_stop(self.soundThrust)
|
|
||||||
elseif not self.driver then
|
elseif not self.driver then
|
||||||
-- Attach
|
-- Attach
|
||||||
local attach = clicker:get_attach()
|
local attach = clicker:get_attach()
|
||||||
|
@ -181,7 +179,6 @@ function rocket.on_step(self, dtime)
|
||||||
driver_objref:set_detach()
|
driver_objref:set_detach()
|
||||||
driver_objref:set_eye_offset({x=0,y=0,z=0},{x=0,y=0,z=0})
|
driver_objref:set_eye_offset({x=0,y=0,z=0},{x=0,y=0,z=0})
|
||||||
driver_objref:set_attach(sideways_rocket, "", {x = 0, y = 1, z = 0}, {x = 0, y = 0, z = 0})
|
driver_objref:set_attach(sideways_rocket, "", {x = 0, y = 1, z = 0}, {x = 0, y = 0, z = 0})
|
||||||
minetest.sound_stop(self.soundThrust)
|
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
--right click after pressing A+D to go into the sideways rocket
|
--right click after pressing A+D to go into the sideways rocket
|
||||||
elseif ctrl.left then
|
elseif ctrl.left then
|
||||||
|
@ -279,7 +276,11 @@ function rocket.on_step(self, dtime)
|
||||||
atmos = ":asteriod:atmos"
|
atmos = ":asteriod:atmos"
|
||||||
end
|
end
|
||||||
local p1 = self.object:getpos()
|
local p1 = self.object:getpos()
|
||||||
|
if p1 == nil then
|
||||||
|
return false
|
||||||
|
else
|
||||||
p1.y = p1.y - 1
|
p1.y = p1.y - 1
|
||||||
|
end
|
||||||
if minetest.get_node(p1).name ~= "air" and minetest.get_node(p1).name ~= vacuum and minetest.get_node(p1).name ~= atmos and self.vy < -10 then
|
if minetest.get_node(p1).name ~= "air" and minetest.get_node(p1).name ~= vacuum and minetest.get_node(p1).name ~= atmos and self.vy < -10 then
|
||||||
tnt.boom(p, {
|
tnt.boom(p, {
|
||||||
radius = 3,
|
radius = 3,
|
||||||
|
@ -287,13 +288,16 @@ function rocket.on_step(self, dtime)
|
||||||
sound = "tnt_explode",
|
sound = "tnt_explode",
|
||||||
explode_center = false,
|
explode_center = false,
|
||||||
})
|
})
|
||||||
minetest.sound_stop(self.soundThrust)
|
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
driver_objref:set_eye_offset({x=0,y=0,z=0},{x=0,y=0,z=0})
|
driver_objref:set_eye_offset({x=0,y=0,z=0},{x=0,y=0,z=0})
|
||||||
end
|
end
|
||||||
|
|
||||||
local p2 = self.object:getpos()
|
local p2 = self.object:getpos()
|
||||||
|
if p2 == nil then
|
||||||
|
return false
|
||||||
|
else
|
||||||
p2.y = p2.y + 6
|
p2.y = p2.y + 6
|
||||||
|
end
|
||||||
local p3 = self.object:getpos()
|
local p3 = self.object:getpos()
|
||||||
p3.y = p3.y + 4
|
p3.y = p3.y + 4
|
||||||
if minetest.get_node(p2).name ~= "air" and minetest.get_node(p2).name ~= vacuum and minetest.get_node(p1).name ~= atmos and self.vy > 10 then
|
if minetest.get_node(p2).name ~= "air" and minetest.get_node(p2).name ~= vacuum and minetest.get_node(p1).name ~= atmos and self.vy > 10 then
|
||||||
|
@ -303,7 +307,6 @@ function rocket.on_step(self, dtime)
|
||||||
sound = "tnt_explode",
|
sound = "tnt_explode",
|
||||||
explode_center = false,
|
explode_center = false,
|
||||||
})
|
})
|
||||||
minetest.sound_stop(self.soundThrust)
|
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
driver_objref:set_eye_offset({x=0,y=0,z=0},{x=0,y=0,z=0})
|
driver_objref:set_eye_offset({x=0,y=0,z=0},{x=0,y=0,z=0})
|
||||||
end
|
end
|
||||||
|
@ -422,7 +425,6 @@ function rocket.on_step(self, dtime)
|
||||||
sound = "tnt_explode",
|
sound = "tnt_explode",
|
||||||
explode_center = false,
|
explode_center = false,
|
||||||
})
|
})
|
||||||
minetest.sound_stop(self.soundThrust)
|
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -437,7 +439,6 @@ function rocket.on_step(self, dtime)
|
||||||
sound = "tnt_explode",
|
sound = "tnt_explode",
|
||||||
explode_center = false,
|
explode_center = false,
|
||||||
})
|
})
|
||||||
minetest.sound_stop(self.soundThrust)
|
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -485,7 +486,6 @@ function sideways_rocket.on_punch(self, puncher)
|
||||||
self.driver = nil
|
self.driver = nil
|
||||||
puncher:set_detach()
|
puncher:set_detach()
|
||||||
default.player_attached[name] = false
|
default.player_attached[name] = false
|
||||||
minetest.sound_stop(self.soundThrust)
|
|
||||||
end
|
end
|
||||||
if not self.driver then
|
if not self.driver then
|
||||||
-- Move to inventory
|
-- Move to inventory
|
||||||
|
@ -521,7 +521,6 @@ function sideways_rocket.on_rightclick(self, clicker)
|
||||||
minetest.after(0.1, function()
|
minetest.after(0.1, function()
|
||||||
clicker:setpos(pos)
|
clicker:setpos(pos)
|
||||||
end)
|
end)
|
||||||
minetest.sound_stop(self.soundThrust)
|
|
||||||
elseif not self.driver then
|
elseif not self.driver then
|
||||||
-- Attach
|
-- Attach
|
||||||
local attach = clicker:get_attach()
|
local attach = clicker:get_attach()
|
||||||
|
@ -608,7 +607,6 @@ function sideways_rocket.on_step(self, dtime)
|
||||||
driver_objref:set_detach()
|
driver_objref:set_detach()
|
||||||
driver_objref:set_eye_offset({x=0,y=20,z=0},{x=0,y=0,z=0})
|
driver_objref:set_eye_offset({x=0,y=20,z=0},{x=0,y=0,z=0})
|
||||||
driver_objref:set_attach(rocket, "", {x = 0, y = 20, z = 0}, {x = 0, y = 0, z = 0})
|
driver_objref:set_attach(rocket, "", {x = 0, y = 20, z = 0}, {x = 0, y = 0, z = 0})
|
||||||
minetest.sound_stop(self.soundThrust)
|
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
--right click after pressing A+D to go into the rocket
|
--right click after pressing A+D to go into the rocket
|
||||||
elseif ctrl.left then
|
elseif ctrl.left then
|
||||||
|
@ -633,7 +631,11 @@ function sideways_rocket.on_step(self, dtime)
|
||||||
atmos = ":asteriod:atmos"
|
atmos = ":asteriod:atmos"
|
||||||
end
|
end
|
||||||
local p1 = self.object:getpos()
|
local p1 = self.object:getpos()
|
||||||
|
if p1 == nil then
|
||||||
|
return false
|
||||||
|
else
|
||||||
p1.x = p1.x + 2
|
p1.x = p1.x + 2
|
||||||
|
end
|
||||||
local p2 = self.object:getpos()
|
local p2 = self.object:getpos()
|
||||||
p2.x = p2.x - 2
|
p2.x = p2.x - 2
|
||||||
local p3 = self.object:getpos()
|
local p3 = self.object:getpos()
|
||||||
|
@ -641,7 +643,6 @@ function sideways_rocket.on_step(self, dtime)
|
||||||
local p4 = self.object:getpos()
|
local p4 = self.object:getpos()
|
||||||
p4.x = p4.x - 2
|
p4.x = p4.x - 2
|
||||||
if minetest.get_node(p1).name ~= "air" and minetest.get_node(p1).name ~= vacuum and minetest.get_node(p1).name ~= atmos and self.v > 10 then
|
if minetest.get_node(p1).name ~= "air" and minetest.get_node(p1).name ~= vacuum and minetest.get_node(p1).name ~= atmos and self.v > 10 then
|
||||||
minetest.sound_stop(self.soundThrust)
|
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
if driver_objref then
|
if driver_objref then
|
||||||
default.player_set_animation(driver_objref, "stand" , 30)
|
default.player_set_animation(driver_objref, "stand" , 30)
|
||||||
|
@ -654,7 +655,6 @@ function sideways_rocket.on_step(self, dtime)
|
||||||
explode_center = false,
|
explode_center = false,
|
||||||
})
|
})
|
||||||
elseif minetest.get_node(p2).name ~= "air" and minetest.get_node(p2).name ~= vacuum and minetest.get_node(p1).name ~= atmos and self.v > 10 then
|
elseif minetest.get_node(p2).name ~= "air" and minetest.get_node(p2).name ~= vacuum and minetest.get_node(p1).name ~= atmos and self.v > 10 then
|
||||||
minetest.sound_stop(self.soundThrust)
|
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
if driver_objref then
|
if driver_objref then
|
||||||
default.player_set_animation(driver_objref, "stand" , 30)
|
default.player_set_animation(driver_objref, "stand" , 30)
|
||||||
|
@ -667,7 +667,6 @@ function sideways_rocket.on_step(self, dtime)
|
||||||
explode_center = false,
|
explode_center = false,
|
||||||
})
|
})
|
||||||
elseif minetest.get_node(p3).name ~= "air" and minetest.get_node(p3).name ~= vacuum and minetest.get_node(p1).name ~= atmos and self.v > 10 then
|
elseif minetest.get_node(p3).name ~= "air" and minetest.get_node(p3).name ~= vacuum and minetest.get_node(p1).name ~= atmos and self.v > 10 then
|
||||||
minetest.sound_stop(self.soundThrust)
|
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
if driver_objref then
|
if driver_objref then
|
||||||
default.player_set_animation(driver_objref, "stand" , 30)
|
default.player_set_animation(driver_objref, "stand" , 30)
|
||||||
|
@ -680,7 +679,6 @@ function sideways_rocket.on_step(self, dtime)
|
||||||
explode_center = false,
|
explode_center = false,
|
||||||
})
|
})
|
||||||
elseif minetest.get_node(p4).name ~= "air" and minetest.get_node(p4).name ~= vacuum and minetest.get_node(p1).name ~= atmos and self.v > 10 then
|
elseif minetest.get_node(p4).name ~= "air" and minetest.get_node(p4).name ~= vacuum and minetest.get_node(p1).name ~= atmos and self.v > 10 then
|
||||||
minetest.sound_stop(self.soundThrust)
|
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
if driver_objref then
|
if driver_objref then
|
||||||
default.player_set_animation(driver_objref, "stand" , 30)
|
default.player_set_animation(driver_objref, "stand" , 30)
|
||||||
|
@ -783,7 +781,11 @@ function sideways_rocket.on_step(self, dtime)
|
||||||
atmos = ":asteriod:atmos"
|
atmos = ":asteriod:atmos"
|
||||||
end
|
end
|
||||||
local p1 = self.object:getpos()
|
local p1 = self.object:getpos()
|
||||||
|
if p1 == nil then
|
||||||
|
return false
|
||||||
|
else
|
||||||
p1.x = p1.x + 2
|
p1.x = p1.x + 2
|
||||||
|
end
|
||||||
local p2 = self.object:getpos()
|
local p2 = self.object:getpos()
|
||||||
p2.x = p2.x - 2
|
p2.x = p2.x - 2
|
||||||
local p3 = self.object:getpos()
|
local p3 = self.object:getpos()
|
||||||
|
@ -791,7 +793,6 @@ function sideways_rocket.on_step(self, dtime)
|
||||||
local p4 = self.object:getpos()
|
local p4 = self.object:getpos()
|
||||||
p4.x = p4.x - 2
|
p4.x = p4.x - 2
|
||||||
if minetest.get_node(p1).name ~= "air" and minetest.get_node(p1).name ~= vacuum and minetest.get_node(p1).name ~= atmos and self.v > 10 then
|
if minetest.get_node(p1).name ~= "air" and minetest.get_node(p1).name ~= vacuum and minetest.get_node(p1).name ~= atmos and self.v > 10 then
|
||||||
minetest.sound_stop(self.soundThrust)
|
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
if driver_objref then
|
if driver_objref then
|
||||||
default.player_set_animation(driver_objref, "stand" , 30)
|
default.player_set_animation(driver_objref, "stand" , 30)
|
||||||
|
@ -804,7 +805,6 @@ function sideways_rocket.on_step(self, dtime)
|
||||||
explode_center = false,
|
explode_center = false,
|
||||||
})
|
})
|
||||||
elseif minetest.get_node(p2).name ~= "air" and minetest.get_node(p2).name ~= vacuum and minetest.get_node(p1).name ~= atmos and self.v > 10 then
|
elseif minetest.get_node(p2).name ~= "air" and minetest.get_node(p2).name ~= vacuum and minetest.get_node(p1).name ~= atmos and self.v > 10 then
|
||||||
minetest.sound_stop(self.soundThrust)
|
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
if driver_objref then
|
if driver_objref then
|
||||||
default.player_set_animation(driver_objref, "stand" , 30)
|
default.player_set_animation(driver_objref, "stand" , 30)
|
||||||
|
@ -817,7 +817,6 @@ function sideways_rocket.on_step(self, dtime)
|
||||||
explode_center = false,
|
explode_center = false,
|
||||||
})
|
})
|
||||||
elseif minetest.get_node(p3).name ~= "air" and minetest.get_node(p3).name ~= vacuum and minetest.get_node(p1).name ~= atmos and self.v > 10 then
|
elseif minetest.get_node(p3).name ~= "air" and minetest.get_node(p3).name ~= vacuum and minetest.get_node(p1).name ~= atmos and self.v > 10 then
|
||||||
minetest.sound_stop(self.soundThrust)
|
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
if driver_objref then
|
if driver_objref then
|
||||||
default.player_set_animation(driver_objref, "stand" , 30)
|
default.player_set_animation(driver_objref, "stand" , 30)
|
||||||
|
@ -830,7 +829,6 @@ function sideways_rocket.on_step(self, dtime)
|
||||||
explode_center = false,
|
explode_center = false,
|
||||||
})
|
})
|
||||||
elseif minetest.get_node(p4).name ~= "air" and minetest.get_node(p4).name ~= vacuum and minetest.get_node(p1).name ~= atmos and self.v > 10 then
|
elseif minetest.get_node(p4).name ~= "air" and minetest.get_node(p4).name ~= vacuum and minetest.get_node(p1).name ~= atmos and self.v > 10 then
|
||||||
minetest.sound_stop(self.soundThrust)
|
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
if driver_objref then
|
if driver_objref then
|
||||||
default.player_set_animation(driver_objref, "stand" , 30)
|
default.player_set_animation(driver_objref, "stand" , 30)
|
||||||
|
|
Loading…
Reference in New Issue