frozenLake

Untitled

Sep 13th, 2014
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. addHook("MobjThinker", function(mobj)
  2. local player = mobj.player
  3. local swimming = 0
  4.  
  5. if swimming == 0 and (player.cmd.buttons & BT_CUSTOM1)
  6. swimming = 1
  7. end
  8. if swimming == 1 and (player.cmd.buttons & BT_CUSTOM2)
  9. swimming = 0
  10. end
  11. if not player.powers[pw_underwater]
  12. and not player.powers[pw_super]
  13. swimming = 0
  14. end
  15. if (player.powers[pw_underwater] | player.powers[pw_super]) and swimming == 1
  16. and not (player.pflags & PF_NIGHTSMODE)
  17. and not (player.pflags & PF_ROPEHANG)
  18. and not (player.pflags & PF_MACESPIN)
  19. and not (player.pflags & PF_STASIS)
  20. and not (player.mo.tracer and player.mo.tracer.type == MT_TUBEWAYPOINT)
  21. if (player.cmd.buttons & BT_JUMP)
  22. //move up if jump is pressed
  23. P_SetObjectMomZ(player.mo, FRACUNIT*8, false)
  24. end
  25. if (player.cmd.buttons & BT_USE)
  26. // move down if spin is pressed
  27. P_SetObjectMomZ(player.mo, FRACUNIT*-8, false)
  28. end
  29. if not (player.cmd.buttons & (BT_JUMP|BT_USE))
  30. // kill z momentum when not moving up or down
  31. player.mo.momz = 0
  32. end
  33. end
  34. end, MT_PLAYER)
Advertisement
Add Comment
Please, Sign In to add comment