/obj/item/robotanalyzer
name = "machine analyzer"
desc = "A hand-held scanner able to diagnose robotic injuries and the condition of machinery."
icon = 'icons/obj/device.dmi'
icon_state = "robotanalyzer"
inhand_icon_state = "analyzer"
flags = CONDUCT
slot_flags = ITEM_SLOT_BELT
w_class = WEIGHT_CLASS_SMALL
throw_speed = 5
throw_range = 10
origin_tech = "magnets=1;biotech=1"
/obj/item/robotanalyzer/proc/handle_clumsy(mob/living/user)
var/list/msgs = list()
user.visible_message(SPAN_WARNING("[user] has analyzed the floor's components!"), SPAN_WARNING("You try to analyze the floor's vitals!"))
msgs += SPAN_NOTICE("Analyzing Results for The floor:\n\t Overall Status: Unknown")
msgs += SPAN_NOTICE("\t Damage Specifics: [0]/[0]")
msgs += SPAN_NOTICE("Key: Burns/Brute")
msgs += SPAN_NOTICE("Chassis Temperature: ???")
to_chat(user, chat_box_healthscan(msgs.Join("
")))
/obj/item/robotanalyzer/attack_obj__legacy__attackchain(obj/machinery/M, mob/living/user) // Scanning a machine object
if(!ismachinery(M))
return
if((HAS_TRAIT(user, TRAIT_CLUMSY) || user.getBrainLoss() >= 60) && prob(50))
handle_clumsy(user)
return
user.visible_message(SPAN_NOTICE("[user] has analyzed [M]'s components with [src]."), SPAN_NOTICE("You analyze [M]'s components with [src]."))
machine_scan(user, M)
add_fingerprint(user)
/obj/item/robotanalyzer/proc/machine_scan(mob/user, obj/machinery/M)
if(M.obj_integrity == M.max_integrity)
to_chat(user, SPAN_NOTICE("[M] is at full integrity."))
return
to_chat(user, SPAN_NOTICE("Structural damage detected! [M]'s overall estimated integrity is [round((M.obj_integrity / M.max_integrity) * 100)]%."))
if(M.stat & BROKEN) // Displays alongside above message. Machines with a "broken" state do not become broken at 0% HP - anything that reaches that point is destroyed
to_chat(user, SPAN_WARNING("Further analysis: Catastrophic component failure detected! [M] requires reconstruction to fully repair."))
/obj/item/robotanalyzer/attack__legacy__attackchain(mob/living/M, mob/living/user) // Scanning borgs, IPCs/augmented crew, and AIs
if((HAS_TRAIT(user, TRAIT_CLUMSY) || user.getBrainLoss() >= 60) && prob(50))
handle_clumsy(user)
return
user.visible_message(SPAN_NOTICE("[user] has analyzed [M]'s components with [src]."), SPAN_NOTICE("You analyze [M]'s components with [src]."))
robot_healthscan(user, M)
add_fingerprint(user)
/proc/robot_healthscan(mob/user, mob/living/M)
var/scan_type
var/list/msgs = list()
if(isrobot(M))
scan_type = "robot"
else if(ishuman(M))
scan_type = "prosthetics"
else if(is_ai(M))
scan_type = "ai"
else
to_chat(user, SPAN_WARNING("You can't analyze non-robotic things!"))
return
switch(scan_type)
if("robot")
var/burn = M.getFireLoss() > 50 ? "[M.getFireLoss()]" : M.getFireLoss()
var/brute = M.getBruteLoss() > 50 ? "[M.getBruteLoss()]" : M.getBruteLoss()
msgs += SPAN_NOTICE("Analyzing Results for [M]:\n\t Overall Status: [M.stat == DEAD ? "fully disabled" : "[M.health]% functional"]")
msgs += "\t Key: Electronics/Brute"
msgs += "\t Damage Specifics: [burn] - [brute]"
if(M.timeofdeath && M.stat == DEAD)
msgs += SPAN_NOTICE("Time of disable: [station_time_timestamp("hh:mm:ss", M.timeofdeath)]")
var/mob/living/silicon/robot/H = M
var/list/damaged = H.get_damaged_components(TRUE, TRUE, TRUE) // Get all except the missing ones
var/list/missing = H.get_missing_components()
msgs += SPAN_NOTICE("Localized Damage:")
if(!LAZYLEN(damaged) && !LAZYLEN(missing))
msgs += SPAN_NOTICE("\t Components are OK.")
else
if(LAZYLEN(damaged))
for(var/datum/robot_component/org in damaged)
msgs += text("\t []: [][] - [] - [] - []", \
capitalize(org.name), \
(org.is_destroyed()) ? "DESTROYED " :"",\
(org.electronics_damage > 0) ? "[org.electronics_damage]" :0, \
(org.brute_damage > 0) ? "[org.brute_damage]" :0, \
(org.toggled) ? "Toggled ON" : "Toggled OFF",\
(org.powered) ? "Power ON" : "Power OFF")
if(LAZYLEN(missing))
for(var/datum/robot_component/org in missing)
msgs += SPAN_WARNING("\t [capitalize(org.name)]: MISSING")
if(H.emagged && prob(5))
msgs += SPAN_WARNING("\t ERROR: INTERNAL SYSTEMS COMPROMISED")
if("prosthetics")
var/mob/living/carbon/human/H = M
var/is_ipc = ismachineperson(H)
msgs += "Analyzing Results for [M]: [is_ipc ? "\n\t Overall Status: [H.stat == DEAD ? "fully disabled" : "[H.health]% functional"]