# Forensics Config

## Forensics Evidence System

### Overview

The forensics system lets law enforcement collect scene evidence, store it in an evidence locker, analyze it in the lab, and attach the results to incident reports.

It is designed around this flow:

1. Evidence is created in the world.
2. Officers collect the evidence into an evidence bag.
3. Officers deposit the evidence bag at the evidence locker.
4. Authorized lab officers analyze stored evidence.
5. Analyzed evidence can be linked to police reports.

### Evidence Types

The system supports these evidence types:

* `shell_casing`
* `blood_dna`
* `fingerprint`
* `weapon`
* `vehicle`
* `photo`
* `bodycam`

By default, shell casings and blood DNA can be created automatically. Fingerprint evidence is not automatically generated unless another script calls the fingerprint export.

### Configuration

Main settings are located in:

```lua
modules/forensics/config.lua
```

Important options:

```lua
ForensicsConfig.Enabled = true
ForensicsConfig.EvidenceBagItem = "evidence_bag"
ForensicsConfig.ForensicScannerItem = "forensic_scanner"
ForensicsConfig.RequireForensicScannerItem = false
ForensicsConfig.AutoCreateShellCasings = true
ForensicsConfig.AutoCreateBloodEvidence = true
ForensicsConfig.AutoCreateFingerprints = false
ForensicsConfig.LabMinGrade = 2
```

#### Jobs

Only configured law enforcement jobs can use the evidence system:

```lua
AllowedJobs = { "police", "sheriff", "state", "doj", "trooper", "lspd", "bcso" }
```

Lab analysis uses `LabAllowedJobs` if set. If `LabAllowedJobs` is `nil`, it uses the same jobs as `AllowedJobs`.

### Evidence Locker

Collected evidence must be deposited at an evidence locker before it can be analyzed.

Current locker location:

```lua
LockerZones = {
    { label = "Evidence locker", coords = vector3(441.6005, -996.0329, 30.6896), radius = 2.5 },
}
```

When an officer is near this location, they will see:

```
[E] Store evidence in locker
```

Pressing `E` opens the locker menu and lists collected evidence bags that can be stored.

Requirements:

* The player must have an allowed police job.
* The evidence must already be collected.
* The player must be inside the locker zone.
* If `LockerStoreRequiresBag = true`, the player must have the matching `evidence_bag`.

### Forensics Lab

Stored evidence is analyzed from the Police App inside the tablet.

Current lab location:

```lua
LabZones = {
    { label = "Forensics lab", coords = vector3(437.1269, -996.2137, 30.6896), radius = 2.5 },
}
```

To analyze evidence:

1. Open the tablet.
2. Open the Police App.
3. Go to the Forensics Lab tab.
4. Select stored evidence.
5. Run lab analysis.

Requirements:

* The evidence status must be `stored`.
* The officer must be inside the lab zone.
* The officer must have an allowed lab job.
* The officer grade must be at least `LabMinGrade`.

Default required grade:

```lua
LabMinGrade = 2
```

### Collecting Evidence

Officers can collect nearby evidence in the world.

Default collection distance:

```lua
EvidenceCollectionDistance = 2.2
```

Default scanner distance:

```lua
ScannerDistance = 35.0
```

If the scanner is enabled, nearby evidence is shown with markers. When close enough, press `E` to collect it.

Collected evidence is placed into an evidence bag:

```lua
EvidenceBagItem = "evidence_bag"
```

The inventory item should exist in your inventory system and support metadata such as:

* `evidence_id`
* `evidence_type`
* `label`

### Shell Casings

Shell casing evidence can be created automatically when a player fires a valid weapon.

Relevant settings:

```lua
AutoCreateShellCasings = true
ShellCasingCooldownMs = 2200
ShellStreetPickupEnabled = true
ShellStreetPickupProgressMs = 4500
ShellStreetPickupSkipsScannerItem = true
```

Shell casings can be collected from the street by authorized officers.

During lab analysis, shell casings can match by:

* weapon serial
* ballistic hash

### Blood DNA

Blood DNA evidence can be created automatically when a player takes damage, depending on chance and cooldown.

Relevant settings:

```lua
AutoCreateBloodEvidence = true
BloodEvidenceCooldownMs = 9000
BloodEvidenceChance = 0.28
```

During lab analysis, blood DNA is matched against the forensic profile database.

### Fingerprints

Fingerprint evidence is supported, but automatic fingerprint creation is disabled by default:

```lua
AutoCreateFingerprints = false
```

Fingerprints can be created by another script using the export:

```lua
exports['0r-smarttab']:CreateFingerprintEvidence(coords, surfaceType, metadata)
```

Example:

```lua
local coords = GetEntityCoords(PlayerPedId())

exports['0r-smarttab']:CreateFingerprintEvidence(coords, "vehicle_door", {
    fingerprint_hash = "example_hash",
    owner_citizenid = "ABC12345",
    owner_name = "John Doe"
})
```

After a fingerprint is created, officers collect and store it like any other evidence.

During lab analysis, fingerprint evidence is matched against `fingerprint_hash` in the forensic profile database.

### Tablet Police App

The Police App uses the forensics system in two places:

#### Forensics Lab

Used to view stored evidence and run analysis.

Path:

```
Police App -> Forensics Lab
```

#### Incident Reports

Used to attach stored or collected evidence to a report.

Path:

```
Police App -> Incident Report -> Forensic Evidence
```

Officers can browse the evidence locker and link relevant evidence to the report.

### Evidence Status Flow

Evidence moves through these states:

```
created/uncollected -> collected -> stored -> analyzed/linked
```

Meaning:

* `created` / `uncollected`: Evidence exists in the world.
* `collected`: Officer collected it into an evidence bag.
* `stored`: Evidence was deposited at the locker.
* analyzed result: Lab analysis generated match data.
* linked: Evidence was attached to an incident report or case.

### Troubleshooting

#### No evidence appears near the officer

Check:

* `ForensicsConfig.Enabled`
* player job is in `AllowedJobs`
* scanner state and scanner distance
* evidence has not expired
* database tables were created

#### Cannot store evidence

Check:

* player is inside `LockerZones`
* evidence status is `collected`
* player has the correct `evidence_bag`
* `LockerStoreRequiresBag`

#### Cannot analyze evidence

Check:

* player is inside `LabZones`
* evidence status is `stored`
* player job is allowed
* player grade is at least `LabMinGrade`

#### Fingerprints do not appear

This is expected unless another script creates fingerprint evidence. Use:

```lua
exports['0r-smarttab']:CreateFingerprintEvidence(coords, surfaceType, metadata)
```

### Recommended Setup Checklist

* Add `evidence_bag` to your inventory items.
* Add `forensic_scanner` if `RequireForensicScannerItem = true`.
* Adjust `LockerZones` and `LabZones` for your police station MLO.
* Confirm police job names in `AllowedJobs`.
* Set `LabMinGrade` to match your department ranks.
* Add fingerprint export calls from your vehicle, burglary, robbery, or interaction scripts if fingerprint evidence is needed.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.0resmon.org/0resmon/0r-resources/0r-smarttab/forensics-config.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
