[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.
This commit is contained in:
ArcaneMusic
2020-02-25 20:42:01 +08:00
committed by GitHub
parent dfecf744ef
commit 94f27c7b25
21 changed files with 318 additions and 14 deletions
+13 -3
View File
@@ -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))