Advertisement
Guest User

Untitled

a guest
Oct 21st, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.70 KB | None | 0 0
  1. #define NO_SCANNER 0
  2. #define HAS_SCANNER 1
  3. #define OPEN 1
  4. #define CLOSED 0
  5. #define MEDICAL_MODE 1
  6. #define SCIENCE_MODE 2
  7.  
  8. //tricorder scanner.Doesn't actually do anything, it's just required to be able to scan.
  9. /obj/item/weapon/tricordscanner
  10. name = "tricorder scanner"
  11. desc = "A tricorder scanner. Hold a tricorder in one hand to recieve the results."
  12. icon = 'icons/star_trek.dmi'
  13. icon_state = "tricorder_scn"
  14. w_class = 1
  15.  
  16.  
  17. /obj/item/device/tricorder
  18. name = "tricorder"
  19. desc = "Utilized in the fields of repairwork, analyzing, and containing a variety of useful information."
  20. icon = 'icons/star_trek.dmi'
  21. icon_state = "tricorder"
  22. slot_flags = SLOT_BELT
  23. materials = list(MAT_METAL=55, MAT_GLASS=45)
  24. w_class = 2
  25.  
  26. var/open = 0
  27. var/setting = MEDICAL_MODE
  28. var/scannerstatus = HAS_SCANNER
  29. var/obj/item/weapon/tricordscanner/tscanner
  30.  
  31. /obj/item/device/tricorder/New()
  32. ..()
  33.  
  34. tscanner = /obj/item/weapon/tricordscanner
  35. if(open != OPEN && open != CLOSED)
  36. open = CLOSED
  37. update_icon()
  38. else
  39. update_icon()
  40.  
  41.  
  42. /obj/item/device/tricorder/update_icon()
  43.  
  44. if(open == CLOSED)
  45. overlays += "[icon_state]_closed"
  46. overlays -= "[icon_state]_open"
  47. else if(open == OPEN)
  48. overlays += "[icon_state]_open"
  49. overlays -= "[icon_state]_closed"
  50. else
  51. return
  52.  
  53.  
  54. /obj/item/device/tricorder/AltClick()
  55. toggle_open()
  56.  
  57. /obj/item/device/tricorder/proc/toggle_open(mob/user) // Open/close it for muh ARPEEEEEEE
  58. var/mob/living/carbon/human/M
  59. if(user != M)
  60. return
  61. else
  62. add_fingerprint(src)
  63. if(open == CLOSED)
  64. open = OPEN
  65. update_icon()
  66. else
  67. open = CLOSED
  68. update_icon()
  69.  
  70.  
  71. /obj/item/device/tricorder/attack_self(mob/user)
  72. if(open == CLOSED)
  73. toggle_open()
  74. else
  75. if(setting == MEDICAL_MODE)
  76. setting = SCIENCE_MODE
  77. to_chat(user, "<span class=`notice`> You enable the science analyzer.</span>")
  78. else if(setting == SCIENCE_MODE)
  79. setting = MEDICAL_MODE
  80. to_chat(user, "<span class=`notice`> You enable the medical scanner.</span>")
  81. else
  82. return
  83.  
  84. /obj/item/device/tricorder/attack_hand(mob/user) // remove scanner
  85. if(loc == user)
  86. if(open == CLOSED)
  87. ..()
  88. return
  89. if(scannerstatus == NO_SCANNER)
  90. to_chat(user, "<span class='warning'> The scanner compartment is empty!</span>")
  91. return
  92. else if(scannerstatus == HAS_SCANNER)
  93. if (ismob(loc))
  94. var/mob/M = loc
  95. M.put_in_hands(tscanner)
  96. to_chat(usr, "<span class='notice'>You remove the scanner from the [name].</span>")
  97. scannerstatus = NO_SCANNER
  98. else
  99. tscanner.loc = get_turf(src)
  100. tscanner = null
  101. ..()
  102.  
  103. /obj/item/device/tricorder/attackby(obj/item/C, mob/user, params)
  104. if(istype(C, /obj/item/weapon/tricordscanner))
  105. if(((src in user.contents) && (C in user.contents)) || (istype(loc, /turf) && in_range(src, user) && (C in user.contents)) )
  106. user.loc = locate
  107. tscanner.loc = src
  108. tscanner = /obj/item/weapon/tricordscanner
  109. to_chat(user, "<span class='notice'>You put the ID into \the [src]'s slot.</span>")
  110. scannerstatus = HAS_SCANNER
  111. return
  112. ..()
  113.  
  114. /obj/item/device/tricorder/attack(mob/living/M, mob/living/carbon/human/user)
  115. var/obj/item/weapon/tricordscanner/F
  116. if(open == CLOSED)
  117. return
  118. else if(user.get_inactive_hand(F))
  119. if(setting == MEDICAL_MODE)
  120. healthscan(user, M)
  121. chemscan(user, M)
  122. return
  123. if(setting == SCIENCE_MODE)
  124. to_chat(user, "<span class='notice'>Function currently unavailible. We apologise for the inconvenience. </span>")
  125. return
  126. else
  127. to_chat(user, "<span class=`warning`>You need to hold a tricorder scanner in your opposite hand to use this!</span>")
  128. return
  129.  
  130.  
  131.  
  132.  
  133. #undef NO_SCANNER
  134. #undef HAS_SCANNER
  135. #undef OPEN
  136. #undef CLOSED
  137. #undef MEDICAL_MODE
  138. #undef SCIENCE_MODE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement