Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- minetest.register_craftitem("parachute:parachute_item", {
- inventory_image = "default_brick.png",
- on_use = function(itemstack, user, pointed_thing)
- local pos = user:getpos()
- local on = minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z})
- if on.name == "air" then
- pos.y = pos.y + 3
- local ent = minetest.add_entity(pos, "parachute:parachute")
- user:set_attach(ent, "", {x=0,y=0,z=0}, {x=0,y=0,z=0})
- ent.object:setvelocity({x = 0, y = user:getvelocity().y, z = 0})
- ent = ent:get_luaentity()
- ent.attached = user:get_player_name()
- else
- minetest.chat_send_player(user:get_player_name(), "Cannot open parachute on ground!")
- end
- end
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement