Advertisement
Guest User

Untitled

a guest
Jul 7th, 2014
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. minetest.register_craftitem("parachute:parachute_item", {
  2.     inventory_image = "default_brick.png",
  3.     on_use = function(itemstack, user, pointed_thing)
  4.         local pos = user:getpos()
  5.         local on = minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z})
  6.         if on.name == "air" then
  7.             pos.y = pos.y + 3
  8.             local ent = minetest.add_entity(pos, "parachute:parachute")
  9.             user:set_attach(ent, "", {x=0,y=0,z=0}, {x=0,y=0,z=0})
  10.             ent.object:setvelocity({x = 0, y = user:getvelocity().y, z = 0})
  11.             ent = ent:get_luaentity()
  12.             ent.attached = user:get_player_name()
  13.         else
  14.             minetest.chat_send_player(user:get_player_name(), "Cannot open parachute on ground!")
  15.         end
  16.     end
  17. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement