Skip to content

Commit d8082b8

Browse files
committed
Fix landmine crash
1 parent d103426 commit d8082b8

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

mods/ctf/ctf_landmine/init.lua

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,16 @@ core.register_node("ctf_landmine:landmine", {
159159

160160
add_landmine(pos, name, pteam)
161161
end,
162-
on_punch = function(pos, _node, puncher, pointed_thing)
162+
on_punch = function(pos, node, puncher, pointed_thing)
163163
pos = pos:round()
164164
local hash = core.hash_node_position(pos)
165165

166-
if not is_self_landmine(puncher, landmines[hash]) then
167-
landmine_explode(pos)
166+
if landmines[hash] then
167+
if not is_self_landmine(puncher, landmines[hash]) then
168+
landmine_explode(pos)
169+
end
170+
elseif node.name == "ctf_landmine:landmine" then
171+
core.remove_node(pos)
168172
end
169173
end,
170174
on_dig = function(pos, node, digger)

0 commit comments

Comments
 (0)