Custom Evidence Integration
Kartik Evidence is designed to be highly extensible. You can add entirely new forensic modules (e.g., shoe prints, plant fibers) without modifying the core files by using the built-in API.
1. Registering a New Evidence Type (Shared)
To create a new type of evidence, call RegisterEvidenceType on both the client and server (or in a shared script).
exports['kartik-evidence']:RegisterEvidenceType('rare_soil', {
label = "Rare Soil Sample",
icon = "fa-solid fa-mountain",
washable = true,
collection = {
kitRequired = "swab_kit",
actionLabel = "Collect Soil",
animation = Config.Animations['swab_sample'],
rewardItem = "evidence_soil",
consumeKit = true,
generateData = function(evidenceData)
return {
_location = evidenceData.collectedAtCoords,
information = {
{ key = "Type", value = "Rare Soil" },
{ key = "Origin", value = "Sandy Shores" }
}
}
end
},
visuals = {
marker = 2,
color = { r = 139, g = 69, b = 19, a = 150 }
}
})2. Adding to Lab Machines (Client)
Tell the forensic machines to recognize your new collection item.
exports['kartik-evidence']:RegisterMachineOption('Centrifuge', {
label = "Process Soil Sample",
icon = "fa-solid fa-microscope",
itemName = "evidence_soil",
time = 5000,
progressLabel = "Analyzing Soil Composition..."
})3. Handling the Logic (Server)
Define what the machine actually produces when it finishes processing.
exports['kartik-evidence']:RegisterProcessingHandler('evidence_soil', 'Centrifuge', function(source, slot, itemData)
if exports['kartik-evidence']:RemoveItem(source, 'evidence_soil', 1, nil, slot) then
local reportMetadata = {
information = {
{ key = "Result", value = "Trace Minerals: High Concentration" }
}
}
exports['kartik-evidence']:GiveItem(source, 'soil_report', 1, reportMetadata)
return true
end
return false
end)💡 Why use the API?
- No Conflicts: Your changes persist even if the core script is updated.
- Modularity: You can ship custom evidence types as separate scripts.
- Smart Search: The Forensic Tablet will automatically pick up and index your custom items if they have internal keys (starting with
_).