Advertisement
Guest User

Untitled

a guest
Oct 7th, 2014
357
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.03 KB | None | 0 0
  1. /atom/Click(location,control,params)
  2. //world << "atom.Click() on [src] by [usr] : src.type is [src.type]"
  3. if(usr.client.buildmode)
  4. build_click(usr, usr.client.buildmode, location, control, params, src)
  5. return
  6. // if(using_new_click_proc) //TODO ERRORAGE (see message below)
  7. // return DblClickNew()
  8. return DblClick(location, control, params)
  9.  
  10. var/using_new_click_proc = 0 //TODO ERRORAGE (This is temporary, while the DblClickNew() proc is being tested)
  11.  
  12. /atom/proc/DblClickNew()
  13. if(!usr) return
  14. // TODO DOOHL: Intergrate params to new proc. Saved for another time because var/valid_place is a fucking brainfuck
  15.  
  16. //Spamclick server-overloading prevention delay... THING
  17. if (world.time <= usr:lastDblClick+1)
  18. return
  19. else
  20. usr:lastDblClick = world.time
  21.  
  22. //paralysis and critical condition
  23. if(usr.stat == 1) //Death is handled in attack_ghost()
  24. return
  25.  
  26. if(!istype(usr, /mob/living/silicon/ai))
  27. if (usr.paralysis || usr.stunned || usr.weakened)
  28. return
  29.  
  30. //handle the hud separately
  31. if(istype(src,/obj/screen))
  32. if( usr.restrained() )
  33. if(ishuman(usr))
  34. src.attack_hand(usr)
  35. else if(isAI(usr))
  36. src.attack_ai(usr)
  37. else if(isrobot(usr))
  38. src.attack_ai(usr)
  39. else if(isobserver(usr))
  40. src.attack_ghost(usr)
  41. else if(ismonkey(usr))
  42. src.attack_paw(usr)
  43. else if(isalienadult(usr))
  44. src.attack_alien(usr)
  45. else if(isslime(usr))
  46. src.attack_slime(usr)
  47. else if(isanimal(usr))
  48. src.attack_animal(usr)
  49. else
  50. usr << "This mob type does not support clicks to the HUD. Contact a coder."
  51. else
  52. if(ishuman(usr))
  53. src.hand_h(usr, usr.hand)
  54. else if(isAI(usr))
  55. src.hand_a(usr, usr.hand)
  56. else if(isrobot(usr))
  57. src.hand_a(usr, usr.hand)
  58. else if(isobserver(usr))
  59. return
  60. else if(ismonkey(usr))
  61. src.hand_p(usr, usr.hand)
  62. else if(isalienadult(usr))
  63. src.hand_al(usr, usr.hand)
  64. else if(isslime(usr))
  65. return
  66. else if(isanimal(usr))
  67. return
  68. else
  69. usr << "This mob type does not support restrained clicks to the HUD. Contact a coder."
  70. return
  71.  
  72. //Gets equipped item or used module of robots
  73. var/obj/item/W = usr.get_active_hand()
  74.  
  75. //Attack self
  76. if (W == src && usr.stat == 0)
  77. // spawn (0) //causes runtimes under heavy lag
  78. W.attack_self(usr)
  79. return
  80.  
  81. //Attackby, attack_hand, afterattack, etc. can only be done once every 1 second, unless an object has the NODELAY or USEDELAY flags set
  82. //This segment of code determins this.
  83. if(W)
  84. if( !( (src.loc && src.loc == usr) || (src.loc.loc && src.loc.loc == usr) ) )
  85. //The check above checks that you are not targeting an item which you are holding.
  86. //If you are, (example clicking a backpack), the delays are ignored.
  87. if(W.flags & USEDELAY)
  88. //Objects that use the USEDELAY flag can only attack once every 2 seconds
  89. if (usr.next_move < world.time)
  90. usr.prev_move = usr.next_move
  91. usr.next_move = world.time + 20
  92. else
  93. return //A click has recently been handled already, you need to wait until the anti-spam delay between clicks passes
  94. else if(!(W.flags & NODELAY))
  95. //Objects with NODELAY don't have a delay between uses, while most objects have the standard 1 second delay.
  96. if (usr.next_move < world.time)
  97. usr.prev_move = usr.next_move
  98. usr.next_move = world.time + 10
  99. else
  100. return //A click has recently been handled already, you need to wait until the anti-spam delay between clicks passes
  101. else
  102. //Empty hand
  103. if (usr.next_move < world.time)
  104. usr.prev_move = usr.next_move
  105. usr.next_move = world.time + 10
  106. else
  107. return //A click has recently been handled already, you need to wait until the anti-spam delay between clicks passes
  108.  
  109. //Is the object in a valid place?
  110. var/valid_place = 0
  111. if ( isturf(src) || ( src.loc && isturf(src.loc) ) || ( src.loc.loc && isturf(src.loc.loc) ) )
  112. //Object is either a turf of placed on a turf, thus valid.
  113. //The third one is that it is in a container, which is on a turf, like a box,
  114. //which you mouse-drag opened. Also a valid location.
  115. valid_place = 1
  116.  
  117. if ( ( src.loc && (src.loc == usr) ) || ( src.loc.loc && (src.loc.loc == usr) ) )
  118. //User has the object on them (in their inventory) and it is thus valid
  119. valid_place = 1
  120.  
  121. //Afterattack gets performed every time you click, no matter if it's in range or not. It's used when
  122. //clicking targets for guns and such. If you are clicking on a target that's not in range
  123. //with an item in your hands only afterattack() needs to be performed.
  124. //If the range is valid, afterattack() will be handled in the separate mob-type
  125. //sections below, however only after attackby(). Attack_hand and simmilar procs are handled
  126. //in the mob-type sections below, as some require you to be in range to work (human, monkey..) while others don't (ai, cyborg)
  127. //Also note that afterattack does not differentiate between the holder/attacker's mob-type.
  128. if( W && !valid_place)
  129. W.afterattack(src, usr, (valid_place ? 1 : 0))
  130. return
  131.  
  132. if(ishuman(usr))
  133. var/mob/living/carbon/human/human = usr
  134. //-human stuff-
  135.  
  136. if(human.stat)
  137. return
  138.  
  139. if(human.in_throw_mode)
  140. return human.throw_item(src)
  141.  
  142. var/in_range = in_range(src, human) || src.loc == human
  143.  
  144. if (in_range)
  145. if (!( human.restrained() || human.lying ))
  146. if (W)
  147. attackby(W,human)
  148. if (W)
  149. W.afterattack(src, human)
  150. else
  151. attack_hand(human)
  152. else
  153. hand_h(human, human.hand)
  154. else
  155. if ( (W) && !human.restrained() )
  156. W.afterattack(src, human)
  157.  
  158.  
  159. else if(isAI(usr))
  160. var/mob/living/silicon/ai/ai = usr
  161. //-ai stuff-
  162.  
  163. if(ai.stat)
  164. return
  165.  
  166. if (ai.control_disabled)
  167. return
  168.  
  169. if( !ai.restrained() )
  170. attack_ai(ai)
  171. else
  172. hand_a(ai, ai.hand)
  173.  
  174. else if(isrobot(usr))
  175. var/mob/living/silicon/robot/robot = usr
  176. //-cyborg stuff-
  177.  
  178. if(robot.stat)
  179. return
  180.  
  181. if (robot.lockcharge)
  182. return
  183.  
  184.  
  185.  
  186. if(W)
  187. var/in_range = in_range(src, robot) || src.loc == robot
  188. if(in_range)
  189. attackby(W,robot)
  190. if (W)
  191. W.afterattack(src, robot)
  192. else
  193. if( !robot.restrained() )
  194. attack_robot(robot)
  195. else
  196. hand_r(robot, robot.hand)
  197.  
  198. else if(isobserver(usr))
  199. var/mob/dead/observer/ghost = usr
  200. //-ghost stuff-
  201.  
  202. if(ghost)
  203. if(W)
  204. if(usr.client && usr.client.holder)
  205. src.attackby(W, ghost) //This is so admins can interact with things ingame.
  206. else
  207. src.attack_ghost(ghost) //Something's gone wrong, non-admin ghosts shouldn't be able to hold things.
  208. else
  209. if(usr.client && usr.client.holder)
  210. src.attack_admin(ghost) //This is so admins can interact with things ingame.
  211. else
  212. src.attack_ghost(ghost) //Standard click as ghost
  213.  
  214.  
  215. else if(ismonkey(usr))
  216. var/mob/living/carbon/monkey/monkey = usr
  217. //-monkey stuff-
  218.  
  219. if(monkey.stat)
  220. return
  221.  
  222. if(monkey.in_throw_mode)
  223. return monkey.throw_item(src)
  224.  
  225. var/in_range = in_range(src, monkey) || src.loc == monkey
  226.  
  227. if (in_range)
  228. if ( !monkey.restrained() )
  229. if (W)
  230. attackby(W,monkey)
  231. if (W)
  232. W.afterattack(src, monkey)
  233. else
  234. attack_paw(monkey)
  235. else
  236. hand_p(monkey, monkey.hand)
  237. else
  238. if ( (W) && !monkey.restrained() )
  239. W.afterattack(src, monkey)
  240.  
  241. else if(isalienadult(usr))
  242. var/mob/living/carbon/alien/humanoid/alien = usr
  243. //-alien stuff-
  244.  
  245. if(alien.stat)
  246. return
  247.  
  248. var/in_range = in_range(src, alien) || src.loc == alien
  249.  
  250. if (in_range)
  251. if ( !alien.restrained() )
  252. if (W)
  253. attackby(W,alien)
  254. if (W)
  255. W.afterattack(src, alien)
  256. else
  257. attack_alien(alien)
  258. else
  259. hand_al(alien, alien.hand)
  260. else
  261. if ( (W) && !alien.restrained() )
  262. W.afterattack(src, alien)
  263.  
  264. else if(islarva(usr))
  265. var/mob/living/carbon/alien/larva/alien = usr
  266. if(alien.stat)
  267. return
  268.  
  269. var/in_range = in_range(src, alien) || src.loc == alien
  270.  
  271. if (in_range)
  272. if ( !alien.restrained() )
  273. attack_larva(alien)
  274.  
  275. else if(isslime(usr))
  276. var/mob/living/carbon/slime/slime = usr
  277. //-slime stuff-
  278.  
  279. if(slime.stat)
  280. return
  281.  
  282. var/in_range = in_range(src, slime) || src.loc == slime
  283.  
  284. if (in_range)
  285. if ( !slime.restrained() )
  286. if (W)
  287. attackby(W,slime)
  288. if (W)
  289. W.afterattack(src, slime)
  290. else
  291. attack_slime(slime)
  292. else
  293. hand_m(slime, slime.hand)
  294. else
  295. if ( (W) && !slime.restrained() )
  296. W.afterattack(src, slime)
  297.  
  298.  
  299. else if(isanimal(usr))
  300. var/mob/living/simple_animal/animal = usr
  301. //-simple animal stuff-
  302.  
  303. if(animal.stat)
  304. return
  305.  
  306. var/in_range = in_range(src, animal) || src.loc == animal
  307.  
  308. if (in_range)
  309. if ( !animal.restrained() )
  310. attack_animal(animal)
  311.  
  312. /atom/DblClick(location, control, params) //TODO: DEFERRED: REWRITE
  313. if(!usr) return
  314.  
  315. // ------- TIME SINCE LAST CLICK -------
  316. if (world.time <= usr:lastDblClick+1)
  317. // world << "BLOCKED atom.DblClick() on [src] by [usr] : src.type is [src.type]"
  318. return
  319. else
  320. // world << "atom.DblClick() on [src] by [usr] : src.type is [src.type]"
  321. usr:lastDblClick = world.time
  322.  
  323. //Putting it here for now. It diverts stuff to the mech clicking procs. Putting it here stops us drilling items in our inventory Carn
  324. if(istype(usr.loc,/obj/mecha))
  325. if(usr.client && (src in usr.client.screen))
  326. return
  327. var/obj/mecha/Mech = usr.loc
  328. Mech.click_action(src,usr)
  329. return
  330.  
  331. // ------- DIR CHANGING WHEN CLICKING ------
  332. if( iscarbon(usr) && !usr.buckled )
  333. if( src.x && src.y && usr.x && usr.y )
  334. var/dx = src.x - usr.x
  335. var/dy = src.y - usr.y
  336.  
  337. if(dy || dx)
  338. if(abs(dx) < abs(dy))
  339. if(dy > 0) usr.dir = NORTH
  340. else usr.dir = SOUTH
  341. else
  342. if(dx > 0) usr.dir = EAST
  343. else usr.dir = WEST
  344. else
  345. if(pixel_y > 16) usr.dir = NORTH
  346. else if(pixel_y < -16) usr.dir = SOUTH
  347. else if(pixel_x > 16) usr.dir = EAST
  348. else if(pixel_x < -16) usr.dir = WEST
  349.  
  350.  
  351.  
  352.  
  353. // ------- AI -------
  354. else if (istype(usr, /mob/living/silicon/ai))
  355. var/mob/living/silicon/ai/ai = usr
  356. if (ai.control_disabled)
  357. return
  358.  
  359. // ------- CYBORG -------
  360. else if (istype(usr, /mob/living/silicon/robot))
  361. var/mob/living/silicon/robot/bot = usr
  362. if (bot.lockcharge) return
  363. ..()
  364.  
  365.  
  366. // ------- SHIFT-CLICK -------
  367.  
  368. if(params)
  369. var/parameters = params2list(params)
  370.  
  371. if(parameters["shift"]){
  372. if(!isAI(usr))
  373. ShiftClick(usr)
  374. else
  375. AIShiftClick(usr)
  376. return
  377. }
  378.  
  379. // ------- ALT-CLICK -------
  380.  
  381. if(parameters["alt"]){
  382. if(!isAI(usr))
  383. AltClick(usr)
  384. else
  385. AIAltClick(usr)
  386. return
  387. }
  388.  
  389. // ------- CTRL-CLICK -------
  390.  
  391. if(parameters["ctrl"]){
  392. if(!isAI(usr))
  393. CtrlClick(usr)
  394. else
  395. AICtrlClick(usr)
  396. return
  397. }
  398.  
  399. // ------- MIDDLE-CLICK -------
  400.  
  401. if(parameters["middle"]){
  402. if(!isAI(usr))
  403. MiddleClick(usr)
  404. return
  405. }
  406.  
  407. // ------- THROW -------
  408. if(usr.in_throw_mode)
  409. return usr:throw_item(src)
  410.  
  411. // ------- ITEM IN HAND DEFINED -------
  412. var/obj/item/W = usr.get_active_hand()
  413. /* Now handled by get_active_hand()
  414. // ------- ROBOT -------
  415. if(istype(usr, /mob/living/silicon/robot))
  416. if(!isnull(usr:module_active))
  417. W = usr:module_active
  418. else
  419. W = null
  420. */
  421. // ------- ATTACK SELF -------
  422. if (W == src && usr.stat == 0)
  423. W.attack_self(usr)
  424. if(usr.hand)
  425. usr.update_inv_l_hand(0) //update in-hand overlays
  426. else
  427. usr.update_inv_r_hand(0)
  428. return
  429.  
  430. // ------- PARALYSIS, STUN, WEAKENED, DEAD, (And not AI) -------
  431. if (((usr.paralysis || usr.stunned || usr.weakened) && !istype(usr, /mob/living/silicon/ai)) || usr.stat != 0)
  432. return
  433.  
  434. // ------- CLICKING STUFF IN CONTAINERS -------
  435. if ((!( src in usr.contents ) && (((!( isturf(src) ) && (!( isturf(src.loc) ) && (src.loc && !( isturf(src.loc.loc) )))) || !( isturf(usr.loc) )) && (src.loc != usr.loc && (!( istype(src, /obj/screen) ) && !( usr.contents.Find(src.loc) ))))))
  436. if (istype(usr, /mob/living/silicon/ai))
  437. var/mob/living/silicon/ai/ai = usr
  438. if (ai.control_disabled || ai.malfhacking)
  439. return
  440. else
  441. return
  442.  
  443. // ------- 1 TILE AWAY -------
  444. var/t5
  445. // ------- AI CAN CLICK ANYTHING -------
  446. if(istype(usr, /mob/living/silicon/ai))
  447. t5 = 1
  448. // ------- CYBORG CAN CLICK ANYTHING WHEN NOT HOLDING STUFF -------
  449. else if(istype(usr, /mob/living/silicon/robot) && !W)
  450. t5 = 1
  451. else
  452. t5 = in_range(src, usr) || src.loc == usr
  453.  
  454. // world << "according to dblclick(), t5 is [t5]"
  455.  
  456. // ------- ACTUALLY DETERMINING STUFF -------
  457. if (((t5 || (W && (W.flags & USEDELAY))) && !( istype(src, /obj/screen) )))
  458.  
  459. // ------- ( CAN USE ITEM OR HAS 1 SECOND USE DELAY ) AND NOT CLICKING ON SCREEN -------
  460.  
  461. if (usr.next_move < world.time)
  462. usr.prev_move = usr.next_move
  463. usr.next_move = world.time + 10
  464. else
  465. // ------- ALREADY USED ONE ITEM WITH USE DELAY IN THE PREVIOUS SECOND -------
  466. return
  467.  
  468. // ------- DELAY CHECK PASSED -------
  469.  
  470. if ((src.loc && (get_dist(src, usr) < 2 || src.loc == usr.loc)))
  471.  
  472. // ------- CLICKED OBJECT EXISTS IN GAME WORLD, DISTANCE FROM PERSON TO OBJECT IS 1 SQUARE OR THEY'RE ON THE SAME SQUARE -------
  473.  
  474. var/direct = get_dir(usr, src)
  475. var/obj/item/weapon/dummy/D = new /obj/item/weapon/dummy( usr.loc )
  476. var/ok = 0
  477. if ( (direct - 1) & direct)
  478.  
  479. // ------- CLICKED OBJECT IS LOCATED IN A DIAGONAL POSITION FROM THE PERSON -------
  480.  
  481. var/turf/Step_1
  482. var/turf/Step_2
  483. switch(direct)
  484. if(5.0)
  485. Step_1 = get_step(usr, NORTH)
  486. Step_2 = get_step(usr, EAST)
  487.  
  488. if(6.0)
  489. Step_1 = get_step(usr, SOUTH)
  490. Step_2 = get_step(usr, EAST)
  491.  
  492. if(9.0)
  493. Step_1 = get_step(usr, NORTH)
  494. Step_2 = get_step(usr, WEST)
  495.  
  496. if(10.0)
  497. Step_1 = get_step(usr, SOUTH)
  498. Step_2 = get_step(usr, WEST)
  499.  
  500. else
  501. if(Step_1 && Step_2)
  502.  
  503. // ------- BOTH CARDINAL DIRECTIONS OF THE DIAGONAL EXIST IN THE GAME WORLD -------
  504.  
  505. var/check_1 = 0
  506. var/check_2 = 0
  507. if(step_to(D, Step_1))
  508. check_1 = 1
  509. for(var/obj/border_obstacle in Step_1)
  510. if(border_obstacle.flags & ON_BORDER)
  511. if(!border_obstacle.CheckExit(D, src))
  512. check_1 = 0
  513. // ------- YOU TRIED TO CLICK ON AN ITEM THROUGH A WINDOW (OR SIMILAR THING THAT LIMITS ON BORDERS) ON ONE OF THE DIRECITON TILES -------
  514. for(var/obj/border_obstacle in get_turf(src))
  515. if((border_obstacle.flags & ON_BORDER) && (src != border_obstacle))
  516. if(!border_obstacle.CanPass(D, D.loc, 1, 0))
  517. // ------- YOU TRIED TO CLICK ON AN ITEM THROUGH A WINDOW (OR SIMILAR THING THAT LIMITS ON BORDERS) ON THE TILE YOU'RE ON -------
  518. check_1 = 0
  519.  
  520. D.loc = usr.loc
  521. if(step_to(D, Step_2))
  522. check_2 = 1
  523.  
  524. for(var/obj/border_obstacle in Step_2)
  525. if(border_obstacle.flags & ON_BORDER)
  526. if(!border_obstacle.CheckExit(D, src))
  527. check_2 = 0
  528. for(var/obj/border_obstacle in get_turf(src))
  529. if((border_obstacle.flags & ON_BORDER) && (src != border_obstacle))
  530. if(!border_obstacle.CanPass(D, D.loc, 1, 0))
  531. check_2 = 0
  532.  
  533.  
  534. if(check_1 || check_2)
  535. ok = 1
  536. // ------- YOU CAN REACH THE ITEM THROUGH AT LEAST ONE OF THE TWO DIRECTIONS. GOOD. -------
  537.  
  538. /*
  539. More info:
  540. If you're trying to click an item in the north-east of your mob, the above section of code will first check if tehre's a tile to the north or you and to the east of you
  541. These two tiles are Step_1 and Step_2. After this, a new dummy object is created on your location. It then tries to move to Step_1, If it succeeds, objects on the turf you're on and
  542. the turf that Step_1 is are checked for items which have the ON_BORDER flag set. These are itmes which limit you on only one tile border. Windows, for the most part.
  543. CheckExit() and CanPass() are use to determine this. The dummy object is then moved back to your location and it tries to move to Step_2. Same checks are performed here.
  544. If at least one of the two checks succeeds, it means you can reach the item and ok is set to 1.
  545. */
  546. else
  547. // ------- OBJECT IS ON A CARDINAL TILE (NORTH, SOUTH, EAST OR WEST OR THE TILE YOU'RE ON) -------
  548. if(loc == usr.loc)
  549. ok = 1
  550. // ------- OBJECT IS ON THE SAME TILE AS YOU -------
  551. else
  552. ok = 1
  553.  
  554. //Now, check objects to block exit that are on the border
  555. for(var/obj/border_obstacle in usr.loc)
  556. if(border_obstacle.flags & ON_BORDER)
  557. if(!border_obstacle.CheckExit(D, src))
  558. ok = 0
  559.  
  560. //Next, check objects to block entry that are on the border
  561. for(var/obj/border_obstacle in get_turf(src))
  562. if((border_obstacle.flags & ON_BORDER) && (src != border_obstacle))
  563. if(!border_obstacle.CanPass(D, D.loc, 1, 0))
  564. ok = 0
  565. /*
  566. See the previous More info, for... more info...
  567. */
  568.  
  569. //del(D)
  570. // Garbage Collect Dummy
  571. D.loc = null
  572. D = null
  573.  
  574. // ------- DUMMY OBJECT'S SERVED IT'S PURPOSE, IT'S REWARDED WITH A SWIFT DELETE -------
  575. if (!( ok ))
  576. // ------- TESTS ABOVE DETERMINED YOU CANNOT REACH THE TILE -------
  577. return 0
  578.  
  579. if (!( usr.restrained() || (usr.lying && usr.buckled!=src) ))
  580. // ------- YOU ARE NOT REASTRAINED -------
  581.  
  582. if (W)
  583. // ------- YOU HAVE AN ITEM IN YOUR HAND - HANDLE ATTACKBY AND AFTERATTACK -------
  584. var/ignoreAA = 0 //Ignore afterattack(). Surgery uses this.
  585. if (t5)
  586. ignoreAA = src.attackby(W, usr)
  587. if (W && !ignoreAA)
  588. W.afterattack(src, usr, (t5 ? 1 : 0), params)
  589.  
  590. else
  591. // ------- YOU DO NOT HAVE AN ITEM IN YOUR HAND -------
  592. if (istype(usr, /mob/living/carbon/human))
  593. // ------- YOU ARE HUMAN -------
  594. src.attack_hand(usr, usr.hand)
  595. else
  596. // ------- YOU ARE NOT HUMAN. WHAT ARE YOU - DETERMINED HERE AND PROPER ATTACK_MOBTYPE CALLED -------
  597. if (istype(usr, /mob/living/carbon/monkey))
  598. src.attack_paw(usr, usr.hand)
  599. else if (istype(usr, /mob/living/carbon/alien/humanoid))
  600. if(usr.m_intent == "walk" && istype(usr, /mob/living/carbon/alien/humanoid/hunter))
  601. usr.m_intent = "run"
  602. usr.hud_used.move_intent.icon_state = "running"
  603. usr.update_icons()
  604. src.attack_alien(usr, usr.hand)
  605. else if (istype(usr, /mob/living/carbon/alien/larva))
  606. src.attack_larva(usr)
  607. else if (istype(usr, /mob/living/silicon/ai) || istype(usr, /mob/living/silicon/robot))
  608. src.attack_ai(usr, usr.hand)
  609. else if(istype(usr, /mob/living/carbon/slime))
  610. src.attack_slime(usr)
  611. else if(istype(usr, /mob/living/simple_animal))
  612. src.attack_animal(usr)
  613. else
  614. // ------- YOU ARE RESTRAINED. DETERMINE WHAT YOU ARE AND ATTACK WITH THE PROPER HAND_X PROC -------
  615. if (istype(usr, /mob/living/carbon/human))
  616. src.hand_h(usr, usr.hand)
  617. else if (istype(usr, /mob/living/carbon/monkey))
  618. src.hand_p(usr, usr.hand)
  619. else if (istype(usr, /mob/living/carbon/alien/humanoid))
  620. src.hand_al(usr, usr.hand)
  621. else if (istype(usr, /mob/living/silicon/ai) || istype(usr, /mob/living/silicon/robot))
  622. src.hand_a(usr, usr.hand)
  623.  
  624. else
  625. // ------- ITEM INACESSIBLE OR CLICKING ON SCREEN -------
  626. if (istype(src, /obj/screen))
  627. // ------- IT'S THE HUD YOU'RE CLICKING ON -------
  628. usr.prev_move = usr.next_move
  629. usr:lastDblClick = world.time + 2
  630. if (usr.next_move < world.time)
  631. usr.next_move = world.time + 2
  632. else
  633. return
  634.  
  635. // ------- 2 DECISECOND DELAY FOR CLICKING PASSED -------
  636.  
  637. if (!( usr.restrained() ))
  638.  
  639. // ------- YOU ARE NOT RESTRAINED -------
  640. if ((W && !( istype(src, /obj/screen) )))
  641. // ------- IT SHOULD NEVER GET TO HERE, DUE TO THE ISTYPE(SRC, /OBJ/SCREEN) FROM PREVIOUS IF-S - I TESTED IT WITH A DEBUG OUTPUT AND I COULDN'T GET THIST TO SHOW UP. -------
  642. src.attackby(W, usr)
  643. if (W)
  644. W.afterattack(src, usr,, params)
  645. else
  646. // ------- YOU ARE NOT RESTRAINED, AND ARE CLICKING A HUD OBJECT -------
  647. if (istype(usr, /mob/living/carbon/human))
  648. src.attack_hand(usr, usr.hand)
  649. else if (istype(usr, /mob/living/carbon/monkey))
  650. src.attack_paw(usr, usr.hand)
  651. else if (istype(usr, /mob/living/carbon/alien/humanoid))
  652. src.attack_alien(usr, usr.hand)
  653. else
  654. // ------- YOU ARE RESTRAINED CLICKING ON A HUD OBJECT -------
  655. if (istype(usr, /mob/living/carbon/human))
  656. src.hand_h(usr, usr.hand)
  657. else if (istype(usr, /mob/living/carbon/monkey))
  658. src.hand_p(usr, usr.hand)
  659. else if (istype(usr, /mob/living/carbon/alien/humanoid))
  660. src.hand_al(usr, usr.hand)
  661. else
  662. // ------- YOU ARE CLICKING ON AN OBJECT THAT'S INACCESSIBLE TO YOU AND IS NOT YOUR HUD -------
  663. if((LASER in usr:mutations) && usr:a_intent == "harm" && world.time >= usr.next_move)
  664. // ------- YOU HAVE THE LASER MUTATION, YOUR INTENT SET TO HURT AND IT'S BEEN MORE THAN A DECISECOND SINCE YOU LAS TATTACKED -------
  665.  
  666. var/turf/T = get_turf(usr)
  667. var/turf/U = get_turf(src)
  668.  
  669.  
  670. if(istype(usr, /mob/living/carbon/human))
  671. usr:nutrition -= rand(1,5)
  672. usr:handle_regular_hud_updates()
  673.  
  674. var/obj/item/projectile/beam/A = new /obj/item/projectile/beam( usr.loc )
  675. A.icon = 'icons/effects/genetics.dmi'
  676. A.icon_state = "eyelasers"
  677. playsound(usr.loc, 'sound/weapons/taser2.ogg', 75, 1)
  678.  
  679. A.firer = usr
  680. A.def_zone = usr:get_organ_target()
  681. A.original = src
  682. A.current = T
  683. A.yo = U.y - T.y
  684. A.xo = U.x - T.x
  685. spawn( 1 )
  686. A.process()
  687.  
  688. usr.next_move = world.time + 6
  689. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement