mirror of
https://github.com/minetest/minetest_game.git
synced 2024-11-05 23:33:51 +01:00
Allow only boat driver to be detached from boat (fixes #276)
This commit is contained in:
parent
7f44a49d99
commit
349a63ed14
@ -80,9 +80,12 @@ function boat.on_punch(self, puncher, time_from_last_punch, tool_capabilities, d
|
|||||||
if not puncher or not puncher:is_player() or self.removed then
|
if not puncher or not puncher:is_player() or self.removed then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
if self.driver and puncher == self.driver then
|
||||||
|
self.driver = nil
|
||||||
puncher:set_detach()
|
puncher:set_detach()
|
||||||
default.player_attached[puncher:get_player_name()] = false
|
default.player_attached[puncher:get_player_name()] = false
|
||||||
|
end
|
||||||
|
if not self.driver then
|
||||||
self.removed = true
|
self.removed = true
|
||||||
-- delay remove to ensure player is detached
|
-- delay remove to ensure player is detached
|
||||||
minetest.after(0.1, function()
|
minetest.after(0.1, function()
|
||||||
@ -91,6 +94,7 @@ function boat.on_punch(self, puncher, time_from_last_punch, tool_capabilities, d
|
|||||||
if not minetest.setting_getbool("creative_mode") then
|
if not minetest.setting_getbool("creative_mode") then
|
||||||
puncher:get_inventory():add_item("main", "boats:boat")
|
puncher:get_inventory():add_item("main", "boats:boat")
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function boat.on_step(self, dtime)
|
function boat.on_step(self, dtime)
|
||||||
|
Loading…
Reference in New Issue
Block a user