This is a great mod! However, the glider has infinite durability. Maybe I'll try to fix that, without any knowledge of Lua XD
Edit: I somehow did it without breaking the mod lol. I also removed the rockets, since I thought that it doesn't belong in this mod (but that's my opinion). Here's the function that I slightly modified:
Code: Select all
minetest.register_tool("glider:glider", {
description = "Glider",
inventory_image = "glider_glider.png",
on_use = function(itemstack, user, pt)
local name = user:get_player_name()
local pos = user:get_pos()
local attach = user:get_attach()
local luaent = nil
if attach then
luaent = attach:get_luaentity()
if luaent.name == "glider:hangglider" then
local vel = attach:get_velocity()
attach:remove()
user:set_detach()
user:set_eye_offset({x=0,y=0,z=0},{x=0,y=0,z=0})
user:add_player_velocity(vel)
end
else
pos.y = pos.y + 1.5
local ent = minetest.add_entity(pos, "glider:hangglider")
luaent = ent:get_luaentity()
luaent.driver = name
local rot = {y = user:get_look_horizontal(), x = -user:get_look_vertical(), z = 0}
ent:set_rotation(rot)
local vel = vector.multiply(user:get_player_velocity(),2)
ent:set_velocity(vel)
luaent.speed = math.sqrt(vel.x^2+(vel.y/4)^2+vel.z^2)
user:set_attach(ent, "", {x=0,y=0,z=-10}, {x=90,y=0,z=0})
user:set_eye_offset({x=0,y=-16.25,z=0},{x=0,y=-15,z=0})
itemstack:set_wear(itemstack:get_wear() + 255)
return itemstack
end
end,
})
P.S. I think this only works for Minetest 5.0+
By the way, I borrowed some code from this mod:
https://content.minetest.net/packages/P ... angglider/
Hello! I'm just some random person with an ancient 7 year old potato that is my laptop :)