lag checker correction
This commit is contained in:
parent
bca9243933
commit
9434717186
2
LICENSE
2
LICENSE
@ -164,4 +164,4 @@ apply, that proxy's public statement of acceptance of any version is
|
|||||||
permanent authorization for you to choose that version for the
|
permanent authorization for you to choose that version for the
|
||||||
Library.
|
Library.
|
||||||
|
|
||||||
|
Copyright Alexsandro Percy - 2021
|
||||||
|
@ -421,28 +421,7 @@ minetest.register_entity("trike:trike", {
|
|||||||
end
|
end
|
||||||
|
|
||||||
if name == self.driver_name then
|
if name == self.driver_name then
|
||||||
trike.setText(self)
|
trike.detachPlayer(self, clicker)
|
||||||
|
|
||||||
self._engine_running = false
|
|
||||||
|
|
||||||
-- driver clicked the object => driver gets off the vehicle
|
|
||||||
self.driver_name = nil
|
|
||||||
-- sound and animation
|
|
||||||
if self.sound_handle then
|
|
||||||
minetest.sound_stop(self.sound_handle)
|
|
||||||
self.sound_handle = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
self.engine:set_animation_frame_speed(0)
|
|
||||||
|
|
||||||
-- detach the player
|
|
||||||
clicker:set_detach()
|
|
||||||
player_api.player_attached[name] = nil
|
|
||||||
clicker:set_eye_offset({x=0,y=0,z=0},{x=0,y=0,z=0})
|
|
||||||
player_api.set_animation(clicker, "stand")
|
|
||||||
self.driver = nil
|
|
||||||
self.object:set_acceleration(vector.multiply(trike.vector_up, -trike.gravity))
|
|
||||||
|
|
||||||
elseif not self.driver_name then
|
elseif not self.driver_name then
|
||||||
-- no driver => clicker is new driver
|
-- no driver => clicker is new driver
|
||||||
trike.attach(self, clicker)
|
trike.attach(self, clicker)
|
||||||
|
@ -248,6 +248,31 @@ function trike.testImpact(self, velocity)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function trike.detachPlayer(self, player)
|
||||||
|
local name = self.driver_name
|
||||||
|
trike.setText(self)
|
||||||
|
|
||||||
|
self._engine_running = false
|
||||||
|
|
||||||
|
-- driver clicked the object => driver gets off the vehicle
|
||||||
|
self.driver_name = nil
|
||||||
|
-- sound and animation
|
||||||
|
if self.sound_handle then
|
||||||
|
minetest.sound_stop(self.sound_handle)
|
||||||
|
self.sound_handle = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
self.engine:set_animation_frame_speed(0)
|
||||||
|
|
||||||
|
-- detach the player
|
||||||
|
player:set_detach()
|
||||||
|
player_api.player_attached[name] = nil
|
||||||
|
player:set_eye_offset({x=0,y=0,z=0},{x=0,y=0,z=0})
|
||||||
|
player_api.set_animation(player, "stand")
|
||||||
|
self.driver = nil
|
||||||
|
self.object:set_acceleration(vector.multiply(trike.vector_up, -trike.gravity))
|
||||||
|
end
|
||||||
|
|
||||||
function trike.checkattachBug(self)
|
function trike.checkattachBug(self)
|
||||||
-- for some engine error the player can be detached from the submarine, so lets set him attached again
|
-- for some engine error the player can be detached from the submarine, so lets set him attached again
|
||||||
local can_stop = true
|
local can_stop = true
|
||||||
@ -255,8 +280,12 @@ function trike.checkattachBug(self)
|
|||||||
-- attach the driver again
|
-- attach the driver again
|
||||||
local player = minetest.get_player_by_name(self.owner)
|
local player = minetest.get_player_by_name(self.owner)
|
||||||
if player then
|
if player then
|
||||||
|
if player:get_hp() > 0 then
|
||||||
trike.attach(self, player)
|
trike.attach(self, player)
|
||||||
can_stop = false
|
can_stop = false
|
||||||
|
else
|
||||||
|
trike.detachPlayer(self, player)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user