From 49c53b06a773ada454e4274bcf3d2893517e67c3 Mon Sep 17 00:00:00 2001 From: Sumyjkl Date: Fri, 12 Aug 2022 19:13:53 +1000 Subject: [PATCH] actually fix instancing issue --- init.lua | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) 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())