mirror of
https://github.com/minetest/minetest_game.git
synced 2024-12-23 06:32:25 +01:00
Fix flammable item entities crashing (#2659)
This commit is contained in:
parent
189d2d9fb1
commit
33eb7cee2a
@ -15,8 +15,8 @@ local item = {
|
|||||||
|
|
||||||
burn_up = function(self)
|
burn_up = function(self)
|
||||||
-- disappear in a smoke puff
|
-- disappear in a smoke puff
|
||||||
self.object:remove()
|
|
||||||
local p = self.object:get_pos()
|
local p = self.object:get_pos()
|
||||||
|
self.object:remove()
|
||||||
minetest.sound_play("default_item_smoke", {
|
minetest.sound_play("default_item_smoke", {
|
||||||
pos = p,
|
pos = p,
|
||||||
max_hear_distance = 8,
|
max_hear_distance = 8,
|
||||||
@ -43,12 +43,16 @@ local item = {
|
|||||||
builtin_item.on_step(self, dtime, ...)
|
builtin_item.on_step(self, dtime, ...)
|
||||||
|
|
||||||
if self.flammable then
|
if self.flammable then
|
||||||
-- flammable, check for igniters
|
-- flammable, check for igniters every 10 s
|
||||||
self.ignite_timer = (self.ignite_timer or 0) + dtime
|
self.ignite_timer = (self.ignite_timer or 0) + dtime
|
||||||
if self.ignite_timer > 10 then
|
if self.ignite_timer > 10 then
|
||||||
self.ignite_timer = 0
|
self.ignite_timer = 0
|
||||||
|
|
||||||
local node = minetest.get_node_or_nil(self.object:get_pos())
|
local pos = self.object:get_pos()
|
||||||
|
if pos == nil then
|
||||||
|
return -- object already deleted
|
||||||
|
end
|
||||||
|
local node = minetest.get_node_or_nil(pos)
|
||||||
if not node then
|
if not node then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user