diff --git a/code/modules/modular_computers/file_system/programs/cargoship.dm b/code/modules/modular_computers/file_system/programs/cargoship.dm index 6393a5c3b1c..5ab06576074 100644 --- a/code/modules/modular_computers/file_system/programs/cargoship.dm +++ b/code/modules/modular_computers/file_system/programs/cargoship.dm @@ -9,8 +9,12 @@ program_icon = "tags" ///Account used for creating barcodes. var/datum/bank_account/payments_acc - ///The amount which the tagger will receive for the sale. - var/percent_cut = 20 + ///The person who tagged this will receive the sale value multiplied by this number. + var/cut_multiplier = 0.5 + ///Maximum value for cut_multiplier. + var/cut_max = 0.5 + ///Minimum value for cut_multiplier. + var/cut_min = 0.01 /datum/computer_file/program/shipping/ui_data(mob/user) var/list/data = get_header_data() @@ -23,7 +27,7 @@ data["paperamt"] = printer ? "[printer.stored_paper] / [printer.max_paper]" : null data["card_owner"] = card_slot?.stored_card ? id_card.registered_name : "No Card Inserted." data["current_user"] = payments_acc ? payments_acc.account_holder : null - data["barcode_split"] = percent_cut + data["barcode_split"] = cut_multiplier * 100 return data /datum/computer_file/program/shipping/ui_act(action, list/params) @@ -55,8 +59,8 @@ if("resetid") payments_acc = null if("setsplit") - var/potential_cut = input("How much would you like to payout to the registered card?","Percentage Profit") as num|null - percent_cut = potential_cut ? clamp(round(potential_cut, 1), 1, 50) : 20 + var/potential_cut = input("How much would you like to pay out to the registered card?","Percentage Profit ([round(cut_min*100)]% - [round(cut_max*100)]%)") as num|null + cut_multiplier = potential_cut ? clamp(round(potential_cut/100, cut_min), cut_min, cut_max) : initial(cut_multiplier) if("print") if(!printer) to_chat(usr, "Hardware error: A printer is required to print barcodes.") @@ -69,6 +73,6 @@ return var/obj/item/barcode/barcode = new /obj/item/barcode(get_turf(ui_host())) barcode.payments_acc = payments_acc - barcode.percent_cut = percent_cut + barcode.cut_multiplier = cut_multiplier printer.stored_paper-- to_chat(usr, "The computer prints out a barcode.") diff --git a/code/modules/recycling/sortingmachinery.dm b/code/modules/recycling/sortingmachinery.dm index edbd8998718..6420c061d16 100644 --- a/code/modules/recycling/sortingmachinery.dm +++ b/code/modules/recycling/sortingmachinery.dm @@ -106,12 +106,12 @@ user.visible_message("[user] attaches a barcode to [src].", "You attach a barcode to [src].") tagger.paper_count -= 1 sticker = new /obj/item/barcode(src) - sticker.payments_acc = tagger.payments_acc //new tag gets the tagger's current account. - sticker.percent_cut = tagger.percent_cut //same, but for the percentage taken. + sticker.payments_acc = tagger.payments_acc //new tag gets the tagger's current account. + sticker.cut_multiplier = tagger.cut_multiplier //same, but for the percentage taken. var/list/wrap_contents = src.GetAllContents() for(var/obj/I in wrap_contents) - I.AddComponent(/datum/component/pricetag, sticker.payments_acc, tagger.percent_cut) + I.AddComponent(/datum/component/pricetag, sticker.payments_acc, tagger.cut_multiplier) var/overlaystring = "[icon_state]_tag" if(giftwrapped) overlaystring = copytext(overlaystring, 5) @@ -130,7 +130,7 @@ sticker = stickerA var/list/wrap_contents = src.GetAllContents() for(var/obj/I in wrap_contents) - I.AddComponent(/datum/component/pricetag, sticker.payments_acc, sticker.percent_cut) + I.AddComponent(/datum/component/pricetag, sticker.payments_acc, sticker.cut_multiplier) var/overlaystring = "[icon_state]_tag" if(giftwrapped) overlaystring = copytext_char(overlaystring, 5) //5 == length("gift") + 1 @@ -289,12 +289,12 @@ user.visible_message("[user] attaches a barcode to [src].", "You attach a barcode to [src].") tagger.paper_count -= 1 sticker = new /obj/item/barcode(src) - sticker.payments_acc = tagger.payments_acc //new tag gets the tagger's current account. - sticker.percent_cut = tagger.percent_cut //as above, as before. + sticker.payments_acc = tagger.payments_acc //new tag gets the tagger's current account. + sticker.cut_multiplier = tagger.cut_multiplier //as above, as before. var/list/wrap_contents = src.GetAllContents() for(var/obj/I in wrap_contents) - I.AddComponent(/datum/component/pricetag, sticker.payments_acc, tagger.percent_cut) + I.AddComponent(/datum/component/pricetag, sticker.payments_acc, tagger.cut_multiplier) var/overlaystring = "[icon_state]_tag" if(giftwrapped) overlaystring = copytext(overlaystring, 5) @@ -314,7 +314,7 @@ sticker = stickerA var/list/wrap_contents = src.GetAllContents() for(var/obj/I in wrap_contents) - I.AddComponent(/datum/component/pricetag, sticker.payments_acc, sticker.percent_cut) + I.AddComponent(/datum/component/pricetag, sticker.payments_acc, sticker.cut_multiplier) var/overlaystring = "[icon_state]_tag" if(giftwrapped) overlaystring = copytext_char(overlaystring, 5) //5 == length("gift") + 1 @@ -383,7 +383,7 @@ /obj/item/sales_tagger name = "sales tagger" - desc = "A scanner that lets you tag wrapped items for sale, splitting the profit between you and cargo. Ctrl-Click to clear the registered account." + desc = "A scanner that lets you tag wrapped items for sale, splitting the profit between you and cargo." icon = 'icons/obj/device.dmi' icon_state = "salestagger" worn_icon_state = "salestagger" @@ -396,13 +396,19 @@ var/datum/bank_account/payments_acc = null var/paper_count = 10 var/max_paper_count = 20 - ///Details the percentage the scanned account receives off the final sale. - var/percent_cut = 20 + ///The person who tagged this will receive the sale value multiplied by this number. + var/cut_multiplier = 0.5 + ///Maximum value for cut_multiplier. + var/cut_max = 0.5 + ///Minimum value for cut_multiplier. + var/cut_min = 0.01 /obj/item/sales_tagger/examine(mob/user) . = ..() - . += "[src] has [paper_count]/[max_paper_count] available barcodes. Refill with paper." - . += "Profit split on sale is currently set to [percent_cut]%." + . += "[src] has [paper_count]/[max_paper_count] available barcodes. Refill with paper." + . += "Profit split on sale is currently set to [round(cut_multiplier*100)]%. Alt-click to change." + if(payments_acc) + . += "Ctrl-click to clear the registered account." /obj/item/sales_tagger/attackby(obj/item/I, mob/living/user, params) . = ..() @@ -445,8 +451,8 @@ playsound(src, 'sound/machines/click.ogg', 40, TRUE) to_chat(user, "You print a new barcode.") var/obj/item/barcode/new_barcode = new /obj/item/barcode(src) - new_barcode.payments_acc = payments_acc // The sticker gets the scanner's registered account. - new_barcode.percent_cut = percent_cut // Also the registered percent cut. + new_barcode.payments_acc = payments_acc // The sticker gets the scanner's registered account. + new_barcode.cut_multiplier = cut_multiplier // Also the registered percent cut. user.put_in_hands(new_barcode) /obj/item/sales_tagger/CtrlClick(mob/user) @@ -456,18 +462,18 @@ /obj/item/sales_tagger/AltClick(mob/user) . = ..() - var/potential_cut = input("How much would you like to payout to the registered card?","Percentage Profit") as num|null + var/potential_cut = input("How much would you like to pay out to the registered card?","Percentage Profit ([round(cut_min*100)]% - [round(cut_max*100)]%)") as num|null if(!potential_cut) - percent_cut = 50 - percent_cut = clamp(round(potential_cut, 1), 1, 50) - to_chat(user, "[percent_cut]% profit will be received if a package with a barcode is sold.") + cut_multiplier = initial(cut_multiplier) + cut_multiplier = clamp(round(potential_cut/100, cut_min), cut_min, cut_max) + to_chat(user, "[round(cut_multiplier*100)]% profit will be received if a package with a barcode is sold.") /obj/item/barcode - name = "Barcode tag" + name = "barcode tag" desc = "A tiny tag, associated with a crewmember's account. Attach to a wrapped item to give that account a portion of the wrapped item's profit." icon = 'icons/obj/bureaucracy.dmi' icon_state = "barcode" w_class = WEIGHT_CLASS_TINY ///All values inheirited from the sales tagger it came from. var/datum/bank_account/payments_acc = null - var/percent_cut = 5 + var/cut_multiplier = 0.5