Files
Bubberstation/code/modules/cargo/export_scanner.dm
vuonojenmustaturska 8ddc9677c7 examine-code refactor (#44636)
* 1/4 done? maybe?

* more

* stuff

* incremental stuff

* stuff

* stuff & things

* mostly done but not yet

* stuffing

* stuffing 2: electric boogaloo

* Git Commit and the Kingdom of the Crystal Skull

* make it actually compile

* found more stuff

* fixes

* fix AI laws appearing out of order

* fix windows

* should be the remaining stuff

* this time for real

* i guess it should compile too

* fix sechuds
2019-06-19 22:07:57 +02:00

46 lines
1.7 KiB
Plaintext

/obj/item/export_scanner
name = "export scanner"
desc = "A device used to check objects against Nanotrasen exports and bounty database."
icon = 'icons/obj/device.dmi'
icon_state = "export_scanner"
item_state = "radio"
lefthand_file = 'icons/mob/inhands/misc/devices_lefthand.dmi'
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
item_flags = NOBLUDGEON
w_class = WEIGHT_CLASS_SMALL
siemens_coefficient = 1
var/obj/machinery/computer/cargo/cargo_console = null
/obj/item/export_scanner/examine(user)
. = ..()
if(!cargo_console)
. += "<span class='notice'>[src] is not currently linked to a cargo console.</span>"
/obj/item/export_scanner/afterattack(obj/O, mob/user, proximity)
. = ..()
if(!istype(O) || !proximity)
return
if(istype(O, /obj/machinery/computer/cargo))
var/obj/machinery/computer/cargo/C = O
if(!C.requestonly)
cargo_console = C
to_chat(user, "<span class='notice'>Scanner linked to [C].</span>")
else if(!istype(cargo_console))
to_chat(user, "<span class='warning'>You must link [src] to a cargo console first!</span>")
else
// Before you fix it:
// yes, checking manifests is a part of intended functionality.
var/datum/export_report/ex = export_item_and_contents(O, cargo_console.get_export_categories(), dry_run=TRUE)
var/price = 0
for(var/x in ex.total_amount)
price += ex.total_value[x]
if(price)
to_chat(user, "<span class='notice'>Scanned [O], value: <b>[price]</b> credits[O.contents.len ? " (contents included)" : ""].</span>")
else
to_chat(user, "<span class='warning'>Scanned [O], no export value.</span>")
if(bounty_ship_item_and_contents(O, dry_run=TRUE))
to_chat(user, "<span class='notice'>Scanned item is eligible for one or more bounties.</span>")