mirror of
https://github.com/minetest/minetest_game.git
synced 2024-12-22 15:00:18 +01:00
Boats: Avoid crash if boat pos over limit
If the boat pos is over limit, 'add entity' will not add an entity, causing 'boat' to be nil.
This commit is contained in:
parent
12b1541971
commit
3c9d0893ee
@ -233,9 +233,11 @@ minetest.register_craftitem("boats:boat", {
|
||||
end
|
||||
pointed_thing.under.y = pointed_thing.under.y + 0.5
|
||||
boat = minetest.add_entity(pointed_thing.under, "boats:boat")
|
||||
boat:setyaw(placer:get_look_horizontal())
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:take_item()
|
||||
if boat then
|
||||
boat:setyaw(placer:get_look_horizontal())
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:take_item()
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
|
Loading…
Reference in New Issue
Block a user