Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Heres how it works
- These are the options
- MouseButton: Left Right Middle Any
- Key: Shift Ctrl Alt Any None
- ClickType: Click DoubleClick
- Combine one of each option to get the proc you need to define.
- You can leave out the key and it will default to none
- Here's the format
- [MouseButton][Key][ClickType](atom/object,location,control,params)
- Here's an example
- mob
- proc
- LeftClick(atom/object)
- world<<"I was left clicked by [object.name]!"
- LeftShiftClick(atom/object)
- world<<"I was shift clicked by [object.name]!"
- MiddleAnyDoubleClick()
- world<<"I'm not sure what key was pressed when I was clicked, although I was middle clicked twice. Thats so special!"
- */
- client/Click(atom/object, location, control, params, dbl)
- var/list/p = params2list(params)
- var/mouse=p[3]
- var/key=p[4]
- var/double=dbl ? "DoubleClick": "Click"
- var/list/func=list()
- switch(mouse)
- if("left")
- mouse="Left"
- if("right")
- mouse="Right"
- if("middle")
- mouse="Middle"
- else
- CRASH("(Unknown click command recieved from client)")
- func+="[mouse]Any[double]"
- switch(key)
- if("shift")
- key="Shift"
- if("ctrl")
- key="Ctrl"
- if("alt")
- key="Alt"
- else
- key=""
- if(key)
- func=list("[mouse][key][double]","[mouse]Any[double]","Any[key][double]")
- else
- func=list("[mouse][double]","[mouse]None[double]","[mouse]Any[double]")
- for(var/F in func)
- if(hascall(object,F))
- call(object,F)(src,location,control,params)
- if(dbl) return
- ..()
- client/DblClick(atom/object, location, control, params)
- Click(object,location,control,params,1)
- ..()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement