Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. /*Heres how it works
  2. These are the options
  3. MouseButton: Left Right Middle Any
  4. Key: Shift Ctrl Alt Any None
  5. ClickType: Click DoubleClick
  6.  
  7. Combine one of each option to get the proc you need to define.
  8. You can leave out the key and it will default to none
  9.  
  10. Here's the format
  11.  
  12. [MouseButton][Key][ClickType](atom/object,location,control,params)
  13. Here's an example
  14.  
  15. mob
  16. proc
  17. LeftClick(atom/object)
  18. world<<"I was left clicked by [object.name]!"
  19. LeftShiftClick(atom/object)
  20. world<<"I was shift clicked by [object.name]!"
  21. MiddleAnyDoubleClick()
  22. world<<"I'm not sure what key was pressed when I was clicked, although I was middle clicked twice. Thats so special!"
  23.  
  24.  
  25. */
  26. client/Click(atom/object, location, control, params, dbl)
  27. var/list/p = params2list(params)
  28. var/mouse=p[3]
  29. var/key=p[4]
  30. var/double=dbl ? "DoubleClick": "Click"
  31. var/list/func=list()
  32. switch(mouse)
  33. if("left")
  34. mouse="Left"
  35. if("right")
  36. mouse="Right"
  37. if("middle")
  38. mouse="Middle"
  39. else
  40. CRASH("(Unknown click command recieved from client)")
  41. func+="[mouse]Any[double]"
  42. switch(key)
  43. if("shift")
  44. key="Shift"
  45. if("ctrl")
  46. key="Ctrl"
  47. if("alt")
  48. key="Alt"
  49. else
  50. key=""
  51. if(key)
  52. func=list("[mouse][key][double]","[mouse]Any[double]","Any[key][double]")
  53. else
  54. func=list("[mouse][double]","[mouse]None[double]","[mouse]Any[double]")
  55. for(var/F in func)
  56. if(hascall(object,F))
  57. call(object,F)(src,location,control,params)
  58. if(dbl) return
  59. ..()
  60. client/DblClick(atom/object, location, control, params)
  61. Click(object,location,control,params,1)
  62. ..()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement