mod planes and minimap

User avatar
Calinou
Member
 
Posts: 3124
Joined: Mon Aug 01, 2011 14:26
GitHub: Calinou
IRC: Calinou
In-game: Calinou

Re: mod planes and minimap

by Calinou » Sun Oct 26, 2014 07:32

It is only a model, it isn't a mod.
 

User avatar
kidmondo
Member
 
Posts: 130
Joined: Sun May 11, 2014 07:56
IRC: kidmondo
In-game: kidmondo

Re: mod planes and minimap

by kidmondo » Sun Oct 26, 2014 08:08

Calinou wrote:It is only a model, it isn't a mod.

Would someone be able to make the model into a mod? I mean we have a model, can't someone who knows how to code just alter the heli code and then from there people could develop it...
 

User avatar
Rui
Member
 
Posts: 255
Joined: Wed Oct 01, 2014 12:59
GitHub: Rui-Minetest

[DELETED]

by Rui » Mon Jan 19, 2015 10:15

[DELETED]
Last edited by Rui on Fri Nov 04, 2016 12:48, edited 2 times in total.
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

Re: mod planes and minimap

by Krock » Tue Jan 20, 2015 20:00

Rui wrote:<snip>
I have replaced the model of helicopter Mod.

Looks good but the plane needs a better texture :)
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

User avatar
kidmondo
Member
 
Posts: 130
Joined: Sun May 11, 2014 07:56
IRC: kidmondo
In-game: kidmondo

Re: mod planes and minimap

by kidmondo » Wed Jan 21, 2015 13:05

I am liking where this is going! i mean after the texture it will be a great start to a whole new world :D
 

ozkur
Member
 
Posts: 180
Joined: Wed Oct 07, 2015 20:59
In-game: ozkur or XoRoUZ

Re: mod planes and minimap

by ozkur » Sun Nov 15, 2015 14:23

I could try to... if i understood the code.
Biplanes! 'Nuff said

I am a native English speaker, Ich spreche kein Deuscht, mais je parle un pue français.
 

User avatar
kidmondo
Member
 
Posts: 130
Joined: Sun May 11, 2014 07:56
IRC: kidmondo
In-game: kidmondo

Re: mod planes and minimap

by kidmondo » Fri Nov 20, 2015 21:24

ozkur wrote:I could try to... if i understood the code.


Its worth a try!
 

ozkur
Member
 
Posts: 180
Joined: Wed Oct 07, 2015 20:59
In-game: ozkur or XoRoUZ

Re: mod planes and minimap

by ozkur » Fri Nov 27, 2015 21:07

Does anyone know where in the code it leans?
Biplanes! 'Nuff said

I am a native English speaker, Ich spreche kein Deuscht, mais je parle un pue français.
 

ozkur
Member
 
Posts: 180
Joined: Wed Oct 07, 2015 20:59
In-game: ozkur or XoRoUZ

Re: mod planes and minimap

by ozkur » Sun Nov 29, 2015 14:33

About the mapper thing, It's already included with the default game. You press F9.
Biplanes! 'Nuff said

I am a native English speaker, Ich spreche kein Deuscht, mais je parle un pue français.
 

User avatar
kidmondo
Member
 
Posts: 130
Joined: Sun May 11, 2014 07:56
IRC: kidmondo
In-game: kidmondo

Re: mod planes and minimap

by kidmondo » Mon Nov 30, 2015 00:18

ozkur wrote:Does anyone know where in the code it leans?


As far as I know you'd have to code that as well as most other aircraft features...
 

ozkur
Member
 
Posts: 180
Joined: Wed Oct 07, 2015 20:59
In-game: ozkur or XoRoUZ

Re: mod planes and minimap

by ozkur » Fri Feb 10, 2017 00:45

Ok. I finished.
Biplanes! 'Nuff said

I am a native English speaker, Ich spreche kein Deuscht, mais je parle un pue français.
 

