Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define NO_SCANNER 0
- #define HAS_SCANNER 1
- #define OPEN 1
- #define CLOSED 0
- #define MEDICAL_MODE 1
- #define SCIENCE_MODE 2
- //tricorder scanner.Doesn't actually do anything, it's just required to be able to scan.
- /obj/item/weapon/tricordscanner
- name = "tricorder scanner"
- desc = "A tricorder scanner. Hold a tricorder in one hand to recieve the results."
- icon = 'icons/star_trek.dmi'
- icon_state = "tricorder_scn"
- w_class = 1
- /obj/item/device/tricorder
- name = "tricorder"
- desc = "Utilized in the fields of repairwork, analyzing, and containing a variety of useful information."
- icon = 'icons/star_trek.dmi'
- icon_state = "tricorder"
- slot_flags = SLOT_BELT
- materials = list(MAT_METAL=55, MAT_GLASS=45)
- w_class = 2
- var/open = 0
- var/setting = MEDICAL_MODE
- var/scannerstatus = HAS_SCANNER
- var/obj/item/weapon/tricordscanner/tscanner
- /obj/item/device/tricorder/New()
- ..()
- tscanner = /obj/item/weapon/tricordscanner
- if(open != OPEN && open != CLOSED)
- open = CLOSED
- update_icon()
- else
- update_icon()
- /obj/item/device/tricorder/update_icon()
- if(open == CLOSED)
- overlays += "[icon_state]_closed"
- overlays -= "[icon_state]_open"
- else if(open == OPEN)
- overlays += "[icon_state]_open"
- overlays -= "[icon_state]_closed"
- else
- return
- /obj/item/device/tricorder/AltClick()
- toggle_open()
- /obj/item/device/tricorder/proc/toggle_open(mob/user) // Open/close it for muh ARPEEEEEEE
- var/mob/living/carbon/human/M
- if(user != M)
- return
- else
- add_fingerprint(src)
- if(open == CLOSED)
- open = OPEN
- update_icon()
- else
- open = CLOSED
- update_icon()
- /obj/item/device/tricorder/attack_self(mob/user)
- if(open == CLOSED)
- toggle_open()
- else
- if(setting == MEDICAL_MODE)
- setting = SCIENCE_MODE
- to_chat(user, "<span class=`notice`> You enable the science analyzer.</span>")
- else if(setting == SCIENCE_MODE)
- setting = MEDICAL_MODE
- to_chat(user, "<span class=`notice`> You enable the medical scanner.</span>")
- else
- return
- /obj/item/device/tricorder/attack_hand(mob/user) // remove scanner
- if(loc == user)
- if(open == CLOSED)
- ..()
- return
- if(scannerstatus == NO_SCANNER)
- to_chat(user, "<span class='warning'> The scanner compartment is empty!</span>")
- return
- else if(scannerstatus == HAS_SCANNER)
- if (ismob(loc))
- var/mob/M = loc
- M.put_in_hands(tscanner)
- to_chat(usr, "<span class='notice'>You remove the scanner from the [name].</span>")
- scannerstatus = NO_SCANNER
- else
- tscanner.loc = get_turf(src)
- tscanner = null
- ..()
- /obj/item/device/tricorder/attackby(obj/item/C, mob/user, params)
- if(istype(C, /obj/item/weapon/tricordscanner))
- if(((src in user.contents) && (C in user.contents)) || (istype(loc, /turf) && in_range(src, user) && (C in user.contents)) )
- user.loc = locate
- tscanner.loc = src
- tscanner = /obj/item/weapon/tricordscanner
- to_chat(user, "<span class='notice'>You put the ID into \the [src]'s slot.</span>")
- scannerstatus = HAS_SCANNER
- return
- ..()
- /obj/item/device/tricorder/attack(mob/living/M, mob/living/carbon/human/user)
- var/obj/item/weapon/tricordscanner/F
- if(open == CLOSED)
- return
- else if(user.get_inactive_hand(F))
- if(setting == MEDICAL_MODE)
- healthscan(user, M)
- chemscan(user, M)
- return
- if(setting == SCIENCE_MODE)
- to_chat(user, "<span class='notice'>Function currently unavailible. We apologise for the inconvenience. </span>")
- return
- else
- to_chat(user, "<span class=`warning`>You need to hold a tricorder scanner in your opposite hand to use this!</span>")
- return
- #undef NO_SCANNER
- #undef HAS_SCANNER
- #undef OPEN
- #undef CLOSED
- #undef MEDICAL_MODE
- #undef SCIENCE_MODE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement