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:
Jozef Behran 2019-03-02 14:02:37 -05:00
parent d3ff27df8e
commit ef5d856763

View File

@ -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()