forked from mtcontrib/boost_cart
Various improvements and bugfixes
Clear driver on leave using the detach callback (0.5.x and later) Fix upright_sprite attachment position Fallback to the regular node sound when metal does not exist Set animation to "stand" on attach
This commit is contained in:
@ -54,6 +54,12 @@ function cart_entity:on_rightclick(clicker)
|
||||
elseif not self.driver then
|
||||
self.driver = player_name
|
||||
boost_cart:manage_attachment(clicker, self.object)
|
||||
|
||||
if default.player_set_animation then
|
||||
-- player_api(/default) does not update the animation
|
||||
-- when the player is attached, reset to default animation
|
||||
default.player_set_animation(clicker, "stand")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -81,6 +87,13 @@ function cart_entity:get_staticdata()
|
||||
})
|
||||
end
|
||||
|
||||
-- 0.5.x and later: When the driver leaves
|
||||
function cart_entity:on_detach_child(child)
|
||||
if child and child:get_player_name() == self.driver then
|
||||
self.driver = nil
|
||||
end
|
||||
end
|
||||
|
||||
function cart_entity:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
|
||||
local pos = self.object:get_pos()
|
||||
local vel = self.object:get_velocity()
|
||||
|
Reference in New Issue
Block a user