From 0e0d6d1666273182c4e84fced2f7ce3868bddc25 Mon Sep 17 00:00:00 2001 From: paramat Date: Mon, 11 Jun 2018 07:53:58 +0100 Subject: [PATCH] Remove windows. Move driver back to envelope. Add cruise mode --- README.txt | 2 +- init.lua | 43 ++++++++++++++++++----------- textures/airboat_airboat_front.png | Bin 145 -> 122 bytes textures/airboat_airboat_inv.png | Bin 149 -> 146 bytes textures/airboat_airboat_left.png | Bin 140 -> 114 bytes textures/airboat_airboat_right.png | Bin 139 -> 112 bytes 6 files changed, 28 insertions(+), 17 deletions(-) diff --git a/README.txt b/README.txt index 2a5adeb..73a5cba 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -airboat 0.1.1 by paramat +airboat 0.1.2 by paramat For Minetest 0.5.0dev (of 10/06/18) and later Depends default diff --git a/init.lua b/init.lua index e7c7060..6ec0ea5 100644 --- a/init.lua +++ b/init.lua @@ -31,9 +31,10 @@ local airboat = { textures = {"airboat:airboat_nodebox"}, driver = nil, + removed = false, v = 0, vy = 0, - removed = false + auto = false, } @@ -42,8 +43,10 @@ function airboat.on_rightclick(self, clicker) return end local name = clicker:get_player_name() + -- Detach if self.driver and clicker == self.driver then self.driver = nil + self.auto = false clicker:set_detach() player_api.player_attached[name] = false player_api.set_animation(clicker, "stand" , 30) @@ -51,6 +54,7 @@ function airboat.on_rightclick(self, clicker) minetest.after(0.1, function() clicker:setpos(pos) end) + -- Attach elseif not self.driver then local attach = clicker:get_attach() if attach and attach:get_luaentity() then @@ -62,7 +66,7 @@ function airboat.on_rightclick(self, clicker) end self.driver = clicker clicker:set_attach(self.object, "", - {x = 0, y = -14.25, z = -1}, {x = 0, y = 0, z = 0}) + {x = 0, y = -2, z = 0}, {x = 0, y = 0, z = 0}) player_api.player_attached[name] = true minetest.after(0.2, function() player_api.set_animation(clicker, "sit" , 30) @@ -97,7 +101,6 @@ function airboat.on_punch(self, puncher) minetest.add_item(self.object:getpos(), leftover) end end - -- Delay remove to ensure player is detached minetest.after(0.1, function() self.object:remove() end) @@ -109,24 +112,32 @@ function airboat.on_step(self, dtime) self.v = get_v(self.object:getvelocity()) * get_sign(self.v) self.vy = self.object:getvelocity().y if self.driver then - local ctrl = self.driver:get_player_control() local yaw = self.object:getyaw() - if ctrl.up then - self.v = self.v + 0.1 + local ctrl = self.driver:get_player_control() + if ctrl.up and ctrl.down then + if not self.auto then + self.auto = true + end elseif ctrl.down then self.v = self.v - 0.1 + if self.auto then + self.auto = false + end + elseif ctrl.up or self.auto then + self.v = self.v + 0.1 end if ctrl.left then - self.object:setyaw(yaw + (1 + dtime) * 0.02) + self.object:setyaw(yaw + (1 + dtime) * 0.015) elseif ctrl.right then - self.object:setyaw(yaw - (1 + dtime) * 0.02) + self.object:setyaw(yaw - (1 + dtime) * 0.015) end if ctrl.jump then - self.vy = self.vy + 0.1 + self.vy = self.vy + 0.075 elseif ctrl.sneak then - self.vy = self.vy - 0.1 + self.vy = self.vy - 0.075 end end + if self.v == 0 and self.vy == 0 then self.object:setpos(self.object:getpos()) return @@ -225,12 +236,12 @@ minetest.register_node("airboat:airboat_nodebox", { node_box = { type = "fixed", fixed = { -- widmin heimin lenmin widmax heimax lenmax - {-0.271, -0.167, -0.5, 0.271, 0.375, 0.5}, -- Envelope - {-0.167, -0.5, -0.25, 0.167, -0.167, 0.25}, -- Gondola - {-0.021, 0.375, -0.5, 0.021, 0.5, -0.25}, -- Top fin - {-0.021, -0.292, -0.5, 0.021, -0.167, -0.25}, -- Base fin - {-0.396, 0.083, -0.5, -0.271, 0.125, -0.25}, -- Left fin - {0.271, 0.083, -0.5, 0.396, 0.125, -0.25}, -- Right fin + {-0.271, -0.167, -0.5, 0.271, 0.375, 0.5}, -- Envelope + {-0.167, -0.5, -0.25, 0.167, -0.167, 0.25}, -- Gondola + {-0.021, 0.375, -0.5, 0.021, 0.5, -0.25}, -- Top fin + {-0.021, -0.292, -0.5, 0.021, -0.167, -0.25}, -- Base fin + {-0.396, 0.083, -0.5, -0.271, 0.125, -0.25}, -- Left fin + { 0.271, 0.083, -0.5, 0.396, 0.125, -0.25}, -- Right fin }, }, groups = {not_in_creative_inventory = 1}, diff --git a/textures/airboat_airboat_front.png b/textures/airboat_airboat_front.png index f8948083f0447020098a0a0f9aea5c111eed4863..22d9ac8416013a1a5b58724895e6dd01964bafa8 100644 GIT binary patch delta 92 zcmbQpST#WU&p`qdb|NlE@9W?=R7)yfuf*Bm1-ADs+j6Gc(Lp07O zN3b%jj&Iat(<%u2&)yu~JYn;HdyzlR&w0|qnH@C*4jjJK*w|S3qA($jfgyR#^lSgN SrS$`~GkCiCxvXHaEuwQYLISJ8ce diff --git a/textures/airboat_airboat_left.png b/textures/airboat_airboat_left.png index 02857c939e22741a9a8b51ca3a8921e039d67b48..b051f282023704691727543d53955a97d65bd01b 100644 GIT binary patch delta 84 zcmeBSESjL=#~I)g;>y6l(9qEE|NsAkm+meGa#TEB978nDCv&tmhOQ1X3^)_n%Hn2u nbP0l+XkK7rh+n delta 110 zcmXTwVVt0n!4u#U;+m?P&cMLX(9rPz|Not{j+y{Dj3q&S!3+-1ZlnP@dY&$hAsXkC zBUqV%D$*Cs_$<%aQ?%kBBU_G!go7m?4^L0X0|v<}&mCmCrZY37`5%oi{aOA4sFT6d L)z4*}Q$iB}qkt#c diff --git a/textures/airboat_airboat_right.png b/textures/airboat_airboat_right.png index 4ca510a8f8a8d44352760840ad84405d6b26be1a..2a54b3a28e22e8efdaafc5b04cd1b6bcb9a0896a 100644 GIT binary patch delta 82 zcmeBXESR9;!x`Wc;>y6l(9qEE|NsAkm+meGa+Ew>978nDCr50}3f15-2xw+zUo4|l lC~<&6YR{BHhYANvhS?56f7lWyF9ND&@O1TaS?83{1OUDe94i0- delta 109 zcmXTuW}Kjs&J*Ah;+m?P&cMLX(9rPz|Not{j+y{Dj3q&S!3+-1ZlnP@x}GkMAsXkC ze*opRBoY>|vGciEhCFI%Vl=66c9xZpkU062!O+*zp#9Mk28P$Gk4AiJasCI?$l&Sf K=d#Wzp$Pzvd?