port of https://github.com/tgstation/tgstation/pull/49111 aka sales taggers, credit to ArcaneMusic

This commit is contained in:
shellspeed1
2022-09-18 20:55:22 -07:00
parent 3dace329be
commit b4f886d999
14 changed files with 299 additions and 5 deletions
+3 -3
View File
@@ -101,22 +101,22 @@
required_count = 15
wanted_types = list(/obj/item/shard)
/*
/datum/bounty/item/assistant/comfy_chair
name = "Comfortable Chairs"
description = "Commander Pat is unhappy with his chair. He claims it hurts his back. Ship some alternatives out to humor him."
reward = 900
required_count = 5
wanted_types = list(/obj/structure/chair/comfy)
*/
/datum/bounty/item/assistant/geranium
/*
/datum/bounty/item/assistant/geranium
name = "Geraniums"
description = "Commander Zot has the hots for Commander Zena. Send a shipment of geraniums - her favorite flower - and he'll happily reward you."
reward = 1000
required_count = 3
wanted_types = list(/obj/item/reagent_containers/food/snacks/grown/poppy/geranium)
include_subtypes = FALSE
*/
/datum/bounty/item/assistant/poppy
name = "Poppies"
+13 -1
View File
@@ -33,6 +33,8 @@ 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
@@ -47,7 +49,7 @@ Credit dupes that require a lot of manual work shouldn't be removed, unless they
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]"
break
if(thing.reagents?.value_multiplier)
@@ -138,9 +140,19 @@ Credit dupes that require a lot of manual work shouldn't be removed, unless they
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))