|
195 | 195 | */
|
196 | 196 | /atom/proc/transfer_gunshot_residue_to(atom/transfer_to)
|
197 | 197 | transfer_to.add_gunshot_residue(return_gunshot_residue())
|
| 198 | + |
| 199 | +/// On examine, players have a chance to find forensic evidence. This can only happen once per object. |
| 200 | +/mob/living/carbon/human/proc/forensic_analysis_roll(atom/examined) |
| 201 | + if(!stats.cooldown_finished("examine_forensic_analysis")) |
| 202 | + return |
| 203 | + |
| 204 | + // Already gotten the good rng on this one |
| 205 | + if(stats.examined_object_weakrefs[WEAKREF(examined)]) |
| 206 | + return |
| 207 | + |
| 208 | + if(examined.return_blood_DNA()) |
| 209 | + return // This is kind of obvious |
| 210 | + |
| 211 | + var/list/fingerprints = examined.return_fingerprints()?.Copy() |
| 212 | + var/list/trace_dna = examined.return_trace_DNA()?.Copy() |
| 213 | + var/list/residue = examined.return_gunshot_residue() |
| 214 | + |
| 215 | + // Exclude our own prints |
| 216 | + if(length(fingerprints)) |
| 217 | + var/obj/item/bodypart/arm/left_arm = get_bodypart(BODY_ZONE_L_ARM) |
| 218 | + var/obj/item/bodypart/arm/right_arm = get_bodypart(BODY_ZONE_R_ARM) |
| 219 | + |
| 220 | + if(left_arm) |
| 221 | + fingerprints -= get_fingerprints(TRUE, left_arm) |
| 222 | + if(right_arm) |
| 223 | + fingerprints -= get_fingerprints(TRUE, right_arm) |
| 224 | + |
| 225 | + // Exclude our DNA |
| 226 | + if(length(trace_dna)) |
| 227 | + trace_dna -= get_trace_dna() |
| 228 | + |
| 229 | + // Do nothing if theres no evidence. |
| 230 | + if(!(length(fingerprints) || length(trace_dna) || length(residue))) |
| 231 | + return |
| 232 | + |
| 233 | + var/datum/roll_result/result = stat_roll(16, /datum/rpg_skill/forensics) |
| 234 | + |
| 235 | + switch(result.outcome) |
| 236 | + if(FAILURE, CRIT_FAILURE) |
| 237 | + stats.set_cooldown("examine_forensic_analysis", 15 SECONDS) |
| 238 | + return |
| 239 | + |
| 240 | + stats.examined_object_weakrefs[WEAKREF(examined)] = TRUE |
| 241 | + stats.set_cooldown("examine_forensic_analysis", 15 MINUTES) |
| 242 | + |
| 243 | + // Spawn 0 so this displays *after* the examine block. |
| 244 | + spawn(0) |
| 245 | + if(length(residue)) |
| 246 | + to_chat(src, result.create_tooltip("A remnant of past events flashes into your mind, the booming crack of a firearm.")) |
| 247 | + |
| 248 | + else if(length(fingerprints) || length(trace_dna)) |
| 249 | + var/text = isitem(examined) ? "someone else has held this item in the past" : "someone else has been here before" |
| 250 | + to_chat(src, result.create_tooltip("Perhaps it is a stray particle of dust, or a smudge on the surface. Whatever it may be, you are certain [text].")) |
| 251 | + |
0 commit comments