Boat: Update player attach state
This commit is contained in:
parent
4b7c49f27e
commit
29c08df63a
@ -166,14 +166,17 @@ local register_boat = function(name, def)
|
|||||||
end,
|
end,
|
||||||
on_rightclick = function(self, clicker)
|
on_rightclick = function(self, clicker)
|
||||||
if clicker and clicker:is_player() then
|
if clicker and clicker:is_player() then
|
||||||
|
local cname = clicker:get_player_name()
|
||||||
if self._driver and self._driver == clicker then
|
if self._driver and self._driver == clicker then
|
||||||
minetest.log("action", "[rp_boats] "..clicker:get_player_name().." attaches to boat at "..minetest.pos_to_string(self.object:get_pos(),1))
|
minetest.log("action", "[rp_boats] "..cname.." attaches to boat at "..minetest.pos_to_string(self.object:get_pos(),1))
|
||||||
self._driver:set_detach()
|
self._driver:set_detach()
|
||||||
|
rp_player.player_attached[cname] = false
|
||||||
self._driver = nil
|
self._driver = nil
|
||||||
else
|
else
|
||||||
if clicker:get_attach() == nil then
|
if clicker:get_attach() == nil then
|
||||||
minetest.log("action", "[rp_boats] "..clicker:get_player_name().." detaches from boat at "..minetest.pos_to_string(self.object:get_pos(),1))
|
minetest.log("action", "[rp_boats] "..cname.." detaches from boat at "..minetest.pos_to_string(self.object:get_pos(),1))
|
||||||
self._driver = clicker
|
self._driver = clicker
|
||||||
|
rp_player.player_attached[cname] = true
|
||||||
self._driver:set_attach(self.object, "", def.attach_offset, {x=0,y=0,z=0}, true)
|
self._driver:set_attach(self.object, "", def.attach_offset, {x=0,y=0,z=0}, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
name = rp_boats
|
name = rp_boats
|
||||||
description = Boats, rafts, etc.
|
description = Boats, rafts, etc.
|
||||||
depends = rp_crafting, rp_default
|
depends = rp_crafting, rp_default, rp_player
|
||||||
|
Loading…
x
Reference in New Issue
Block a user