[READY]Arconomy: Sales Taggers, split profits on barcoded, sold items! (#49111)
* Startwork * "Arcane: Everything works up until the export datum bullshit" * I got up to "Split Profit" in "sell object" * This is when I switched over to components and it STILL doesn't work * alright stopwork for the 'night' * So this is the version that crashes * One step further in my descent to madness. * Alright, this should be working (Minus maybe profit_split) * Alright splitting up custom sales splits is broken right now. * Profit split works now. * Alright what the hell is going on here. * Revert "Alright what the hell is going on here." This reverts commit 6cb3b6eb56ea45ede3496bbe219ca18302c806e2. * Oh wait, I can do commit messages through VSC? * Adds a quick little box with all the shipping supplies you'll ever want, unwrapping signal * Added shipping box to all maps and the service/cargo lathes. * Fuck you mapmerge hook you ain't shit * Alright, yet another take of making it get rid of the pricetag * [3:43 PM] oranges: anturk is smart (This is true) * Tested, cleaned up component procs, and limits signals sent a bit. * Whoops * Other comments from Ninja over discord * Left in a comment line. * Fixes the issue with ind. barcodes, adds examine. * Well thank GOD the children wern't there to see it * Adds a do_after to prevent accidents. * Fixes merge conflicts * Fixes merge conflict. Twice in one day. * Fixes merge conflict. * one tiny bit of documentation * Travis play nice.
@@ -17896,6 +17896,7 @@
|
||||
"aTE" = (
|
||||
/obj/structure/table,
|
||||
/obj/item/hand_labeler,
|
||||
/obj/item/storage/box/shipping,
|
||||
/turf/open/floor/plasteel,
|
||||
/area/storage/art)
|
||||
"aTF" = (
|
||||
@@ -23887,6 +23888,9 @@
|
||||
/obj/structure/table,
|
||||
/obj/item/clothing/head/soft,
|
||||
/obj/item/clothing/head/soft,
|
||||
/obj/item/storage/box/shipping{
|
||||
pixel_x = 6
|
||||
},
|
||||
/turf/open/floor/plasteel,
|
||||
/area/quartermaster/storage)
|
||||
"bjo" = (
|
||||
|
||||
@@ -19841,11 +19841,14 @@
|
||||
"aQC" = (
|
||||
/obj/structure/table,
|
||||
/obj/item/folder/yellow,
|
||||
/obj/item/destTagger,
|
||||
/obj/effect/turf_decal/tile/brown,
|
||||
/obj/effect/turf_decal/tile/brown{
|
||||
dir = 8
|
||||
},
|
||||
/obj/item/storage/box/shipping{
|
||||
pixel_x = 4;
|
||||
pixel_z = 4
|
||||
},
|
||||
/turf/open/floor/plasteel,
|
||||
/area/quartermaster/sorting)
|
||||
"aQD" = (
|
||||
@@ -44500,6 +44503,7 @@
|
||||
pixel_x = -32
|
||||
},
|
||||
/obj/effect/turf_decal/bot,
|
||||
/obj/item/storage/box/shipping,
|
||||
/turf/open/floor/plasteel,
|
||||
/area/storage/primary)
|
||||
"bGH" = (
|
||||
|
||||
@@ -5174,6 +5174,7 @@
|
||||
/area/security/warden)
|
||||
"aod" = (
|
||||
/obj/structure/table,
|
||||
/obj/item/storage/box/shipping,
|
||||
/turf/open/floor/plating,
|
||||
/area/storage/tech)
|
||||
"aoe" = (
|
||||
@@ -29713,7 +29714,6 @@
|
||||
/obj/structure/table,
|
||||
/obj/item/hand_labeler,
|
||||
/obj/item/stack/packageWrap,
|
||||
/obj/item/destTagger,
|
||||
/obj/item/destTagger{
|
||||
pixel_x = 2;
|
||||
pixel_y = 2
|
||||
@@ -29721,6 +29721,7 @@
|
||||
/obj/item/radio/intercom{
|
||||
pixel_x = 30
|
||||
},
|
||||
/obj/item/storage/box/shipping,
|
||||
/turf/open/floor/plasteel,
|
||||
/area/quartermaster/office)
|
||||
"bAQ" = (
|
||||
@@ -47396,7 +47397,6 @@
|
||||
/obj/structure/table,
|
||||
/obj/item/storage/box,
|
||||
/obj/item/storage/box,
|
||||
/obj/item/storage/box,
|
||||
/obj/item/stack/wrapping_paper,
|
||||
/obj/item/stack/wrapping_paper,
|
||||
/obj/item/stack/wrapping_paper,
|
||||
@@ -47404,6 +47404,7 @@
|
||||
/obj/effect/turf_decal/tile/brown{
|
||||
dir = 4
|
||||
},
|
||||
/obj/item/storage/box/shipping,
|
||||
/turf/open/floor/plasteel,
|
||||
/area/storage/tools)
|
||||
"qxm" = (
|
||||
|
||||
@@ -22713,6 +22713,10 @@
|
||||
},
|
||||
/obj/item/stack/packageWrap,
|
||||
/obj/item/hand_labeler,
|
||||
/obj/item/storage/box/shipping{
|
||||
pixel_x = -4;
|
||||
pixel_y = -4
|
||||
},
|
||||
/turf/open/floor/plasteel/dark,
|
||||
/area/storage/primary)
|
||||
"aKb" = (
|
||||
@@ -42745,6 +42749,7 @@
|
||||
/obj/effect/turf_decal/tile/neutral{
|
||||
dir = 8
|
||||
},
|
||||
/obj/item/storage/box/shipping,
|
||||
/turf/open/floor/plasteel/dark,
|
||||
/area/quartermaster/storage)
|
||||
"bmv" = (
|
||||
|
||||
@@ -27534,16 +27534,13 @@
|
||||
/area/quartermaster/sorting)
|
||||
"biJ" = (
|
||||
/obj/structure/table,
|
||||
/obj/item/destTagger{
|
||||
pixel_x = 4;
|
||||
pixel_y = 3
|
||||
},
|
||||
/obj/machinery/light_switch{
|
||||
pixel_x = 27
|
||||
},
|
||||
/obj/effect/turf_decal/tile/blue{
|
||||
dir = 4
|
||||
},
|
||||
/obj/item/storage/box/shipping,
|
||||
/turf/open/floor/plasteel/white/corner,
|
||||
/area/quartermaster/sorting)
|
||||
"biK" = (
|
||||
@@ -68926,6 +68923,7 @@
|
||||
dir = 8
|
||||
},
|
||||
/obj/structure/cable,
|
||||
/obj/item/storage/box/shipping,
|
||||
/turf/open/floor/plasteel,
|
||||
/area/storage/primary)
|
||||
"dhM" = (
|
||||
|
||||
@@ -12670,6 +12670,7 @@
|
||||
/obj/effect/turf_decal/tile/neutral{
|
||||
dir = 8
|
||||
},
|
||||
/obj/item/storage/box/shipping,
|
||||
/turf/open/floor/plasteel,
|
||||
/area/storage/primary)
|
||||
"aGi" = (
|
||||
@@ -15281,10 +15282,10 @@
|
||||
/area/quartermaster/sorting)
|
||||
"aNK" = (
|
||||
/obj/structure/table,
|
||||
/obj/item/destTagger,
|
||||
/obj/effect/turf_decal/stripes/line{
|
||||
dir = 1
|
||||
},
|
||||
/obj/item/storage/box/shipping,
|
||||
/turf/open/floor/plasteel,
|
||||
/area/quartermaster/sorting)
|
||||
"aNL" = (
|
||||
|
||||
@@ -1111,6 +1111,7 @@
|
||||
/obj/structure/table,
|
||||
/obj/machinery/light,
|
||||
/obj/item/storage/firstaid/regular,
|
||||
/obj/item/healthanalyzer/advanced,
|
||||
/turf/open/floor/plasteel,
|
||||
/area/storage/primary)
|
||||
"dP" = (
|
||||
@@ -2242,6 +2243,11 @@
|
||||
/obj/structure/cable,
|
||||
/turf/open/floor/plating/airless,
|
||||
/area/space/nearstation)
|
||||
"sH" = (
|
||||
/obj/structure/table,
|
||||
/obj/item/storage/box/shipping,
|
||||
/turf/open/floor/plasteel,
|
||||
/area/storage/primary)
|
||||
"tG" = (
|
||||
/obj/docking_port/stationary/random{
|
||||
id = "pod_lavaland1";
|
||||
@@ -7852,7 +7858,7 @@ dJ
|
||||
dJ
|
||||
dJ
|
||||
dJ
|
||||
dN
|
||||
sH
|
||||
cS
|
||||
fU
|
||||
gb
|
||||
|
||||
@@ -269,6 +269,12 @@
|
||||
#define COMSIG_ITEM_WEARERCROSSED "wearer_crossed" //called on item when crossed by something (): (/atom/movable, mob/living/crossed)
|
||||
#define COMSIG_ITEM_MICROWAVE_ACT "microwave_act" //called on item when microwaved (): (obj/machinery/microwave/M)
|
||||
|
||||
// /obj/item signals for economy
|
||||
#define COMSIG_ITEM_SOLD "item_sold" //called when an item is sold by the exports subsystem
|
||||
#define COMSIG_STRUCTURE_UNWRAPPED "structure_unwrapped" //called when a wrapped up structure is opened by hand
|
||||
#define COMSIG_ITEM_UNWRAPPED "item_unwrapped" //called when a wrapped up item is opened by hand
|
||||
#define COMSIG_ITEM_SPLIT_VALUE 1
|
||||
#define COMSIG_ITEM_SPLIT_PROFIT "item_split_profits" //Called when getting the item's exact ratio for cargo's profit.
|
||||
|
||||
// /obj/item/clothing signals
|
||||
#define COMSIG_SHOES_STEP_ACTION "shoes_step_action" //from base of obj/item/clothing/shoes/proc/step_action(): ()
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
/datum/component/pricetag
|
||||
var/datum/bank_account/owner
|
||||
var/profit_ratio = 1
|
||||
|
||||
/datum/component/pricetag/Initialize(_owner,_profit_ratio)
|
||||
if(!isobj(parent)) //Has to account for both objects and sellable structures like crates.
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
owner = _owner
|
||||
if(_profit_ratio)
|
||||
profit_ratio = _profit_ratio
|
||||
RegisterSignal(parent, COMSIG_ITEM_SOLD, .proc/split_profit)
|
||||
RegisterSignal(parent, COMSIG_STRUCTURE_UNWRAPPED, .proc/Unwrapped)
|
||||
RegisterSignal(parent, COMSIG_ITEM_UNWRAPPED, .proc/Unwrapped)
|
||||
RegisterSignal(parent, COMSIG_ITEM_SPLIT_PROFIT, .proc/return_ratio)
|
||||
|
||||
/datum/component/pricetag/proc/Unwrapped()
|
||||
qdel(src) //Once it leaves it's wrapped container, the object in question should lose it's pricetag component.
|
||||
|
||||
/datum/component/pricetag/proc/split_profit(var/item_value)
|
||||
var/price = item_value
|
||||
if(price)
|
||||
var/adjusted_value = price*(profit_ratio/100)
|
||||
owner.adjust_money(adjusted_value)
|
||||
owner.bank_card_talk("Sale recorded. [adjusted_value] credits added to account.")
|
||||
return TRUE
|
||||
|
||||
/datum/component/pricetag/proc/return_ratio()
|
||||
return profit_ratio
|
||||
@@ -231,3 +231,9 @@
|
||||
icon = 'icons/obj/objects.dmi'
|
||||
icon_state = "shards"
|
||||
color = "#c6f4ff"
|
||||
|
||||
/obj/effect/decal/cleanable/wrapping
|
||||
name = "wrapping shreds"
|
||||
desc = "Torn pieces of cardboard and paper, left over from a package."
|
||||
icon = 'icons/obj/objects.dmi'
|
||||
icon_state = "paper_shreds"
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
if(QDELETED(src) && !transfer)
|
||||
new /obj/item/c_tube(T)
|
||||
|
||||
/obj/item/stack/wrapping_paper/small
|
||||
desc = "Wrap packages with this festive paper to make gifts. This roll looks a bit skimpy."
|
||||
amount = 10
|
||||
|
||||
/*
|
||||
* Package Wrap
|
||||
@@ -121,6 +124,11 @@
|
||||
if(QDELETED(src) && !transfer)
|
||||
new /obj/item/c_tube(T)
|
||||
|
||||
/obj/item/stack/packageWrap/small
|
||||
desc = "You can use this to wrap items in. This roll looks a bit skimpy."
|
||||
w_class = WEIGHT_CLASS_SMALL
|
||||
amount = 5
|
||||
|
||||
/obj/item/c_tube
|
||||
name = "cardboard tube"
|
||||
desc = "A tube... of cardboard."
|
||||
|
||||
@@ -1314,3 +1314,18 @@
|
||||
/obj/item/storage/box/gum/happiness/PopulateContents()
|
||||
for(var/i in 1 to 4)
|
||||
new/obj/item/reagent_containers/food/snacks/chewable/bubblegum/happiness(src)
|
||||
|
||||
/obj/item/storage/box/shipping
|
||||
name = "box of shipping supplies"
|
||||
desc = "Contains several scanners and labelers for shipping things. Wrapping Paper not included."
|
||||
illustration = "shipping"
|
||||
|
||||
/obj/item/storage/box/shipping/PopulateContents()
|
||||
var/static/items_inside = list(
|
||||
/obj/item/destTagger=1,\
|
||||
/obj/item/sales_tagger=1,\
|
||||
/obj/item/export_scanner=1,\
|
||||
/obj/item/stack/packageWrap/small=2,\
|
||||
/obj/item/stack/wrapping_paper/small=1
|
||||
)
|
||||
generate_items_inside(items_inside,src)
|
||||
|
||||
@@ -31,9 +31,12 @@ Credit dupes that require a lot of manual work shouldn't be removed, unless they
|
||||
if(!GLOB.exports_list.len)
|
||||
setupExports()
|
||||
|
||||
var/profit_ratio = 1 //Percentage that gets sent to the seller, rest goes to cargo.
|
||||
|
||||
var/list/contents = AM.GetAllContents()
|
||||
|
||||
var/datum/export_report/report = external_report
|
||||
|
||||
if(!report) //If we don't have any longer transaction going on
|
||||
report = new
|
||||
|
||||
@@ -43,11 +46,12 @@ Credit dupes that require a lot of manual work shouldn't be removed, unless they
|
||||
var/sold = FALSE
|
||||
if(QDELETED(thing))
|
||||
continue
|
||||
|
||||
for(var/datum/export/E in GLOB.exports_list)
|
||||
if(!E)
|
||||
continue
|
||||
if(E.applies_to(thing, allowed_categories, apply_elastic))
|
||||
sold = E.sell_object(thing, report, dry_run, allowed_categories , apply_elastic)
|
||||
sold = E.sell_object(thing, report, dry_run, allowed_categories , apply_elastic, profit_ratio)
|
||||
report.exported_atoms += " [thing.name]"
|
||||
if(!QDELETED(thing))
|
||||
report.exported_atoms_ref += thing
|
||||
@@ -127,10 +131,16 @@ Credit dupes that require a lot of manual work shouldn't be removed, unless they
|
||||
/datum/export/proc/sell_object(obj/O, datum/export_report/report, dry_run = TRUE, allowed_categories = EXPORT_CARGO , apply_elastic = TRUE)
|
||||
var/the_cost = get_cost(O, allowed_categories , apply_elastic)
|
||||
var/amount = get_amount(O)
|
||||
|
||||
var/profit_ratio = 0
|
||||
if(amount <=0 || the_cost <=0)
|
||||
return FALSE
|
||||
|
||||
if(dry_run == FALSE)
|
||||
if(SEND_SIGNAL(O, COMSIG_ITEM_SOLD, item_value = get_cost(O, allowed_categories , apply_elastic)) & COMSIG_ITEM_SPLIT_VALUE)
|
||||
profit_ratio = SEND_SIGNAL(O, COMSIG_ITEM_SPLIT_PROFIT)
|
||||
the_cost = the_cost*((100-profit_ratio)/100)
|
||||
else
|
||||
profit_ratio = SEND_SIGNAL(O, COMSIG_ITEM_SPLIT_PROFIT)
|
||||
the_cost = the_cost*((100-profit_ratio)/100)
|
||||
report.total_value[src] += the_cost
|
||||
|
||||
if(istype(O, /datum/export/material))
|
||||
|
||||
@@ -8,9 +8,15 @@
|
||||
var/giftwrapped = FALSE
|
||||
var/sortTag = 0
|
||||
var/obj/item/paper/note
|
||||
var/obj/item/barcode/sticker
|
||||
|
||||
/obj/structure/bigDelivery/interact(mob/user)
|
||||
to_chat(user, "<span class='notice'>You start to unwrap the package...</span>")
|
||||
if(!do_after(user, 15, target = user))
|
||||
return
|
||||
playsound(src.loc, 'sound/items/poster_ripped.ogg', 50, TRUE)
|
||||
new /obj/effect/decal/cleanable/wrapping(get_turf(user))
|
||||
unwrap_contents()
|
||||
qdel(src)
|
||||
|
||||
/obj/structure/bigDelivery/Destroy()
|
||||
@@ -31,6 +37,8 @@
|
||||
else
|
||||
. += "There's a [note.name] attached to it..."
|
||||
. += note.examine(user)
|
||||
if(sticker)
|
||||
. += "There's a barcode attached to the side."
|
||||
|
||||
/obj/structure/bigDelivery/attackby(obj/item/W, mob/user, params)
|
||||
if(istype(W, /obj/item/destTagger))
|
||||
@@ -78,6 +86,48 @@
|
||||
overlaystring = copytext(overlaystring, 5) //5 == length("gift") + 1
|
||||
add_overlay(overlaystring)
|
||||
|
||||
else if(istype(W, /obj/item/sales_tagger))
|
||||
var/obj/item/sales_tagger/tagger = W
|
||||
if(sticker)
|
||||
to_chat(user, "<span class='warning'>This package already has a barcode attached!</span>")
|
||||
return
|
||||
if(!(tagger.payments_acc))
|
||||
to_chat(user, "<span class='warning'>Swipe an ID on [tagger] first!</span>")
|
||||
return
|
||||
if(tagger.paper_count <= 0)
|
||||
to_chat(user, "<span class='warning'>[tagger] is out of paper!</span>")
|
||||
return
|
||||
user.visible_message("<span class='notice'>[user] attaches a barcode to [src].</span>", "<span class='notice'>You attach a barcode to [src].</span>")
|
||||
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.
|
||||
|
||||
var/list/wrap_contents = src.GetAllContents()
|
||||
for(var/obj/I in wrap_contents)
|
||||
I.AddComponent(/datum/component/pricetag, sticker.payments_acc, tagger.percent_cut)
|
||||
var/overlaystring = "[icon_state]_tag"
|
||||
if(giftwrapped)
|
||||
overlaystring = copytext(overlaystring, 5)
|
||||
add_overlay(overlaystring)
|
||||
else if(istype(W, /obj/item/barcode))
|
||||
var/obj/item/barcode/stickerA = W
|
||||
if(sticker)
|
||||
to_chat(user, "<span class='warning'>This package already has a barcode attached!</span>")
|
||||
return
|
||||
if(!(stickerA.payments_acc))
|
||||
to_chat(user, "<span class='warning'>This barcode seems to be invalid. Guess it's trash now.</span>")
|
||||
return
|
||||
if(!user.transferItemToLoc(W, src))
|
||||
to_chat(user, "<span class='warning'>For some reason, you can't attach [W]!</span>")
|
||||
return
|
||||
sticker = stickerA
|
||||
var/overlaystring = "[icon_state]_tag"
|
||||
if(giftwrapped)
|
||||
overlaystring = copytext_char(overlaystring, 5) //5 == length("gift") + 1
|
||||
add_overlay(overlaystring)
|
||||
|
||||
|
||||
else
|
||||
return ..()
|
||||
|
||||
@@ -93,11 +143,18 @@
|
||||
to_chat(user, "<span class='notice'>You successfully removed [O]'s wrapping !</span>")
|
||||
O.forceMove(loc)
|
||||
playsound(src.loc, 'sound/items/poster_ripped.ogg', 50, TRUE)
|
||||
new /obj/effect/decal/cleanable/wrapping(get_turf(user))
|
||||
unwrap_contents()
|
||||
qdel(src)
|
||||
else
|
||||
if(user.loc == src) //so we don't get the message if we resisted multiple times and succeeded.
|
||||
to_chat(user, "<span class='warning'>You fail to remove [O]'s wrapping!</span>")
|
||||
|
||||
/obj/structure/bigDelivery/proc/unwrap_contents()
|
||||
if(!sticker)
|
||||
return
|
||||
for(var/obj/I in src.GetAllContents())
|
||||
SEND_SIGNAL(I, COMSIG_STRUCTURE_UNWRAPPED)
|
||||
|
||||
/obj/item/smallDelivery
|
||||
name = "parcel"
|
||||
@@ -108,17 +165,23 @@
|
||||
var/giftwrapped = 0
|
||||
var/sortTag = 0
|
||||
var/obj/item/paper/note
|
||||
var/obj/item/barcode/sticker
|
||||
|
||||
/obj/item/smallDelivery/contents_explosion(severity, target)
|
||||
for(var/atom/movable/AM in contents)
|
||||
AM.ex_act()
|
||||
|
||||
/obj/item/smallDelivery/attack_self(mob/user)
|
||||
to_chat(user, "<span class='notice'>You start to unwrap the package...</span>")
|
||||
if(!do_after(user, 15, target = user))
|
||||
return
|
||||
user.temporarilyRemoveItemFromInventory(src, TRUE)
|
||||
unwrap_contents()
|
||||
for(var/X in contents)
|
||||
var/atom/movable/AM = X
|
||||
user.put_in_hands(AM)
|
||||
playsound(src.loc, 'sound/items/poster_ripped.ogg', 50, TRUE)
|
||||
new /obj/effect/decal/cleanable/wrapping(get_turf(user))
|
||||
qdel(src)
|
||||
|
||||
/obj/item/smallDelivery/attack_self_tk(mob/user)
|
||||
@@ -133,6 +196,8 @@
|
||||
var/atom/movable/AM = X
|
||||
AM.forceMove(src.loc)
|
||||
playsound(src.loc, 'sound/items/poster_ripped.ogg', 50, TRUE)
|
||||
new /obj/effect/decal/cleanable/wrapping(get_turf(user))
|
||||
unwrap_contents()
|
||||
qdel(src)
|
||||
|
||||
/obj/item/smallDelivery/examine(mob/user)
|
||||
@@ -143,6 +208,8 @@
|
||||
else
|
||||
. += "There's a [note.name] attached to it..."
|
||||
. += note.examine(user)
|
||||
if(sticker)
|
||||
. += "There's a barcode attached to the side."
|
||||
|
||||
/obj/item/smallDelivery/attackby(obj/item/W, mob/user, params)
|
||||
if(istype(W, /obj/item/destTagger))
|
||||
@@ -190,6 +257,54 @@
|
||||
overlaystring = copytext_char(overlaystring, 5) //5 == length("gift") + 1
|
||||
add_overlay(overlaystring)
|
||||
|
||||
else if(istype(W, /obj/item/sales_tagger))
|
||||
var/obj/item/sales_tagger/tagger = W
|
||||
if(sticker)
|
||||
to_chat(user, "<span class='warning'>This package already has a barcode attached!</span>")
|
||||
return
|
||||
if(!(tagger.payments_acc))
|
||||
to_chat(user, "<span class='warning'>Swipe an ID on [tagger] first!</span>")
|
||||
return
|
||||
if(tagger.paper_count <= 0)
|
||||
to_chat(user, "<span class='warning'>[tagger] is out of paper!</span>")
|
||||
return
|
||||
user.visible_message("<span class='notice'>[user] attaches a barcode to [src].</span>", "<span class='notice'>You attach a barcode to [src].</span>")
|
||||
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.
|
||||
|
||||
var/list/wrap_contents = src.GetAllContents()
|
||||
for(var/obj/I in wrap_contents)
|
||||
I.AddComponent(/datum/component/pricetag, sticker.payments_acc, tagger.percent_cut)
|
||||
var/overlaystring = "[icon_state]_tag"
|
||||
if(giftwrapped)
|
||||
overlaystring = copytext(overlaystring, 5)
|
||||
add_overlay(overlaystring)
|
||||
|
||||
else if(istype(W, /obj/item/barcode))
|
||||
var/obj/item/barcode/stickerA = W
|
||||
if(sticker)
|
||||
to_chat(user, "<span class='warning'>This package already has a barcode attached!</span>")
|
||||
return
|
||||
if(!(stickerA.payments_acc))
|
||||
to_chat(user, "<span class='warning'>This barcode seems to be invalid. Guess it's trash now.</span>")
|
||||
return
|
||||
if(!user.transferItemToLoc(W, src))
|
||||
to_chat(user, "<span class='warning'>For some reason, you can't attach [W]!</span>")
|
||||
return
|
||||
sticker = stickerA
|
||||
var/overlaystring = "[icon_state]_tag"
|
||||
if(giftwrapped)
|
||||
overlaystring = copytext_char(overlaystring, 5) //5 == length("gift") + 1
|
||||
add_overlay(overlaystring)
|
||||
|
||||
/obj/item/smallDelivery/proc/unwrap_contents()
|
||||
if(!sticker)
|
||||
return
|
||||
for(var/obj/I in src.GetAllContents())
|
||||
SEND_SIGNAL(I, COMSIG_ITEM_UNWRAPPED)
|
||||
|
||||
/obj/item/destTagger
|
||||
name = "destination tagger"
|
||||
desc = "Used to set the destination of properly wrapped packages."
|
||||
@@ -197,7 +312,7 @@
|
||||
icon_state = "cargotagger"
|
||||
var/currTag = 0 //Destinations are stored in code\globalvars\lists\flavor_misc.dm
|
||||
var/locked_destination = FALSE //if true, users can't open the destination tag window to prevent changing the tagger's current destination
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
item_state = "electronic"
|
||||
lefthand_file = 'icons/mob/inhands/misc/devices_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
|
||||
@@ -243,3 +358,90 @@
|
||||
var/n = text2num(href_list["nextTag"])
|
||||
currTag = n
|
||||
openwindow(usr)
|
||||
|
||||
/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."
|
||||
icon = 'icons/obj/device.dmi'
|
||||
icon_state = "salestagger"
|
||||
item_state = "electronic"
|
||||
lefthand_file = 'icons/mob/inhands/misc/devices_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
slot_flags = ITEM_SLOT_BELT
|
||||
///The account which is recieving the split profits.
|
||||
var/datum/bank_account/payments_acc = null
|
||||
var/paper_count = 10
|
||||
var/max_paper_count = 20
|
||||
///Details the percentage the scanned account recieves off the final sale.
|
||||
var/percent_cut = 20
|
||||
|
||||
/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]%."
|
||||
|
||||
/obj/item/sales_tagger/attackby(obj/item/I, mob/living/user, params)
|
||||
. = ..()
|
||||
if(istype(I, /obj/item/card/id))
|
||||
var/obj/item/card/id/potential_acc = I
|
||||
if(potential_acc.registered_account)
|
||||
payments_acc = potential_acc.registered_account
|
||||
playsound(src, 'sound/machines/ping.ogg', 40, TRUE)
|
||||
to_chat(user, "<span class='notice'>[src] registers the ID card. Tag a wrapped item to create a barcode.</span>")
|
||||
else if(!potential_acc.registered_account)
|
||||
to_chat(user, "<span class='warning'>This ID card has no account registered!</span>")
|
||||
return
|
||||
else if(payments_acc != potential_acc.registered_account)
|
||||
to_chat(user, "<span class='notice'>ID card already registered.</span>")
|
||||
if(istype(I, /obj/item/paper))
|
||||
if (!(paper_count >= max_paper_count))
|
||||
paper_count += 10
|
||||
qdel(I)
|
||||
if (paper_count >= max_paper_count)
|
||||
paper_count = max_paper_count
|
||||
to_chat(user, "<span class='notice'>[src]'s paper supply is now full.</span>")
|
||||
return
|
||||
to_chat(user, "<span class='notice'>You refill [src]'s paper supply, you have [paper_count] left.</span>")
|
||||
return
|
||||
else
|
||||
to_chat(user, "<span class='notice'>[src]'s paper supply is full.</span>")
|
||||
return
|
||||
|
||||
/obj/item/sales_tagger/attack_self(mob/user)
|
||||
. = ..()
|
||||
if(paper_count <= 0)
|
||||
to_chat(user, "<span class='warning'>You're out of paper!'.</span>")
|
||||
return
|
||||
if(!payments_acc)
|
||||
to_chat(user, "<span class='warning'>You need to swipe [src] with an ID card first.</span>")
|
||||
return
|
||||
paper_count -= 1
|
||||
playsound(src, 'sound/machines/click.ogg', 40, TRUE)
|
||||
to_chat(user, "<span class='notice'>You print a new barcode.</span>")
|
||||
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.
|
||||
user.put_in_hands(new_barcode)
|
||||
|
||||
/obj/item/sales_tagger/CtrlClick(mob/user)
|
||||
. = ..()
|
||||
payments_acc = null
|
||||
to_chat(user, "<span class='notice'>You clear the registered account.</span>")
|
||||
|
||||
/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
|
||||
if(!potential_cut)
|
||||
percent_cut = 50
|
||||
percent_cut = clamp(round(potential_cut, 1), 1, 50)
|
||||
to_chat(user, "<span class='notice'>[percent_cut]% profit will be recieved if a package with a barcode is sold.</span>")
|
||||
|
||||
/obj/item/barcode
|
||||
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
|
||||
|
||||
@@ -864,6 +864,15 @@
|
||||
build_path = /obj/item/destTagger
|
||||
category = list("initial", "Electronics")
|
||||
|
||||
/datum/design/salestagger
|
||||
name = "Sales Tagger"
|
||||
id = "salestagger"
|
||||
build_type = AUTOLATHE | PROTOLATHE
|
||||
materials = list(/datum/material/iron = 700, /datum/material/glass = 200)
|
||||
build_path = /obj/item/sales_tagger
|
||||
category = list("initial", "Electronics")
|
||||
departmental_flags = DEPARTMENTAL_FLAG_CARGO | DEPARTMENTAL_FLAG_SERVICE
|
||||
|
||||
/datum/design/handlabeler
|
||||
name = "Hand Labeler"
|
||||
id = "handlabel"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
display_name = "Basic Research Technology"
|
||||
description = "NT default research technologies."
|
||||
// Default research tech, prevents bricking
|
||||
design_ids = list("basic_matter_bin", "basic_cell", "basic_scanning", "basic_capacitor", "basic_micro_laser", "micro_mani", "desttagger", "handlabel", "packagewrap",
|
||||
design_ids = list("basic_matter_bin", "basic_cell", "basic_scanning", "basic_capacitor", "basic_micro_laser", "micro_mani", "desttagger", "salestagger", "handlabel", "packagewrap",
|
||||
"destructive_analyzer", "circuit_imprinter", "experimentor", "rdconsole", "bepis", "design_disk", "tech_disk", "rdserver", "rdservercontrol", "mechfab",
|
||||
"paystand", "space_heater", "bucket", "sec_rshot", "sec_beanbag_slug", "sec_bshot", "sec_slug", "sec_Islug", "sec_dart", "sec_38", "rglass", "plasteel",
|
||||
"plastitanium", "plasmaglass", "plasmareinforcedglass", "titaniumglass", "plastitaniumglass", "plastic_knife", "plastic_fork", "plastic_spoon")
|
||||
|
||||
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 57 KiB |
|
Before Width: | Height: | Size: 104 KiB After Width: | Height: | Size: 103 KiB |
|
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 73 KiB |
@@ -412,6 +412,7 @@
|
||||
#include "code\datums\components\ntnet_interface.dm"
|
||||
#include "code\datums\components\orbiter.dm"
|
||||
#include "code\datums\components\paintable.dm"
|
||||
#include "code\datums\components\pricetag.dm"
|
||||
#include "code\datums\components\punchcooldown.dm"
|
||||
#include "code\datums\components\rad_insulation.dm"
|
||||
#include "code\datums\components\radioactive.dm"
|
||||
|
||||