Clean up abandoned spaceships
When a player leaves, his spaceship is left behind, lurking around the data and taking space in the block. Clean up this debris by checking whether the spaceship has its driver still present and removing it if not.
This commit is contained in:
parent
d3ff27df8e
commit
ef5d856763
@ -617,6 +617,9 @@ local spaceship = {
|
||||
|
||||
function spaceship:on_step(dtime)
|
||||
self.age = self.age + dtime
|
||||
if not self.driver then
|
||||
self.object:remove()
|
||||
end
|
||||
if self.driver and self.driver:get_look_dir() then
|
||||
local player = self.driver
|
||||
local name = player:get_player_name()
|
||||
|
Loading…
x
Reference in New Issue
Block a user