From 33b28e472b4cfe56176bce00532e041a70d91c53 Mon Sep 17 00:00:00 2001 From: paramat Date: Sun, 10 Jun 2018 06:35:14 +0100 Subject: [PATCH] Add windows. Move driver into gondola. Detect liquids not water --- README.txt | 2 +- init.lua | 39 +++++++++++++++-------------- textures/airboat_airboat_front.png | Bin 122 -> 145 bytes textures/airboat_airboat_inv.png | Bin 146 -> 149 bytes textures/airboat_airboat_left.png | Bin 114 -> 140 bytes textures/airboat_airboat_right.png | Bin 112 -> 139 bytes 6 files changed, 21 insertions(+), 20 deletions(-) diff --git a/README.txt b/README.txt index 6a2e7f6..2a5adeb 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -airboat 0.1.0 by paramat +airboat 0.1.1 by paramat For Minetest 0.5.0dev (of 10/06/18) and later Depends default diff --git a/init.lua b/init.lua index 2ced97d..e7c7060 100644 --- a/init.lua +++ b/init.lua @@ -1,8 +1,4 @@ -local function is_water(pos) - local nn = minetest.get_node(pos).name - return minetest.get_item_group(nn, "water") ~= 0 -end - +-- Functions local function get_sign(i) if i == 0 then @@ -25,6 +21,8 @@ local function get_v(v) end +-- Airboat entity + local airboat = { physical = true, collisionbox = {-0.85, -1.5, -0.85, 0.85, 1.5, 0.85}, @@ -64,7 +62,7 @@ function airboat.on_rightclick(self, clicker) end self.driver = clicker clicker:set_attach(self.object, "", - {x = 0, y = -1, z = 0}, {x = 0, y = 0, z = 0}) + {x = 0, y = -14.25, z = -1}, {x = 0, y = 0, z = 0}) player_api.player_attached[name] = true minetest.after(0.2, function() player_api.set_animation(clicker, "sit" , 30) @@ -124,14 +122,12 @@ function airboat.on_step(self, dtime) self.object:setyaw(yaw - (1 + dtime) * 0.02) end if ctrl.jump then - self.vy = self.vy + 0.075 + self.vy = self.vy + 0.1 elseif ctrl.sneak then - self.vy = self.vy - 0.075 + self.vy = self.vy - 0.1 end end - local velo = self.object:getvelocity() - if self.v == 0 and self.vy == 0 and - velo.x == 0 and velo.y == 0 and velo.z == 0 then + if self.v == 0 and self.vy == 0 then self.object:setpos(self.object:getpos()) return end @@ -146,7 +142,7 @@ function airboat.on_step(self, dtime) end local sy = get_sign(self.vy) - self.vy = self.vy - 0.04 * sy + self.vy = self.vy - 0.03 * sy if sy ~= get_sign(self.vy) then self.vy = 0 end @@ -157,8 +153,9 @@ function airboat.on_step(self, dtime) local new_acce = {x = 0, y = 0, z = 0} local p = self.object:getpos() p.y = p.y - 1.5 - if is_water(p) then - new_acce = {x = 0, y = 20, z = 0} + local def = minetest.registered_nodes[minetest.get_node(p).name] + if def and (def.liquidtype == "source" or def.liquidtype == "flowing") then + new_acce = {x = 0, y = 10, z = 0} end self.object:setpos(self.object:getpos()) @@ -171,12 +168,13 @@ end minetest.register_entity("airboat:airboat", airboat) +-- Craftitem + minetest.register_craftitem("airboat:airboat", { description = "Airboat", inventory_image = "airboat_airboat_inv.png", wield_scale = {x = 4, y = 4, z = 4}, liquids_pointable = true, - groups = {flammable = 2}, on_place = function(itemstack, placer, pointed_thing) local under = pointed_thing.under @@ -193,10 +191,11 @@ minetest.register_craftitem("airboat:airboat", { return itemstack end pointed_thing.under.y = pointed_thing.under.y + 2 - boat = minetest.add_entity(pointed_thing.under, "airboat:airboat") - if boat then + local airboat = minetest.add_entity(pointed_thing.under, + "airboat:airboat") + if airboat then if placer then - boat:setyaw(placer:get_look_horizontal()) + airboat:setyaw(placer:get_look_horizontal()) end local player_name = placer and placer:get_player_name() or "" if not (creative and creative.is_enabled_for and @@ -209,6 +208,8 @@ minetest.register_craftitem("airboat:airboat", { }) +-- Nodebox for entity wielditem visual + minetest.register_node("airboat:airboat_nodebox", { description = "Airboat Nodebox", tiles = { -- top base right left front back @@ -223,7 +224,7 @@ minetest.register_node("airboat:airboat_nodebox", { drawtype = "nodebox", node_box = { type = "fixed", - fixed = { -- widmin heimin lenmin widmax heimax lenmax + 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 diff --git a/textures/airboat_airboat_front.png b/textures/airboat_airboat_front.png index 22d9ac8416013a1a5b58724895e6dd01964bafa8..f8948083f0447020098a0a0f9aea5c111eed4863 100644 GIT binary patch delta 115 zcmb=L$T&eImnXm{#5Gknoq>U&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 delta 45 zcmbQrIEitBKcn8n07XSd1%_3Q$qjECjTIOeitdYSoV7*Em;nepUHx3vIVCg!06y0Z A{r~^~ diff --git a/textures/airboat_airboat_left.png b/textures/airboat_airboat_left.png index b051f282023704691727543d53955a97d65bd01b..02857c939e22741a9a8b51ca3a8921e039d67b48 100644 GIT binary patch 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 delta 84 zcmeBSESjL=#~I)g;>y6l(9qEE|NsAkm+meGa#TEB978nDCv&tmhOQ1X3^)_n%Hn2u nbP0l+XkK7rh+n diff --git a/textures/airboat_airboat_right.png b/textures/airboat_airboat_right.png index 2a54b3a28e22e8efdaafc5b04cd1b6bcb9a0896a..4ca510a8f8a8d44352760840ad84405d6b26be1a 100644 GIT binary patch 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?y6l(9qEE|NsAkm+meGa+Ew>978nDCr50}3f15-2xw+zUo4|l lC~<&6YR{BHhYANvhS?56f7lWyF9ND&@O1TaS?83{1OUDe94i0-