Skip to content
This repository was archived by the owner on Apr 16, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
261 changes: 261 additions & 0 deletions code/obj/machinery/metal_scanner.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,261 @@
/obj/machinery/secscanner
name = "security scanner"
desc = "The latest innovation in invasive imagery, the programmable NT-X100 will scan anyone who walks through it with fans to simulate being patted down. <em>Nanotrasen is not to be held responsible for any deaths caused by the results the machine gives, or the machine itself.</em>"
icon = 'icons/obj/machines/scanner.dmi'
icon_state = "scanner_on"
density = 0
opacity = 0
anchored = 1
layer = 2
mats = 18
appearance_flags = TILE_BOUND
var/timeBetweenUses = 20//I can see this being fun
var/success_sound = "sound/machines/chime.ogg"
var/fail_sound = 'sound/machines/alarm_a.ogg'

var/weapon_access = access_carrypermit
var/report_scans = 1
var/check_records = 1

var/last_perp = 0
var/last_contraband = 0
//var/area/area = 0

Crossed( atom/movable/O )
if(isliving(O))
do_scan(O)
if (istype(O,/obj/item) && (!emagged))
do_scan_item(O)
return ..()
process()
.=..()
if (status & NOPOWER)
icon_state = "scanner_off"
else
icon_state = "scanner_on"

disposing()
radio_controller.remove_object(src, "1149")
..()

attackby(obj/item/W as obj, mob/user as mob) //If we get emagged...
if (istype(W, /obj/item/weapon/card/emag) && (!emagged))
src.add_fingerprint(user)
emagged++
W.show_text( "You 're-purpose' the [src].", "red" )
..()

proc/do_scan_item (var/obj/item/I)
if( icon_state != "scanner_on" )
return
src.use_power(15)
var/contraband = I.contraband

if (contraband >= 2)

playsound( src.loc, fail_sound, 10, 0 )
icon_state = "scanner_red"
src.use_power(15)

//////PDA NOTIFY/////
if (src.report_scans && (I.name != last_perp || contraband != last_contraband))
var/scan_location = get_area(src)

var/datum/radio_frequency/transmit_connection = radio_controller.return_frequency("1149")
var/datum/signal/pdaSignal = get_free_signal()
pdaSignal.data = list("address_1"="00000000", "command"="text_message", "sender_name"="SECURITY-MAILBOT", "group"="security", "sender"="00000000", "message"="Notification: An item [I.name] failed checkpoint scan at [scan_location]! Threat Level : [contraband]")
pdaSignal.transmission_method = TRANSMISSION_RADIO
if(transmit_connection != null)
transmit_connection.post_signal(src, pdaSignal)

last_perp = I.name
last_contraband = contraband

SPAWN_DBG(timeBetweenUses)
icon_state = "scanner_on"




proc/do_scan( var/mob/target )
if( icon_state != "scanner_on" )
return
src.use_power(15)
if (src.emagged) //if emagged, instead of properly doing our job as a scanner perform a completely arbitrary vibe check

if(prob(20)) //vibe check FAILED >:((((
playsound(src.loc, emag_fail_sound, 10, 1)
icon_state = "scanner_red"
target.show_text( "You feel [pick("unfortunate", "bad", "like your fate has been sealed", "anxious", "scared", "overwhelmed")].", "red" )
if (ishuman(target))
var/mob/living/carbon/human/H = target
var/perpname = H.name
src.use_power(15)
src.speak("[perpname.toUpperCase()] HAS FAILED THE VIBE CHECK! BAD VIBES! BAD VIBES!!")

//////PDA NOTIFY/////
if (src.report_scans)
var/scan_location = get_area(src)

if (ishuman(target))
var/mob/living/carbon/human/H = target
var/perpname = H.name
if (H:wear_id && H:wear_id:registered)
perpname = H.wear_id:registered

if (perpname != last_perp || contraband != last_contraband)
var/datum/radio_frequency/transmit_connection = radio_controller.return_frequency("1149")
var/datum/signal/pdaSignal = get_free_signal()
pdaSignal.data = list("address_1"="00000000", "command"="text_message", "sender_name"="SECURITY-MAILBOT", "group"="security", "sender"="00000000", "message"="NOTIFICATION: [perpname.toUpperCase()] FAILED A VIBE CHECK AT [scan_location.toUpperCase()]! BAD VIBES LEVEL : [contraband]")
pdaSignal.transmission_method = TRANSMISSION_RADIO
if(transmit_connection != null)
transmit_connection.post_signal(src, pdaSignal)

last_perp = perpname
last_contraband = contraband





else //Vibe check passed everything is good :)))
target.show_text( "You feel [pick("good", "like you dodged a bullet", "lucky", "clean", "safe", "accepted")].", "blue" )
playsound(src.loc, success_sound, 10, 1)
icon_state = "scanner_green"