ozkur
Member
 
Posts: 180
Joined: Wed Oct 07, 2015 20:59
In-game: ozkur or XoRoUZ

Re: mod planes and minimap

by ozkur » Fri Feb 10, 2017 00:45

Don't know if anyone is still interested.
Biplanes! 'Nuff said

I am a native English speaker, Ich spreche kein Deuscht, mais je parle un pue français.
 

User avatar
TumeniNodes
Member
 
Posts: 1335
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes

Re: mod planes and minimap

by TumeniNodes » Fri Feb 10, 2017 00:53

ozkur wrote:Don't know if anyone is still interested.


interested in what.... a plane?

.... yezzzzzzz!
Flick?... Flick who?
 

ozkur
Member
 
Posts: 180
Joined: Wed Oct 07, 2015 20:59
In-game: ozkur or XoRoUZ

Re: mod planes and minimap

by ozkur » Fri Feb 10, 2017 01:20

Ok. Crafting isn't quite done.

How do I make one of those pages with mods?
How do I upload the mod?
Biplanes! 'Nuff said

I am a native English speaker, Ich spreche kein Deuscht, mais je parle un pue français.
 

ozkur
Member
 
Posts: 180
Joined: Wed Oct 07, 2015 20:59
In-game: ozkur or XoRoUZ

Re: mod planes and minimap

by ozkur » Fri Feb 10, 2017 23:41

Annnnd.... Done. The textures are weird, but if anyone has a better texture, I might use it.
Landing is difficult, and you have to build the plane on a node and then delete that node to make it work good.

I think I may add guns and bombs.
Biplanes! 'Nuff said

I am a native English speaker, Ich spreche kein Deuscht, mais je parle un pue français.
 

User avatar
TumeniNodes
Member
 
Posts: 1335
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes

Re: mod planes and minimap

by TumeniNodes » Sat Feb 11, 2017 00:32

ozkur wrote:Ok. Crafting isn't quite done.

How do I make one of those pages with mods?
How do I upload the mod?


Did you get any help with this yet?
Flick?... Flick who?
 

ozkur
Member
 
Posts: 180
Joined: Wed Oct 07, 2015 20:59
In-game: ozkur or XoRoUZ

Re: mod planes and minimap

by ozkur » Sat Feb 11, 2017 00:36

TumeniNodes wrote:
ozkur wrote:Ok. Crafting isn't quite done.

How do I make one of those pages with mods?
How do I upload the mod?


Did you get any help with this yet?

no.
Do you know anything?
Biplanes! 'Nuff said

I am a native English speaker, Ich spreche kein Deuscht, mais je parle un pue français.
 

User avatar
TumeniNodes
Member
 
Posts: 1335
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes

Re: mod planes and minimap

by TumeniNodes » Sat Feb 11, 2017 00:49

ozkur wrote:
TumeniNodes wrote:
ozkur wrote:Ok. Crafting isn't quite done.

How do I make one of those pages with mods?
How do I upload the mod?


Did you get any help with this yet?

no.
Do you know anything?


First question.
#1: SO, do you have a mod you made for this plane? And it works?

If "yes" then, that means you have it all together in a folder.?

If "yes", then you want to open an account at https://github.com/ , and let's start uploading your folder, and all the files there.

If you have any issues with setting up your repository, just post it here.

If you are able to get it all set up, you can post the link over where you posted for modding questions, and ask people to look it over and help if there are any issues (such as licensing, etc.)

After all is set, you can then post the link in WIP mods section (there are guidelines on how to post it there as well) but we can go over that once everything is all set
Flick?... Flick who?
 

User avatar
TumeniNodes
Member
 
Posts: 1335
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes

Re: mod planes and minimap

by TumeniNodes » Sat Feb 11, 2017 00:55

When you "open a new repository" on github,

you want to take all your files, such as init.lua, description.txt, depends.txt, etc. and upload them into the repository.
and make sure you click the option to start the new repo with a README.md

