From 4a5caf968ae644bcf38f8470f3190dac2abbaa7a Mon Sep 17 00:00:00 2001 From: GunHog Date: Wed, 7 Oct 2015 13:45:51 -0500 Subject: [PATCH] Research Examines! Science Goggles and the Prototype Hardsuit Helmet may now scan items for their research potential and machines for their contents. Examine an item to gain additional data. - Tech levels - Materials that can be salvaged from it if recycled - Reliability rating - Crit failure, if present. Examine a machine to learn the components used to build it. --- code/game/machinery/machinery.dm | 18 +++++++++----- code/game/objects/items.dm | 25 ++++++++++++++++++++ code/modules/clothing/glasses/glasses.dm | 10 +++++++- code/modules/clothing/spacesuits/hardsuit.dm | 8 +++++++ code/modules/mob/mob_defines.dm | 2 ++ 5 files changed, 56 insertions(+), 7 deletions(-) diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm index c0e195c669c..e4e0907e487 100644 --- a/code/game/machinery/machinery.dm +++ b/code/game/machinery/machinery.dm @@ -385,9 +385,7 @@ Class Procs: var/obj/item/weapon/circuitboard/CB = locate(/obj/item/weapon/circuitboard) in component_parts var/P if(W.works_from_distance) - user << "Following parts detected in the machine:" - for(var/var/obj/item/C in component_parts) - user << " [C.name]" + display_parts(user) for(var/obj/item/weapon/stock_parts/A in component_parts) for(var/D in CB.req_components) if(ispath(A.type, D)) @@ -406,14 +404,22 @@ Class Procs: break RefreshParts() else - user << "Following parts detected in the machine:" - for(var/var/obj/item/C in component_parts) - user << " [C.name]" + display_parts(user) if(shouldplaysound) W.play_rped_sound() return 1 return 0 +/obj/machinery/proc/display_parts(mob/user) + user << "Following parts detected in the machine:" + for(var/var/obj/item/C in component_parts) + user << " [C.name]" + +/obj/machinery/examine(mob/user) + ..(user) + if(user.research_scanner && component_parts) + display_parts(user) + //called on machinery construction (i.e from frame to machinery) but not on initialization /obj/machinery/proc/construction() return diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 11ea07d31a9..bb207dc2d07 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -168,6 +168,31 @@ var/global/image/fire_overlay = image("icon" = 'icons/effects/fire.dmi', "icon_s user << "[pronoun] a [size] item." //e.g. They are a small item. or It is a bulky item. + if(user.research_scanner) //Mob has a research scanner active. + var/msg = "*--------*
" + + if(origin_tech) + msg += "Testing potentials:
" + var/list/techlvls = params2list(origin_tech) + for(var/T in techlvls) //This needs to use the better names. + msg += "Tech: [capitalize(T)] | magnitude: [techlvls[T]]
" + msg += "Research reliability: [reliability]%
" + if(crit_fail) + msg += "Critical failure detected in subject!
" + else + msg += "No tech origins detected.
" + + + if(materials.len) + msg += "Extractable materials:
" + for(var/mat in materials) + msg += "[capitalize(copytext(mat, 2))]
" //Capitize first word, remove the "$" + else + msg += "No extractable materials detected.
" + msg += "*--------*
" + user << msg + + /obj/item/attack_hand(mob/user) if (!user) return diff --git a/code/modules/clothing/glasses/glasses.dm b/code/modules/clothing/glasses/glasses.dm index 4c62bffe9dc..b4e82d05bd8 100644 --- a/code/modules/clothing/glasses/glasses.dm +++ b/code/modules/clothing/glasses/glasses.dm @@ -33,10 +33,18 @@ /obj/item/clothing/glasses/science name = "Science Goggles" - desc = "A pair of snazzy goggles used to protect against chemical spills." + desc = "A pair of snazzy goggles used to protect against chemical spills. Fitted with an analyzer for scanning items." icon_state = "purple" item_state = "glasses" +/obj/item/clothing/glasses/science/equipped(mob/user, slot) + user.research_scanner = 1 + ..(user, slot) + +/obj/item/clothing/glasses/science/dropped(mob/user) + user.research_scanner = initial(user.research_scanner) //Because some mobs might have it defaulted to 1. + ..(user) + /obj/item/clothing/glasses/night name = "Night Vision Goggles" desc = "You can totally see in the dark now!" diff --git a/code/modules/clothing/spacesuits/hardsuit.dm b/code/modules/clothing/spacesuits/hardsuit.dm index 7e7668c0ca4..47e6064953f 100644 --- a/code/modules/clothing/spacesuits/hardsuit.dm +++ b/code/modules/clothing/spacesuits/hardsuit.dm @@ -324,6 +324,14 @@ max_heat_protection_temperature = FIRE_SUIT_MAX_TEMP_PROTECT armor = list(melee = 10, bullet = 5, laser = 10, energy = 5, bomb = 100, bio = 100, rad = 60) +/obj/item/clothing/head/helmet/space/hardsuit/rd/equipped(mob/user, slot) + user.research_scanner = 1 + ..(user, slot) + +/obj/item/clothing/head/helmet/space/hardsuit/rd/dropped(mob/user) + user.research_scanner = 0 + ..(user) + /obj/item/clothing/suit/space/hardsuit/rd icon_state = "hardsuit-rd" name = "prototype hardsuit" diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index 7cb048e590f..a3beaa4912a 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -93,6 +93,8 @@ var/datum/hud/hud_used = null + var/research_scanner = 0 //For research scanner equipped mobs. Enable to show research data when examining. + var/list/grabbed_by = list( ) var/list/requests = list( )