Guest User

magic

a guest
Apr 10th, 2013
16
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local function MG(NAME, DESC, IMG, SPEED, JUMP, GRAV)
  2.     minetest.register_craftitem(NAME, {
  3.         description = DESC,
  4.         inventory_image = IMG,
  5.     })
  6.    
  7.     minetest.register_on_joinplayer(function(player)
  8.         local wielded_item = player:get_wielded_item():get_name()
  9.     end)
  10.    
  11.     minetest.register_globalstep(function(dtime)
  12.         local wielded_item = player:get_wielded_item():get_name()
  13.         if wielded_item == NAME then
  14.         -- 1 is default when defining the function below set everything you dont want to chnage to 1.
  15.         -- The numbers are ratios compared to the default setting. 1=def, 2=2x, .5=1/2, and so on...
  16.         set_physics_override(speed, jump, gravity)
  17.             speed = SPEED
  18.             jump = JUMP
  19.             gravity = GRAV
  20.         end
  21.     end)
  22. end
  23.  
  24. MG("magic:low_G", "Low Gravity", "magic_lg.png", 1, 1, .5)
  25. MG("magic:high_S", "High Speed", "magic_hs.png", 2, 1, 1)
  26. MG("magic:high_J", "High Jump", "magic_hj.png", 1, 2, 1)
  27. MG("magic:ninja", "Ninja Powers", "ninja_star.png", 2.5, 1.5, 1)
RAW Paste Data