SPAWN_DBG(timeBetweenUses)
icon_state = "scanner_on"

return //no, we're a vibe checker not a security device. our work is done

target.show_text( "You feel [pick("funny", "wrong", "confused", "dangerous", "sickly", "puzzled", "happy")].", "blue" )

var/contraband = assess_perp(target)
contraband = min(contraband,10)

if (contraband >= 4)
contraband = round(contraband)

playsound( src.loc, fail_sound, 10, 0 )
icon_state = "scanner_red"
src.use_power(15)

//////PDA NOTIFY/////
if (src.report_scans)
var/scan_location = get_area(src)

if (ishuman(target))
var/mob/living/carbon/human/H = target
var/perpname = H.name
if (H:wear_id && H:wear_id:registered)
perpname = H.wear_id:registered

if (perpname != last_perp || contraband != last_contraband)
var/datum/radio_frequency/transmit_connection = radio_controller.return_frequency("1149")
var/datum/signal/pdaSignal = get_free_signal()
pdaSignal.data = list("address_1"="00000000", "command"="text_message", "sender_name"="SECURITY-MAILBOT", "group"="security", "sender"="00000000", "message"="Notification: [perpname] failed checkpoint scan at [scan_location]! Threat Level : [contraband]")
pdaSignal.transmission_method = TRANSMISSION_RADIO
if(transmit_connection != null)
transmit_connection.post_signal(src, pdaSignal)

last_perp = perpname
last_contraband = contraband

else
playsound(src.loc, success_sound, 10, 1)
icon_state = "scanner_green"

SPAWN_DBG(timeBetweenUses)
icon_state = "scanner_on"

//lol, sort of copied from secbot.dm
proc/assess_perp(mob/target as mob)
var/threatcount = 0

if(src.emagged)
return rand(99,2000) //very high-end bad vibes level assessor

if (!ishuman(target))
if (istype(target, /mob/living/critter/changeling))
return 6
for( var/obj/item/item in target.contents )
threatcount += item.contraband
return threatcount

var/mob/living/carbon/human/perp = target

if (perp.mutantrace)
if (istype(perp.mutantrace, /datum/mutantrace/abomination))
threatcount += 8
else if (istype(perp.mutantrace, /datum/mutantrace/zombie))
threatcount += 6
else if (istype(perp.mutantrace, /datum/mutantrace/werewolf) || istype(perp.mutantrace, /datum/mutantrace/hunter))
threatcount += 4
else if (istype(perp.mutantrace, /datum/mutantrace/cat))
threatcount += 3
else
threatcount += 2

//if((isnull(perp:wear_id)) || (istype(perp:wear_id, /obj/item/card/id/syndicate)))
var/obj/item/card/id/perp_id = perp.equipped()
if (!istype(perp_id))
perp_id = perp.wear_id

if(perp_id && (weapon_access in perp_id.access)) //Corrupt cops cannot exist, beep boop
return 0

if (istype(perp.l_hand))
threatcount += perp.l_hand.contraband

if (istype(perp.r_hand))
threatcount += perp.r_hand.contraband

if (istype(perp:wear_suit))
threatcount += perp:wear_suit.contraband

if (istype(perp:belt))
threatcount += perp:belt.contraband * 0.5
for( var/obj/item/item in perp:belt.contents )
threatcount += item.contraband * 0.5

if (istype(perp:l_store))
threatcount += perp:l_store.contraband * 0.5

if (istype(perp:r_store))
threatcount += perp:r_store.contraband * 0.5

if (istype(perp:back))
for( var/obj/item/item in perp:back.contents )
threatcount += item.contraband * 0.5

//Agent cards lower threatlevel when normal idchecking is off.
if((istype(perp:wear_id, /obj/item/card/id/syndicate)))
threatcount -= 2

if (src.check_records)
for (var/datum/data/record/E in data_core.general)
var/perpname = perp.name
if (perp:wear_id && perp:wear_id:registered)
perpname = perp.wear_id:registered
if (E.fields["name"] == perpname)
for (var/datum/data/record/R in data_core.security)
if ((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "*Arrest*"))
threatcount = max(4,threatcount)
break
LAGCHECK(LAG_REALTIME)

return threatcount

ex_act(severity)
switch (severity)
if (1)
qdel(src)
if (2,3)
if(!prob(60 + severity*10))
qdel(src)

/obj/machinery/fakesecscanner
name = "security scanner"
desc = "The latest innovation in invasive imagery, the programmable NT-X100 will scan anyone who walks through it with fans to simulate being patted down. <em>Nanotrasen is not to be held responsible for any deaths caused by the results the machine gives, or the machine itself. ... Is this one even working properly?</em>"
icon = 'icons/obj/machines/scanner.dmi'
icon_state = "scanner_on"
Binary file added sound/machines/emag_fail_sound.ogg
Binary file not shown.