next, you want to add a "new file" (just make up an empty document / file and call it what ever you like and then add .txt to the end of the title like> whateveryouwant.txt
but add this right before it so it looks like this> textures/whateveryouwant.txt

this will create the folder that your textures will go into.

open that new textures folder, and upload the textures to it. (once finished you can safely delete that empty.txt file, you no longer need it)

let me know when/if you get that far or if you need help
Flick?... Flick who?
 

ozkur
Member
 
Posts: 180
Joined: Wed Oct 07, 2015 20:59
In-game: ozkur or XoRoUZ

Re: mod planes and minimap

by ozkur » Sat Feb 11, 2017 01:02

#1:yes. yes.
#2:Um...I don't want to really use my email...Which is apparently required.

Also the code is here, proving it works.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local function get_sign(i)
   if i == 0 then
      return 0
   else
      return i/math.abs(i)
   end
end

local plane = {
   physical = true,
   collisionbox = {-1,-1.4,-1, 1,0.3,1},
   makes_footstep_sound = false,
   collide_with_objects = true,
   
   visual = "mesh",
   mesh = "root.x",
   --Player
   driver = nil,
   
   --plane mesh
   model = nil,
   --Rotation
   yaw=0,
   --Speeds
   vx=0,
   vy=0,
   vz=0,
   soundHandle=nil
   
   
}
local planeModel = {
   visual = "mesh",
   mesh = "biplane.b3d",
   textures = {"biplane.png"},
}   

function plane:on_rightclick(clicker)
   if not clicker or not clicker:is_player() then
      return
   end
   if self.driver and clicker == self.driver then
      clicker:set_detach()
      self.driver = nil
      minetest.sound_stop(self.soundHandle)
   elseif not self.driver then
      self.soundHandle=minetest.sound_play({name="biplane_motor"},{object = self.object, gain = 2.0, max_hear_distance = 32, loop = true,})
      self.driver = clicker
      clicker:set_attach(self.model, "", {x=0,y=4,z=0}, {x=0,y=0,z=0})
   end
end

function planeModel:on_activate(staticdata, dtime_s)
   self.object:set_armor_groups({immortal=1})
   local is_attached = false
   for _,object in ipairs(minetest.env:get_objects_inside_radius(self.object:getpos(), 2)) do
      if object and object:get_luaentity() and object:get_luaentity().name=="biplane:plane" then
         if object:get_luaentity().model == nil then
            object:get_luaentity().model = self
         end
         if object:get_luaentity().model == self then
            is_attached = true
         end
      end
   end
   if is_attached == false then
      self.object:remove()
   end
   
end

function plane:on_activate(staticdata, dtime_s)
   self.object:set_armor_groups({cracky=80,choppy=80,fleshy=80})
   self.object:set_hp(30)
   self.prev_y=self.object:getpos()
   if self.model == nil then
      self.model = minetest.env:add_entity(self.object:getpos(), "biplane:planeModel")
      self.model:set_attach(self.object, "", {x=0,y=-5,z=0}, {x=0,y=0,z=0})   
   end
end

function plane:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
   if self.object:get_hp() == 0 then
      if self.model ~= nil then
         self.model:remove()
      end
      if self.soundHandle then
         minetest.sound_stop(self.soundHandle)
      end
      self.object:remove()
      
      if puncher and puncher:is_player() then
         puncher:get_inventory():add_item("main", "default:steel_ingot 5")
         puncher:get_inventory():add_item("main", "default:mese_crystal")
      end
   end
end
function planeModel:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
   self.object:remove()
end
function plane:on_step(dtime)
   --Prevent multi plane control bug
   if self.driver and ( math.abs(self.driver:getpos().x-self.object:getpos().x)>10*dtime or math.abs(self.driver:getpos().y-self.object:getpos().y)>10*dtime or math.abs(self.driver:getpos().z-self.object:getpos().z)>10*dtime) then
      self.driver = nil
      self.model:set_animation({x=0,y=1},0, 0)
      minetest.sound_stop(self.soundHandle)
   end
   
   if self.driver then
      --self.driver:set_animation({ x= 81, y=160, },10,0)
      self.yaw = self.driver:get_look_yaw()
      local v = self.object:getvelocity()
      local ctrl = self.driver:get_player_control()
    local hor_speed = 0.5
      --Forward/backward
      if ctrl.jump then
      self.vx = self.vx + math.cos(self.driver:get_look_yaw())*0.001
         self.vz = self.vz + math.sin(self.driver:get_look_yaw())*0.001
      hor_speed = 0.01
      end
    if ctrl.up then
      self.vx = self.vx + math.cos(self.driver:get_look_yaw())*3
         self.vz = self.vz + math.sin(self.driver:get_look_yaw())*3
      hor_speed = 3
      end
    if not ctrl.down and not ctrl.up then
         self.vx = self.vx+math.cos(self.driver:get_look_yaw())*0.5
         self.vz = self.vz+math.sin(self.driver:get_look_yaw())*0.5
      hor_speed = 0.5
      end
      if ctrl.down then
         self.vx = self.vx+math.cos(self.driver:get_look_yaw())*0.1
         self.vz = self.vz+math.sin(self.driver:get_look_yaw())*0.1
      hor_speed = 0.1
      end
      --Left/right
      if ctrl.left then
         self.vz = self.vz+math.cos(self.driver:get_look_yaw())*0.1
         self.vx = self.vx+math.sin(math.pi+self.driver:get_look_yaw())*0.1
      end
      if ctrl.right then
         self.vz = self.vz-math.cos(self.driver:get_look_yaw())*0.1
         self.vx = self.vx-math.sin(math.pi+self.driver:get_look_yaw())*0.1
      end
      --Up/Down Lift Formula
    self.vy = math.sin(self.driver:get_look_pitch())*hor_speed
      --
   end
   if self.vx==0 and self.vz==0 and self.vy==0 then
      return
   end
   --Decelerating
   local sx=get_sign(self.vx)
   self.vx = self.vx - 0.02*sx
   local sz=get_sign(self.vz)
   self.vz = self.vz - 0.02*sz
   local sy=get_sign(self.vy)
   self.vy = self.vy-0.01*sy
   
   --Stop
   if sx ~= get_sign(self.vx) then
      self.vx = 0
   end
   if sz ~= get_sign(self.vz) then
      self.vz = 0
   end
   if sy ~= get_sign(self.vy) then
      self.vy = 0
   end
   
   --Speed limit
  if math.abs(self.vx) > 4.5 then
    self.vx = 4.5*get_sign(self.vx)
  end
  if math.abs(self.vz) > 10 then
    self.vz = 4.5*get_sign(self.vz)
  end
  if math.abs(self.vy) > 10 then
    self.vz = 4.5*get_sign(self.vy)
  end
 
   
   --Set speed to entity
   
   self.object:setvelocity({x=self.vx, y=self.vy,z=self.vz})
   if self.model then
      self.model:set_attach(self.object,"Root", {x=0,y=0,z=5}, {
         x=-90+self.vx*3*math.cos(self.yaw)+self.vz*3*math.sin(self.yaw),
         y=0-self.vx*3*math.sin(self.yaw)+self.vz*3*math.cos(self.yaw),
         z=(self.yaw-math.pi/2)*57})
   end
end

minetest.register_entity("biplane:plane", plane)
minetest.register_entity("biplane:planeModel", planeModel)
minetest.register_craftitem("biplane:plane", {
   description = "Plane",
   inventory_image = "biplane.png",
   wield_image = "biplane.png",
   wield_scale = {x=1, y=1, z=1},
   liquids_pointable = false,
   
   on_place = function(itemstack, placer, pointed_thing)
      if pointed_thing.type ~= "node" then
         return
      end
      if minetest.get_node(pointed_thing.above).name ~= "air" then
         return
      end
      minetest.env:add_entity(pointed_thing.above, "biplane:plane")
      itemstack:take_item()
      return itemstack
   end,
})
minetest.register_craftitem("biplane:wing", {
   description = "Wing",
   inventory_image = "wing.png",
})
minetest.register_craftitem("biplane:engine", {
   description = "Engine",
   inventory_image = "engine.png",
})
minetest.register_craftitem("biplane:wheel", {
   description = "Wheel",
   inventory_image = "wheel.png",
})
minetest.register_craftitem("biplane:rubber", {
   description = "Rubber",
   inventory_image = "rubber.png",
})
minetest.register_craftitem("biplane:seat", {
   description = "Airplane Middle",
   inventory_image = "seat.png",
})
minetest.register_craftitem("biplane:tail", {
   description = "Airplane Tail",
   inventory_image = "tail.png",
})
minetest.register_craftitem("biplane:controls", {
   description = "Airplane Controls",
   inventory_image = "stick.png",
})
minetest.register_craft({
   output = "biplane:plane",
   recipe = {
      {"", "", "biplane:wing"},
      {"biplane:tail", "biplane:seat", "biplane:engine"},
      {"", "biplane:wheel", "biplane:wing"}
   }
})
minetest.register_craft({
   output = "biplane:wing",
   recipe = {
      {"group:wood", "group:stick", "group:wood"},
   }
})
minetest.register_craft({
   output = "biplane:engine",
   recipe = {
      {"default:steel_ingot", "default:steel_ingot", "group:stick"},
      {"default:steel_ingot", "default:coalblock", "group:stick"},
      {"default:steel_ingot", "default:steel_ingot", "group:stick"}
   }
})
minetest.register_craft({
   output = "biplane:wheel",
   recipe = {
      {"", "biplane:rubber", ""},
      {"biplane:rubber", "default:steel_ingot", "biplane:rubber"},
      {"", "biplane:rubber", ""}
   }
})
minetest.register_craft({
   type = "cooking",
   output = "biplane:rubber",
   recipe = "group:tree",
})
minetest.register_craft({
   output = "biplane:seat",
   recipe = {
      {"group:wood", "", "biplane:controls"},
      {"group:wood", "", "group:wood"},
      {"group:wood", "group:wood", "group:wood"}
   }
})
minetest.register_craft({
   output = "biplane:tail",
   recipe = {
      {"group:wood", "", ""},
      {"group:wood", "group:wood", "group:wood"},
      {"", "biplane:wheel", ""}
   }
})
minetest.register_craft({
   output = "biplane:tail",
   recipe = {
      {"group:wood", "", ""},
      {"group:wood", "group:wood", "group:wood"},
      {"default:steelblock", "", ""}
   }
})
minetest.register_craft({
   output = "biplane:tail",
   recipe = {
      {"group:wood", "", ""},
      {"group:wood", "group:wood", "group:wood"},
      {"", "biplane:wheel", ""}
   }
})
minetest.register_craft({
   output = "biplane:controls",
   recipe = {
      {"", "group:stick", ""},
      {"group:stick", "group:stick", "group:stick"},
      {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}
   }
})
Biplanes! 'Nuff said

I am a native English speaker, Ich spreche kein Deuscht, mais je parle un pue français.
 

ozkur
Member
 
Posts: 180
Joined: Wed Oct 07, 2015 20:59
In-game: ozkur or XoRoUZ

Re: mod planes and minimap

by ozkur » Sat Feb 11, 2017 01:09

here we go!
Attachments
biplane.zip
(219.77 KiB) Downloaded 94 times
Biplanes! 'Nuff said

I am a native English speaker, Ich spreche kein Deuscht, mais je parle un pue français.
 

ozkur
Member
 
Posts: 180
Joined: Wed Oct 07, 2015 20:59
In-game: ozkur or XoRoUZ

Re: mod planes and minimap

by ozkur » Sat Feb 11, 2017 01:13

i put it up in WIP mods!
Biplanes! 'Nuff said

I am a native English speaker, Ich spreche kein Deuscht, mais je parle un pue français.
 

User avatar
TumeniNodes
Member
 
Posts: 1335
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes

Re: mod planes and minimap

by TumeniNodes » Sat Feb 11, 2017 01:15

ozkur wrote:#1:yes. yes.
#2:Um...I don't want to really use my email...Which is apparently required.

Also the code is here, proving it works.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local function get_sign(i)
   if i == 0 then
      return 0
   else
      return i/math.abs(i)
   end
end

local plane = {
   physical = true,
   collisionbox = {-1,-1.4,-1, 1,0.3,1},
   makes_footstep_sound = false,
   collide_with_objects = true,
   
   visual = "mesh",
   mesh = "root.x",
   --Player
   driver = nil,
   
   --plane mesh
   model = nil,
   --Rotation
   yaw=0,
   --Speeds
   vx=0,
   vy=0,
   vz=0,
   soundHandle=nil
   
   
}
local planeModel = {
   visual = "mesh",
   mesh = "biplane.b3d",
   textures = {"biplane.png"},
}   

function plane:on_rightclick(clicker)
   if not clicker or not clicker:is_player() then
      return
   end
   if self.driver and clicker == self.driver then
      clicker:set_detach()
      self.driver = nil
      minetest.sound_stop(self.soundHandle)
   elseif not self.driver then
      self.soundHandle=minetest.sound_play({name="biplane_motor"},{object = self.object, gain = 2.0, max_hear_distance = 32, loop = true,})
      self.driver = clicker
      clicker:set_attach(self.model, "", {x=0,y=4,z=0}, {x=0,y=0,z=0})
   end
end

function planeModel:on_activate(staticdata, dtime_s)
   self.object:set_armor_groups({immortal=1})
   local is_attached = false
   for _,object in ipairs(minetest.env:get_objects_inside_radius(self.object:getpos(), 2)) do
      if object and object:get_luaentity() and object:get_luaentity().name=="biplane:plane" then
         if object:get_luaentity().model == nil then
            object:get_luaentity().model = self
         end
         if object:get_luaentity().model == self then
            is_attached = true
         end
      end
   end
   if is_attached == false then
      self.object:remove()
   end
   
end

function plane:on_activate(staticdata, dtime_s)
   self.object:set_armor_groups({cracky=80,choppy=80,fleshy=80})
   self.object:set_hp(30)
   self.prev_y=self.object:getpos()
   if self.model == nil then
      self.model = minetest.env:add_entity(self.object:getpos(), "biplane:planeModel")
      self.model:set_attach(self.object, "", {x=0,y=-5,z=0}, {x=0,y=0,z=0})   
   end
end

function plane:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
   if self.object:get_hp() == 0 then
      if self.model ~= nil then
         self.model:remove()
      end
      if self.soundHandle then
         minetest.sound_stop(self.soundHandle)
      end
      self.object:remove()
      
      if puncher and puncher:is_player() then
         puncher:get_inventory():add_item("main", "default:steel_ingot 5")
         puncher:get_inventory():add_item("main", "default:mese_crystal")
      end
   end
end
function planeModel:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
   self.object:remove()
end
function plane:on_step(dtime)
   --Prevent multi plane control bug
   if self.driver and ( math.abs(self.driver:getpos().x-self.object:getpos().x)>10*dtime or math.abs(self.driver:getpos().y-self.object:getpos().y)>10*dtime or math.abs(self.driver:getpos().z-self.object:getpos().z)>10*dtime) then
      self.driver = nil
      self.model:set_animation({x=0,y=1},0, 0)
      minetest.sound_stop(self.soundHandle)
   end
   
   if self.driver then
      --self.driver:set_animation({ x= 81, y=160, },10,0)
      self.yaw = self.driver:get_look_yaw()
      local v = self.object:getvelocity()
      local ctrl = self.driver:get_player_control()
    local hor_speed = 0.5
      --Forward/backward
      if ctrl.jump then
      self.vx = self.vx + math.cos(self.driver:get_look_yaw())*0.001
         self.vz = self.vz + math.sin(self.driver:get_look_yaw())*0.001
      hor_speed = 0.01
      end
    if ctrl.up then
      self.vx = self.vx + math.cos(self.driver:get_look_yaw())*3
         self.vz = self.vz + math.sin(self.driver:get_look_yaw())*3
      hor_speed = 3
      end
    if not ctrl.down and not ctrl.up then
         self.vx = self.vx+math.cos(self.driver:get_look_yaw())*0.5
         self.vz = self.vz+math.sin(self.driver:get_look_yaw())*0.5
      hor_speed = 0.5
      end
      if ctrl.down then
         self.vx = self.vx+math.cos(self.driver:get_look_yaw())*0.1
         self.vz = self.vz+math.sin(self.driver:get_look_yaw())*0.1
      hor_speed = 0.1
      end
      --Left/right
      if ctrl.left then
         self.vz = self.vz+math.cos(self.driver:get_look_yaw())*0.1
         self.vx = self.vx+math.sin(math.pi+self.driver:get_look_yaw())*0.1
      end
      if ctrl.right then
         self.vz = self.vz-math.cos(self.driver:get_look_yaw())*0.1
         self.vx = self.vx-math.sin(math.pi+self.driver:get_look_yaw())*0.1
      end
      --Up/Down Lift Formula
    self.vy = math.sin(self.driver:get_look_pitch())*hor_speed
      --
   end
   if self.vx==0 and self.vz==0 and self.vy==0 then
      return
   end
   --Decelerating
   local sx=get_sign(self.vx)
   self.vx = self.vx - 0.02*sx
   local sz=get_sign(self.vz)
   self.vz = self.vz - 0.02*sz
   local sy=get_sign(self.vy)
   self.vy = self.vy-0.01*sy
   
   --Stop
   if sx ~= get_sign(self.vx) then
      self.vx = 0
   end
   if sz ~= get_sign(self.vz) then
      self.vz = 0
   end
   if sy ~= get_sign(self.vy) then
      self.vy = 0
   end
   
   --Speed limit
  if math.abs(self.vx) > 4.5 then
    self.vx = 4.5*get_sign(self.vx)
  end
  if math.abs(self.vz) > 10 then
    self.vz = 4.5*get_sign(self.vz)
  end
  if math.abs(self.vy) > 10 then
    self.vz = 4.5*get_sign(self.vy)
  end
 
   
   --Set speed to entity
   
   self.object:setvelocity({x=self.vx, y=self.vy,z=self.vz})
   if self.model then
      self.model:set_attach(self.object,"Root", {x=0,y=0,z=5}, {
         x=-90+self.vx*3*math.cos(self.yaw)+self.vz*3*math.sin(self.yaw),
         y=0-self.vx*3*math.sin(self.yaw)+self.vz*3*math.cos(self.yaw),
         z=(self.yaw-math.pi/2)*57})
   end
end

minetest.register_entity("biplane:plane", plane)
minetest.register_entity("biplane:planeModel", planeModel)
minetest.register_craftitem("biplane:plane", {
   description = "Plane",
   inventory_image = "biplane.png",
   wield_image = "biplane.png",
   wield_scale = {x=1, y=1, z=1},
   liquids_pointable = false,
   
   on_place = function(itemstack, placer, pointed_thing)
      if pointed_thing.type ~= "node" then
         return
      end
      if minetest.get_node(pointed_thing.above).name ~= "air" then
         return
      end
      minetest.env:add_entity(pointed_thing.above, "biplane:plane")
      itemstack:take_item()
      return itemstack
   end,
})
minetest.register_craftitem("biplane:wing", {
   description = "Wing",
   inventory_image = "wing.png",
})
minetest.register_craftitem("biplane:engine", {
   description = "Engine",
   inventory_image = "engine.png",
})
minetest.register_craftitem("biplane:wheel", {
   description = "Wheel",
   inventory_image = "wheel.png",
})
minetest.register_craftitem("biplane:rubber", {
   description = "Rubber",
   inventory_image = "rubber.png",
})
minetest.register_craftitem("biplane:seat", {
   description = "Airplane Middle",
   inventory_image = "seat.png",
})
minetest.register_craftitem("biplane:tail", {
   description = "Airplane Tail",
   inventory_image = "tail.png",
})
minetest.register_craftitem("biplane:controls", {
   description = "Airplane Controls",
   inventory_image = "stick.png",
})
minetest.register_craft({
   output = "biplane:plane",
   recipe = {
      {"", "", "biplane:wing"},
      {"biplane:tail", "biplane:seat", "biplane:engine"},
      {"", "biplane:wheel", "biplane:wing"}
   }
})
minetest.register_craft({
   output = "biplane:wing",
   recipe = {
      {"group:wood", "group:stick", "group:wood"},
   }
})
minetest.register_craft({
   output = "biplane:engine",
   recipe = {
      {"default:steel_ingot", "default:steel_ingot", "group:stick"},
      {"default:steel_ingot", "default:coalblock", "group:stick"},
      {"default:steel_ingot", "default:steel_ingot", "group:stick"}
   }
})
minetest.register_craft({
   output = "biplane:wheel",
   recipe = {
      {"", "biplane:rubber", ""},
      {"biplane:rubber", "default:steel_ingot", "biplane:rubber"},
      {"", "biplane:rubber", ""}
   }
})
minetest.register_craft({
   type = "cooking",
   output = "biplane:rubber",
   recipe = "group:tree",
})
minetest.register_craft({
   output = "biplane:seat",
   recipe = {
      {"group:wood", "", "biplane:controls"},
      {"group:wood", "", "group:wood"},
      {"group:wood", "group:wood", "group:wood"}
   }
})
minetest.register_craft({
   output = "biplane:tail",
   recipe = {
      {"group:wood", "", ""},
      {"group:wood", "group:wood", "group:wood"},
      {"", "biplane:wheel", ""}
   }
})
minetest.register_craft({
   output = "biplane:tail",
   recipe = {
      {"group:wood", "", ""},
      {"group:wood", "group:wood", "group:wood"},
      {"default:steelblock", "", ""}
   }
})
minetest.register_craft({
   output = "biplane:tail",
   recipe = {
      {"group:wood", "", ""},
      {"group:wood", "group:wood", "group:wood"},
      {"", "biplane:wheel", ""}
   }
})
minetest.register_craft({
   output = "biplane:controls",
   recipe = {
      {"", "group:stick", ""},
      {"group:stick", "group:stick", "group:stick"},
      {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}
   }
})


A little, trick you can use... "make up a new email"
if you do not yet have an email using your user name here on this forum, then open up a new email acct like> ozkur@gmail.com, (or something) to use to open a new acct on github.

That would work out better anyway, as it will be easy to go back and forth with minetest stuff you create, with your username... and it won't interfere with any none/personal Minetest stuff
Flick?... Flick who?
 

User avatar
TumeniNodes
Member
 
Posts: 1335
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes

Re: mod planes and minimap

by TumeniNodes » Sat Feb 11, 2017 01:17

ozkur wrote:i put it up in WIP mods!


ok, I'll take a look.
As long as my pc doesn't blow up or something when I open the zip we'll be ok :P
Flick?... Flick who?
 

Previous

Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 46 guests

cron