From 9a85694a058ed5c3a72fdcc7cfd372eab995b3d5 Mon Sep 17 00:00:00 2001 From: Alexsandro Percy Date: Sat, 9 Mar 2024 09:46:28 -0300 Subject: [PATCH] improved compass when attached --- entities.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/entities.lua b/entities.lua index 34ea35d..cc56534 100755 --- a/entities.lua +++ b/entities.lua @@ -600,6 +600,7 @@ minetest.register_entity("ap_airship:airship", { properties.infotext = (data.stored_owner or "") .. " nice airship" self.object:set_properties(properties) if data.remove then + airutils.destroy_inventory(self) self.object:remove() return end @@ -824,7 +825,12 @@ minetest.register_entity("ap_airship:airship", { self.object:set_acceleration(accel) self.object:set_rotation({x=newpitch,y=newyaw,z=newroll}) - local N_angle = math.deg(newyaw) + local compass_angle = newyaw + local rem_obj = self.object:get_attach() + if rem_obj then + compass_angle = rem_obj:get_rotation().y + end + local N_angle = math.deg(compass_angle) local S_angle = N_angle + 180 self.object:set_bone_position("elevator", {x=0,y=60.5919,z=-284.79}, {x=0,y=newpitch,z=0})