diff --git a/init.lua b/init.lua index 557b31a..401663c 100644 --- a/init.lua +++ b/init.lua @@ -308,6 +308,20 @@ function boat.on_activate(self, staticdata, dtime_s) self.object:set_properties({textures = data.textures}) end + self._sounds = { -- workaround for copy vs reference issue + engine = { + handle = nil, + gain = 0.1, + playing = false, + time_elapsed = 0, + }, + engine_stop = { + handle = nil, + gain = 0.1, + playing = false, + time_elapsed = 0, + }, + } end function boat.get_staticdata(self) @@ -606,21 +620,6 @@ for b=1, #boat_ids do end local boat = minetest.add_entity(pos, "sum_airship:boat") local texture = "sum_airship_texture_"..images[b].."_boat.png" - local luaent = boat:get_luaentity() - luaent._sounds = { -- workaround for copy vs reference issue - engine = { - handle = nil, - gain = 0.1, - playing = false, - time_elapsed = 0, - }, - engine_stop = { - handle = nil, - gain = 0.1, - playing = false, - time_elapsed = 0, - }, - } boat:get_luaentity()._itemstring = itemstring boat:set_properties({textures = { texture, texture, texture, texture, texture }}) boat:set_yaw(placer:get_look_horizontal())