mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-15 04:01:41 +00:00
* Refactors pricetag component: no getcomponent, no ugly signals, fixes cubes a bit (#63954) Refactors the pricetag component Removes a getcomponent for the pricetag component in cube export handling (replaced with inherit component behavior) Removes some nasty signals which were effectively just send signal, get 1 Deletes the internal radio within bounty cubes from before exporting Disallows bounty cubes from being barcoded with TRAIT_NO_BARCODES Prevents bounty cube pricetag component from being deleted by unwrapping Closes #63921 technically * Refactors pricetag component: no getcomponent, no ugly signals, fixes cubes a bit Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
51 lines
2.1 KiB
Plaintext
51 lines
2.1 KiB
Plaintext
/obj/item/export_scanner
|
|
name = "export scanner"
|
|
desc = "A device used to check objects against Nanotrasen exports database."
|
|
icon = 'icons/obj/device.dmi'
|
|
icon_state = "export_scanner"
|
|
inhand_icon_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
|
|
|
|
/obj/item/export_scanner/afterattack(obj/O, mob/user, proximity)
|
|
. = ..()
|
|
if(!istype(O) || !proximity)
|
|
return
|
|
|
|
// Before you fix it:
|
|
// yes, checking manifests is a part of intended functionality.
|
|
var/datum/export_report/ex = export_item_and_contents(O, dry_run=TRUE)
|
|
var/price = 0
|
|
for(var/x in ex.total_amount)
|
|
price += ex.total_value[x]
|
|
if(price)
|
|
to_chat(user, span_notice("Scanned [O], value: <b>[price]</b> credits[O.contents.len ? " (contents included)" : ""]."))
|
|
else
|
|
to_chat(user, span_warning("Scanned [O], no export value."))
|
|
|
|
if(ishuman(user))
|
|
var/mob/living/carbon/human/scan_human = user
|
|
if(istype(O, /obj/item/bounty_cube))
|
|
var/obj/item/bounty_cube/cube = O
|
|
var/datum/bank_account/scanner_account = scan_human.get_bank_account()
|
|
|
|
if(!istype(get_area(cube), /area/shuttle/supply))
|
|
to_chat(user, span_warning("Shuttle placement not detected. Handling tip not registered."))
|
|
|
|
else if(cube.bounty_handler_account)
|
|
to_chat(user, span_warning("Bank account for handling tip already registered!"))
|
|
|
|
else if(scanner_account)
|
|
cube.AddComponent(/datum/component/pricetag, scanner_account, cube.handler_tip, FALSE)
|
|
|
|
cube.bounty_handler_account = scanner_account
|
|
cube.bounty_handler_account.bank_card_talk("Bank account for [price ? "<b>[price * cube.handler_tip]</b> credit " : ""]handling tip successfully registered.")
|
|
|
|
if(cube.bounty_holder_account != cube.bounty_handler_account) //No need to send a tracking update to the person scanning it
|
|
cube.bounty_holder_account.bank_card_talk("<b>[cube]</b> was scanned in \the <b>[get_area(cube)]</b> by <b>[scan_human] ([scan_human.job])</b>.")
|
|
|
|
else
|
|
to_chat(user, span_warning("Bank account not detected. Handling tip not registered."))
|